當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。