当前位置: 首页>>代码示例>>Java>>正文


Java StartupMetrics类代码示例

本文整理汇总了Java中org.chromium.chrome.browser.metrics.StartupMetrics的典型用法代码示例。如果您正苦于以下问题:Java StartupMetrics类的具体用法?Java StartupMetrics怎么用?Java StartupMetrics使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


StartupMetrics类属于org.chromium.chrome.browser.metrics包,在下文中一共展示了StartupMetrics类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onResumeWithNative

import org.chromium.chrome.browser.metrics.StartupMetrics; //导入依赖的package包/类
@Override
public void onResumeWithNative() {
    super.onResumeWithNative();

    CookiesFetcher.restoreCookies(this);
    StartupMetrics.getInstance().recordHistogram(false);

    if (FeatureUtilities.isTabModelMergingEnabled()) {
        boolean inMultiWindowMode = MultiWindowUtils.getInstance().isInMultiWindowMode(this);
        // Merge tabs if the activity is not in multi-window mode and mMergeTabsOnResume is true
        // or unset because the activity is just starting or was destroyed.
        if (!inMultiWindowMode && (mMergeTabsOnResume == null || mMergeTabsOnResume)) {
            maybeMergeTabs();
        }
        mMergeTabsOnResume = false;
    }
    mVrShellDelegate.maybeResumeVR();

    mLocaleManager.setSnackbarManager(getSnackbarManager());
    mLocaleManager.startObservingPhoneChanges();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:22,代码来源:ChromeTabbedActivity.java

示例2: onFocusChanged

import org.chromium.chrome.browser.metrics.StartupMetrics; //导入依赖的package包/类
@Override
protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
    mFocused = focused;
    if (!focused) mAutocompleteSpan.clearSpan();
    super.onFocusChanged(focused, direction, previouslyFocusedRect);

    if (focused && mFirstFocusTimeMs == 0) {
        mFirstFocusTimeMs = SystemClock.elapsedRealtime();
        if (mOmniboxLivenessListener != null) mOmniboxLivenessListener.onOmniboxFocused();
    }

    if (focused) StartupMetrics.getInstance().recordFocusedOmnibox();

    fixupTextDirection();
    // Always align to the same as the paragraph direction (LTR = left, RTL = right).
    ApiCompatibilityUtils.setTextAlignment(this, TEXT_ALIGNMENT_TEXT_START);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:18,代码来源:UrlBar.java

示例3: updateForegroundState

import org.chromium.chrome.browser.metrics.StartupMetrics; //导入依赖的package包/类
/**
 * Updates whether the page is in the foreground based on whether the application is in the
 * foreground and whether {@link #mView} is attached to the application window. If the page is
 * no longer in the foreground, records the time that the page spent in the foreground to UMA.
 */
private void updateForegroundState() {
    boolean inForeground = mIsAttachedToWindow
            && ApplicationStatus.getStateForActivity(mActivity) == ActivityState.RESUMED;
    if (mInForeground == inForeground) {
        return;
    }

    mInForeground = inForeground;
    if (mInForeground) {
        mForegroundTimeMs = SystemClock.elapsedRealtime();
        StartupMetrics.getInstance().recordOpenedRecents();
    } else {
        RecordHistogram.recordLongTimesHistogram("NewTabPage.RecentTabsPage.TimeVisibleAndroid",
                SystemClock.elapsedRealtime() - mForegroundTimeMs, TimeUnit.MILLISECONDS);
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:22,代码来源:RecentTabsPage.java

示例4: onLoadingComplete

import org.chromium.chrome.browser.metrics.StartupMetrics; //导入依赖的package包/类
@Override
public void onLoadingComplete(Tile[] items) {
    if (mIsDestroyed) return;

    super.onLoadingComplete(items);

    long loadTimeMs = (System.nanoTime() - mConstructedTimeNs) / 1000000;
    RecordHistogram.recordTimesHistogram(
            "Tab.NewTabOnload", loadTimeMs, TimeUnit.MILLISECONDS);
    mIsLoaded = true;
    StartupMetrics.getInstance().recordOpenedNTP();
    NewTabPageUma.recordNTPImpression(NewTabPageUma.NTP_IMPRESSION_REGULAR);
    // If not visible when loading completes, wait until onShown is received.
    if (!mTab.isHidden()) recordNTPShown();

    if (isNtpOfflinePagesEnabled()) {
        final int maxNumTiles = 12;
        for (int i = 0; i < items.length; i++) {
            if (items[i].isOfflineAvailable()) {
                RecordHistogram.recordEnumeratedHistogram(
                        "NewTabPage.TileOfflineAvailable", i, maxNumTiles);
            }
        }
    }
    SyncSessionsMetrics.recordYoungestForeignTabAgeOnNTP();
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:27,代码来源:NewTabPage.java

示例5: onStopWithNative

import org.chromium.chrome.browser.metrics.StartupMetrics; //导入依赖的package包/类
@Override
public void onStopWithNative() {
    super.onStopWithNative();

    if (getActivityTab() != null) getActivityTab().setIsAllowedToReturnToExternalApp(false);

    mTabModelSelectorImpl.saveState();
    StartupMetrics.getInstance().recordHistogram(true);
    mActivityStopMetrics.onStopWithNative(this);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:11,代码来源:ChromeTabbedActivity.java

示例6: onOverviewModeStartedShowing

import org.chromium.chrome.browser.metrics.StartupMetrics; //导入依赖的package包/类
@Override
public void onOverviewModeStartedShowing(boolean showToolbar) {
    if (mFindToolbarManager != null) mFindToolbarManager.hideToolbar();
    if (getAssistStatusHandler() != null) getAssistStatusHandler().updateAssistState();
    if (getAppMenuHandler() != null) getAppMenuHandler().hideAppMenu();
    ApiCompatibilityUtils.setStatusBarColor(getWindow(), Color.BLACK);
    StartupMetrics.getInstance().recordOpenedTabSwitcher();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:9,代码来源:ChromeTabbedActivity.java

示例7: onLoadingComplete

import org.chromium.chrome.browser.metrics.StartupMetrics; //导入依赖的package包/类
@Override
public void onLoadingComplete(MostVisitedItem[] items) {
    if (mIsDestroyed) return;

    long loadTimeMs = (System.nanoTime() - mConstructedTimeNs) / 1000000;
    RecordHistogram.recordTimesHistogram(
            "Tab.NewTabOnload", loadTimeMs, TimeUnit.MILLISECONDS);
    mIsLoaded = true;
    StartupMetrics.getInstance().recordOpenedNTP();
    NewTabPageUma.recordNTPImpression(NewTabPageUma.NTP_IMPRESSION_REGULAR);
    // If not visible when loading completes, wait until onShown is received.
    if (!mTab.isHidden()) recordNTPShown();

    int tileTypes[] = new int[items.length];
    int sources[] = new int[items.length];

    for (int i = 0; i < items.length; i++) {
        tileTypes[i] = items[i].getTileType();
        sources[i] = items[i].getSource();
    }

    mMostVisitedSites.recordTileTypeMetrics(tileTypes, sources);

    if (isNtpOfflinePagesEnabled()) {
        final int maxNumTiles = 12;
        for (int i = 0; i < items.length; i++) {
            if (items[i].isOfflineAvailable()) {
                RecordHistogram.recordEnumeratedHistogram(
                        "NewTabPage.TileOfflineAvailable", i, maxNumTiles);
            }
        }
    }
    SyncSessionsMetrics.recordYoungestForeignTabAgeOnNTP();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:35,代码来源:NewTabPage.java

示例8: onResumeWithNative

import org.chromium.chrome.browser.metrics.StartupMetrics; //导入依赖的package包/类
@Override
public void onResumeWithNative() {
    super.onResumeWithNative();

    if (shouldDestroyIncognitoProfile()) {
        Profile.getLastUsedProfile().getOffTheRecordProfile().destroyWhenAppropriate();
    } else {
        CookiesFetcher.restoreCookies(this);
    }

    StartupMetrics.getInstance().recordHistogram(false);

    if (FeatureUtilities.isTabModelMergingEnabled()) {
        boolean inMultiWindowMode = MultiWindowUtils.getInstance().isInMultiWindowMode(this);
        // Merge tabs if the activity is not in multi-window mode and mMergeTabsOnResume is true
        // or unset because the activity is just starting or was destroyed.
        if (!inMultiWindowMode && (mMergeTabsOnResume == null || mMergeTabsOnResume)) {
            maybeMergeTabs();
        }
        mMergeTabsOnResume = false;
    }

    mLocaleManager.setSnackbarManager(getSnackbarManager());
    mLocaleManager.startObservingPhoneChanges();

    if (isWarmOnResume()) {
        SuggestionsEventReporterBridge.onActivityWarmResumed();
    } else {
        SuggestionsEventReporterBridge.onColdStart();
    }
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:32,代码来源:ChromeTabbedActivity.java

示例9: onStopWithNative

import org.chromium.chrome.browser.metrics.StartupMetrics; //导入依赖的package包/类
@Override
public void onStopWithNative() {
    super.onStopWithNative();

    if (getActivityTab() != null) getActivityTab().setIsAllowedToReturnToExternalApp(false);

    mTabModelSelectorImpl.saveState();
    StartupMetrics.getInstance().recordHistogram(true);
    mActivityStopMetrics.onStopWithNative(this);

    ContextUtils.getAppSharedPreferences()
            .edit()
            .putLong(LAST_BACKGROUNDED_TIME_MS_PREF, System.currentTimeMillis())
            .apply();
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:16,代码来源:ChromeTabbedActivity.java

示例10: onFocusChanged

import org.chromium.chrome.browser.metrics.StartupMetrics; //导入依赖的package包/类
@Override
protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
    mFocused = focused;
    super.onFocusChanged(focused, direction, previouslyFocusedRect);

    if (focused && mFirstFocusTimeMs == 0) {
        mFirstFocusTimeMs = SystemClock.elapsedRealtime();
        if (mOmniboxLivenessListener != null) mOmniboxLivenessListener.onOmniboxFocused();
    }

    if (focused) StartupMetrics.getInstance().recordFocusedOmnibox();

    fixupTextDirection();
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:15,代码来源:UrlBar.java

示例11: onStart

import org.chromium.chrome.browser.metrics.StartupMetrics; //导入依赖的package包/类
@Override
public void onStart() {
    super.onStart();
    StartupMetrics.getInstance().updateIntent(getIntent());
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:6,代码来源:ChromeTabbedActivity.java

示例12: onMenuOrKeyboardAction

import org.chromium.chrome.browser.metrics.StartupMetrics; //导入依赖的package包/类
@Override
public boolean onMenuOrKeyboardAction(final int id, boolean fromMenu) {
    final Tab currentTab = getActivityTab();
    if (id == R.id.move_to_other_window_menu_id) {
        if (currentTab != null) moveTabToOtherWindow(currentTab);
    } else if (id == R.id.new_tab_menu_id) {
        getTabModelSelector().getModel(false).commitAllTabClosures();
        RecordUserAction.record("MobileMenuNewTab");
        RecordUserAction.record("MobileNewTabOpened");
        reportNewTabShortcutUsed(false);
        getTabCreator(false).launchUrl(UrlConstants.NTP_URL, TabLaunchType.FROM_CHROME_UI);
        mLocaleManager.showSearchEnginePromoIfNeeded(this);
    } else if (id == R.id.new_incognito_tab_menu_id) {
        if (PrefServiceBridge.getInstance().isIncognitoModeEnabled()) {
            getTabModelSelector().getModel(false).commitAllTabClosures();
            // This action must be recorded before opening the incognito tab since UMA actions
            // are dropped when an incognito tab is open.
            RecordUserAction.record("MobileMenuNewIncognitoTab");
            RecordUserAction.record("MobileNewTabOpened");
            reportNewTabShortcutUsed(true);
            getTabCreator(true).launchUrl(UrlConstants.NTP_URL, TabLaunchType.FROM_CHROME_UI);
        }
    } else if (id == R.id.all_bookmarks_menu_id) {
        if (currentTab != null) {
            getCompositorViewHolder().hideKeyboard(new Runnable() {
                @Override
                public void run() {
                    StartupMetrics.getInstance().recordOpenedBookmarks();
                    BookmarkUtils.showBookmarkManager(ChromeTabbedActivity.this);
                }
            });
            RecordUserAction.record("MobileMenuAllBookmarks");
        }
    } else if (id == R.id.recent_tabs_menu_id) {
        if (currentTab != null) {
            currentTab.loadUrl(new LoadUrlParams(
                    UrlConstants.RECENT_TABS_URL,
                    PageTransition.AUTO_BOOKMARK));
            RecordUserAction.record("MobileMenuOpenTabs");
        }
    } else if (id == R.id.close_all_tabs_menu_id) {
        // Close both incognito and normal tabs
        getTabModelSelector().closeAllTabs();
        RecordUserAction.record("MobileMenuCloseAllTabs");
    } else if (id == R.id.close_all_incognito_tabs_menu_id) {
        // Close only incognito tabs
        getTabModelSelector().getModel(true).closeAllTabs();
        // TODO(nileshagrawal) Record unique action for this. See bug http://b/5542946.
        RecordUserAction.record("MobileMenuCloseAllTabs");
    } else if (id == R.id.find_in_page_id) {
        mFindToolbarManager.showToolbar();
        if (getContextualSearchManager() != null) {
            getContextualSearchManager().hideContextualSearch(StateChangeReason.UNKNOWN);
        }
        if (fromMenu) {
            RecordUserAction.record("MobileMenuFindInPage");
        } else {
            RecordUserAction.record("MobileShortcutFindInPage");
        }
    } else if (id == R.id.focus_url_bar) {
        boolean isUrlBarVisible = !mLayoutManager.overviewVisible()
                && (!isTablet() || getCurrentTabModel().getCount() != 0);
        if (isUrlBarVisible) {
            getToolbarManager().setUrlBarFocus(true);
        }
    } else if (id == R.id.downloads_menu_id) {
        DownloadUtils.showDownloadManager(this, currentTab);
        RecordUserAction.record("MobileMenuDownloadManager");
    } else if (id == R.id.open_recently_closed_tab) {
        TabModel currentModel = mTabModelSelectorImpl.getCurrentModel();
        if (!currentModel.isIncognito()) currentModel.openMostRecentlyClosedTab();
        RecordUserAction.record("MobileTabClosedUndoShortCut");
    } else if (id == R.id.enter_vr_id) {
        mVrShellDelegate.enterVRIfNecessary();
    } else {
        return super.onMenuOrKeyboardAction(id, fromMenu);
    }
    return true;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:80,代码来源:ChromeTabbedActivity.java

示例13: openHistoryPage

import org.chromium.chrome.browser.metrics.StartupMetrics; //导入依赖的package包/类
/**
 * Opens the history page.
 */
public void openHistoryPage() {
    if (mIsDestroyed) return;
    mTab.loadUrl(new LoadUrlParams(UrlConstants.HISTORY_URL));
    StartupMetrics.getInstance().recordOpenedHistory();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:9,代码来源:RecentTabsManager.java

示例14: openHistoryPage

import org.chromium.chrome.browser.metrics.StartupMetrics; //导入依赖的package包/类
/**
 * Opens the history page.
 */
public void openHistoryPage() {
    if (mIsDestroyed) return;
    HistoryManagerUtils.showHistoryManager(mTab.getActivity(), mTab);
    StartupMetrics.getInstance().recordOpenedHistory();
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:9,代码来源:RecentTabsManager.java


注:本文中的org.chromium.chrome.browser.metrics.StartupMetrics类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。