當前位置: 首頁>>代碼示例>>Java>>正文


Java DocumentModeAssassinObserver類代碼示例

本文整理匯總了Java中org.chromium.chrome.browser.tabmodel.DocumentModeAssassin.DocumentModeAssassinObserver的典型用法代碼示例。如果您正苦於以下問題:Java DocumentModeAssassinObserver類的具體用法?Java DocumentModeAssassinObserver怎麽用?Java DocumentModeAssassinObserver使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DocumentModeAssassinObserver類屬於org.chromium.chrome.browser.tabmodel.DocumentModeAssassin包,在下文中一共展示了DocumentModeAssassinObserver類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: UpgradeActivity

import org.chromium.chrome.browser.tabmodel.DocumentModeAssassin.DocumentModeAssassinObserver; //導入依賴的package包/類
public UpgradeActivity() {
    mHandler = new Handler(Looper.getMainLooper());

    mObserver = new DocumentModeAssassinObserver() {
        @Override
        public void onStageChange(int newStage) {
            if (newStage != DocumentModeAssassin.STAGE_DONE) return;
            DocumentModeAssassin.getInstance().removeObserver(this);

            // Always post to avoid any issues that could arise from firing the Runnable
            // while other Observers are being alerted.
            long msElapsed = System.currentTimeMillis() - mStartTimestamp;
            long msRemaining = Math.max(0, MIN_MS_TO_DISPLAY_ACTIVITY - msElapsed);
            mHandler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    continueApplicationLaunch();
                }
            }, msRemaining);
        }
    };
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:23,代碼來源:UpgradeActivity.java

示例2: onHandleIntent

import org.chromium.chrome.browser.tabmodel.DocumentModeAssassin.DocumentModeAssassinObserver; //導入依賴的package包/類
@Override
protected void onHandleIntent(Intent intent) {
    final DocumentModeAssassin assassin = DocumentModeAssassin.getInstance();
    if (!assassin.isMigrationNecessary()) return;

    final CountDownLatch finishSignal = new CountDownLatch(1);
    ThreadUtils.runOnUiThread(new Runnable() {
        @Override
        public void run() {
            if (assassin.isMigrationNecessary()) {
                // Kick off migration if it hasn't already started.
                DocumentModeAssassinObserver observer = new DocumentModeAssassinObserver() {
                    @Override
                    public void onStageChange(int newStage) {
                        if (newStage != DocumentModeAssassin.STAGE_DONE) return;
                        assassin.removeObserver(this);
                        finishSignal.countDown();
                    }
                };
                assassin.addObserver(observer);
                assassin.migrateFromDocumentToTabbedMode();
            } else {
                // Migration finished in the background.
                finishSignal.countDown();
            }
        }
    });

    try {
        boolean success = finishSignal.await(TIMEOUT_MS, TimeUnit.MILLISECONDS);
        Log.d(TAG, "Migration completed.  Status: " + success);
    } catch (InterruptedException e) {
        Log.e(TAG, "Failed to migrate user on time.");
    }
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:36,代碼來源:UpgradeIntentService.java


注:本文中的org.chromium.chrome.browser.tabmodel.DocumentModeAssassin.DocumentModeAssassinObserver類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。