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


Java BrowserStartupController类代码示例

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


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

示例1: startChromeBrowserProcessesSync

import org.chromium.content.browser.BrowserStartupController; //导入依赖的package包/类
private void startChromeBrowserProcessesSync() throws ProcessInitException {
    try {
        TraceEvent.begin("ChromeBrowserInitializer.startChromeBrowserProcessesSync");
        ThreadUtils.assertOnUiThread();
        mApplication.initCommandLine();
        LibraryLoader libraryLoader = LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER);
        StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
        libraryLoader.ensureInitialized();
        StrictMode.setThreadPolicy(oldPolicy);
        libraryLoader.asyncPrefetchLibrariesToMemory();
        BrowserStartupController.get(mApplication, LibraryProcessType.PROCESS_BROWSER)
                .startBrowserProcessesSync(false);
        GoogleServicesManager.get(mApplication);
    } finally {
        TraceEvent.end("ChromeBrowserInitializer.startChromeBrowserProcessesSync");
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:18,代码来源:ChromeBrowserInitializer.java

示例2: registerNativeInitStartupCallback

import org.chromium.content.browser.BrowserStartupController; //导入依赖的package包/类
/**
 * Register a StartupCallback to initialize the native portion of the JNI bridge.
 */
private void registerNativeInitStartupCallback() {
    ThreadUtils.postOnUiThread(new Runnable() {
        @Override
        public void run() {
            BrowserStartupController.get(mContext, LibraryProcessType.PROCESS_BROWSER)
                    .addStartupCompletedObserver(new StartupCallback() {
                        @Override
                        public void onSuccess(boolean alreadyStarted) {
                            mNativePhysicalWebDataSourceAndroid = nativeInit();
                        }

                        @Override
                        public void onFailure() {
                            // Startup failed.
                        }
                    });
        }
    });
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:23,代码来源:UrlManager.java

示例3: notifyAccountsChangedOnBrowserStartup

import org.chromium.content.browser.BrowserStartupController; //导入依赖的package包/类
private static void notifyAccountsChangedOnBrowserStartup(
        final Context context, final Intent intent) {
    StartupCallback notifyAccountsChangedCallback = new StartupCallback() {
        @Override
        public void onSuccess(boolean alreadyStarted) {
            for (AccountsChangedObserver observer : sObservers) {
                observer.onAccountsChanged(context, intent);
            }
        }

        @Override
        public void onFailure() {
            // Startup failed, so ignore call.
        }
    };
    // If the browser process has already been loaded, a task will be posted immediately to
    // call the |notifyAccountsChangedCallback| passed in as a parameter.
    BrowserStartupController.get(context, LibraryProcessType.PROCESS_BROWSER)
            .addStartupCompletedObserver(notifyAccountsChangedCallback);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:21,代码来源:AccountsChangedReceiver.java

示例4: onNativeLaunched

import org.chromium.content.browser.BrowserStartupController; //导入依赖的package包/类
private static void onNativeLaunched(final Context context, final Runnable task) {
    ThreadUtils.postOnUiThread(new Runnable() {
        @Override
        public void run() {
            BrowserStartupController.get(context, LibraryProcessType.PROCESS_BROWSER)
                    .addStartupCompletedObserver(
                            new StartupCallback() {
                                @Override
                                public void onSuccess(boolean alreadyStarted) {
                                    task.run();
                                }

                                @Override
                                public void onFailure() {
                                    // Startup failed.
                                }
                            });
        }
    });
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:21,代码来源:GcmUma.java

示例5: onCreate

import org.chromium.content.browser.BrowserStartupController; //导入依赖的package包/类
@Override
public boolean onCreate() {
    ContentApplication.initCommandLine(getContext());

    BrowserStartupController.get(getContext(), LibraryProcessType.PROCESS_BROWSER)
            .addStartupCompletedObserver(
                    new BrowserStartupController.StartupCallback() {
                        @Override
                        public void onSuccess(boolean alreadyStarted) {
                            ensureNativeSideInitialized();
                        }

                        @Override
                        public void onFailure() {
                        }
                    });

    return true;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:20,代码来源:ChromeBrowserProvider.java

示例6: onCreate

import org.chromium.content.browser.BrowserStartupController; //导入依赖的package包/类
@Override
public boolean onCreate() {
    ContentApplication.initCommandLine(getContext());

    BrowserStartupController.get(getContext(), LibraryProcessType.PROCESS_BROWSER)
            .addStartupCompletedObserver(
                    new BrowserStartupController.StartupCallback() {
                        @Override
                        public void onSuccess(boolean alreadyStarted) {
                            ensureNativeSideInitialized();
                        }

                        @Override
                        public void onFailure() {
                        }
                    });

    // Pre-load shared preferences object, this happens on a separate thread
    PreferenceManager.getDefaultSharedPreferences(getContext());
    return true;
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:22,代码来源:ChromeBrowserProvider.java

示例7: startBrowserProcessesAndLoadLibrariesSync

import org.chromium.content.browser.BrowserStartupController; //导入依赖的package包/类
/**
 * Loads native Libraries synchronously and starts Chrome browser processes.
 * Must be called on the main thread. Makes sure the process is initialized as a
 * Browser process instead of a ContentView process.
 *
 * @param initGoogleServicesManager when true the GoogleServicesManager is initialized.
 */
public void startBrowserProcessesAndLoadLibrariesSync(boolean initGoogleServicesManager)
        throws ProcessInitException {
    ThreadUtils.assertOnUiThread();
    initCommandLine();
    Context context = getApplicationContext();
    LibraryLoader libraryLoader = LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER);
    libraryLoader.ensureInitialized(context);
    libraryLoader.asyncPrefetchLibrariesToMemory();
    // The policies are used by browser startup, so we need to register the policy providers
    // before starting the browser process.
    registerPolicyProviders(CombinedPolicyProvider.get());
    BrowserStartupController.get(context, LibraryProcessType.PROCESS_BROWSER)
            .startBrowserProcessesSync(false);
    if (initGoogleServicesManager) {
        GoogleServicesManager.get(getApplicationContext());
    }
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:25,代码来源:ChromeApplication.java

示例8: notifyObserver

import org.chromium.content.browser.BrowserStartupController; //导入依赖的package包/类
private static void notifyObserver(final Context context, final Intent intent) {
    StartupCallback chainedObserverCallback = new StartupCallback() {
        @Override
        public void onSuccess(boolean alreadyStarted) {
            for (AccountsChangedObserver observer : sObservers) {
                observer.onAccountsChanged(context, intent);
            }
        }

        @Override
        public void onFailure() {
            // Startup failed, so ignore call.
        }
    };
    // If the browser process has already been loaded, a task will be posted immediately to
    // call the |chainedObserverCallback| passed in as a parameter.
    BrowserStartupController.get(context, LibraryProcessType.PROCESS_BROWSER)
            .addStartupCompletedObserver(chainedObserverCallback);
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:20,代码来源:AccountsChangedReceiver.java

示例9: recordHistogram

import org.chromium.content.browser.BrowserStartupController; //导入依赖的package包/类
public static void recordHistogram(final Context context, final int value) {
    ThreadUtils.postOnUiThread(new Runnable() {
        @Override
        public void run() {
            BrowserStartupController.get(context, LibraryProcessType.PROCESS_BROWSER)
                    .addStartupCompletedObserver(
                            new StartupCallback() {
                                @Override
                                public void onSuccess(boolean alreadyStarted) {
                                    RecordHistogram.recordEnumeratedHistogram(
                                            "Invalidations.GCMUpstreamRequest", value, UMA_MAX);
                                }

                                @Override
                                public void onFailure() {
                                    // Startup failed.
                                }
                            });
        }
    });
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:22,代码来源:GcmUpstreamUma.java

示例10: startBrowserProcessesSync

import org.chromium.content.browser.BrowserStartupController; //导入依赖的package包/类
@SuppressFBWarnings("DM_EXIT")
private void startBrowserProcessesSync(
        final BrowserStartupController.StartupCallback callback) {
    try {
        BrowserStartupController.get(mApplication, LibraryProcessType.PROCESS_BROWSER)
                .startBrowserProcessesSync(false);
    } catch (ProcessInitException e) {
        Log.e(TAG, "Unable to load native library.", e);
        System.exit(-1);
    }
    new Handler().post(new Runnable() {
        @Override
        public void run() {
            callback.onSuccess(false);
        }
    });
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:18,代码来源:ChromiumSyncAdapter.java

示例11: getStartupCallback

import org.chromium.content.browser.BrowserStartupController; //导入依赖的package包/类
private BrowserStartupController.StartupCallback getStartupCallback(final Context context,
        final String account, final PendingInvalidation invalidation,
        final SyncResult syncResult, final Semaphore semaphore) {
    return new BrowserStartupController.StartupCallback() {
        @Override
        public void onSuccess(boolean alreadyStarted) {
            // Startup succeeded, so we can notify the invalidation.
            notifyInvalidation(invalidation.mObjectSource, invalidation.mObjectId,
                    invalidation.mVersion, invalidation.mPayload);
            semaphore.release();
        }

        @Override
        public void onFailure() {
            // The startup failed, so we defer the invalidation.
            DelayedInvalidationsController.getInstance().addPendingInvalidation(
                    context, account, invalidation);
            // Using numIoExceptions so Android will treat this as a soft error.
            syncResult.stats.numIoExceptions++;
            semaphore.release();
        }
    };
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:24,代码来源:ChromiumSyncAdapter.java

示例12: startChromeBrowserProcessesSync

import org.chromium.content.browser.BrowserStartupController; //导入依赖的package包/类
private void startChromeBrowserProcessesSync() throws ProcessInitException {
    try {
        TraceEvent.begin("ChromeBrowserInitializer.startChromeBrowserProcessesSync");
        ThreadUtils.assertOnUiThread();
        mApplication.initCommandLine();
        LibraryLoader libraryLoader = LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER);
        StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
        libraryLoader.ensureInitialized();
        StrictMode.setThreadPolicy(oldPolicy);
        libraryLoader.asyncPrefetchLibrariesToMemory();
        BrowserStartupController.get(LibraryProcessType.PROCESS_BROWSER)
                .startBrowserProcessesSync(false);
        GoogleServicesManager.get(mApplication);
    } finally {
        TraceEvent.end("ChromeBrowserInitializer.startChromeBrowserProcessesSync");
    }
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:18,代码来源:ChromeBrowserInitializer.java

示例13: launchBrowserIfNecessary

import org.chromium.content.browser.BrowserStartupController; //导入依赖的package包/类
private static void launchBrowserIfNecessary(Context context) {
    if (BrowserStartupController.get(LibraryProcessType.PROCESS_BROWSER)
                    .isStartupSuccessfullyCompleted()) {
        return;
    }

    // TODO(fgorski): This method is taken from ChromeBackgroundService as a local fix and will
    // be removed with BackgroundTaskScheduler supporting GcmNetworkManager scheduling.
    try {
        ChromeBrowserInitializer.getInstance(context).handleSynchronousStartup();
    } catch (ProcessInitException e) {
        Log.e(TAG, "ProcessInitException while starting the browser process.");
        // Since the library failed to initialize nothing in the application can work, so kill
        // the whole application not just the activity.
        System.exit(-1);
    }
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:18,代码来源:OfflineBackgroundTask.java

示例14: launchBrowserIfNecessary

import org.chromium.content.browser.BrowserStartupController; //导入依赖的package包/类
@VisibleForTesting
@SuppressFBWarnings("DM_EXIT")
void launchBrowserIfNecessary(Context context) {
    if (BrowserStartupController.get(LibraryProcessType.PROCESS_BROWSER)
                    .isStartupSuccessfullyCompleted()) {
        return;
    }

    // TODO(https://crbug.com/717251): Remove when BackgroundTaskScheduler supports loading the
    // native library.
    try {
        ChromeBrowserInitializer.getInstance(context).handleSynchronousStartup();
    } catch (ProcessInitException e) {
        Log.e(TAG, "ProcessInitException while starting the browser process.");
        // Since the library failed to initialize nothing in the application can work, so kill
        // the whole application not just the activity.
        System.exit(-1);
    }
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:20,代码来源:PrefetchBackgroundTask.java

示例15: cancelOffTheRecordDownloads

import org.chromium.content.browser.BrowserStartupController; //导入依赖的package包/类
@VisibleForTesting
void cancelOffTheRecordDownloads() {
    boolean cancelActualDownload =
            BrowserStartupController.get(LibraryProcessType.PROCESS_BROWSER)
                    .isStartupSuccessfullyCompleted()
            && Profile.getLastUsedProfile().hasOffTheRecordProfile();

    List<DownloadSharedPreferenceEntry> entries = mDownloadSharedPreferenceHelper.getEntries();
    List<DownloadSharedPreferenceEntry> copies =
            new ArrayList<DownloadSharedPreferenceEntry>(entries);
    for (DownloadSharedPreferenceEntry entry : copies) {
        if (!entry.isOffTheRecord) continue;
        ContentId id = entry.id;
        notifyDownloadCanceled(id);
        if (cancelActualDownload) {
            DownloadServiceDelegate delegate = getServiceDelegate(id);
            delegate.cancelDownload(id, true);
            delegate.destroyServiceDelegate();
        }
        for (Observer observer : mObservers) observer.onDownloadCanceled(id);
    }
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:23,代码来源:DownloadNotificationService.java


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