org.chromium.chrome.browser.tabmodel.document.DocumentTabModelImpl Java Examples
The following examples show how to use
org.chromium.chrome.browser.tabmodel.document.DocumentTabModelImpl.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ChromeBrowserInitializer.java From delion with Apache License 2.0 | 6 votes |
/** * Pre-load shared prefs to avoid being blocked on the disk access async task in the future. * Running in an AsyncTask as pre-loading itself may cause I/O. */ private void warmUpSharedPrefs() { if (Build.VERSION.CODENAME.equals("N") || Build.VERSION.SDK_INT > Build.VERSION_CODES.M) { new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... params) { ContextUtils.getAppSharedPreferences(); DocumentTabModelImpl.warmUpSharedPrefs(mApplication); ActivityAssigner.warmUpSharedPrefs(mApplication); return null; } }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else { ContextUtils.getAppSharedPreferences(); DocumentTabModelImpl.warmUpSharedPrefs(mApplication); ActivityAssigner.warmUpSharedPrefs(mApplication); } }
Example #2
Source File: ChromeBrowserInitializer.java From AndroidChromium with Apache License 2.0 | 6 votes |
/** * Pre-load shared prefs to avoid being blocked on the disk access async task in the future. * Running in an AsyncTask as pre-loading itself may cause I/O. */ private void warmUpSharedPrefs() { if (Build.VERSION.CODENAME.equals("N") || Build.VERSION.SDK_INT > Build.VERSION_CODES.M) { new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... params) { ContextUtils.getAppSharedPreferences(); DocumentTabModelImpl.warmUpSharedPrefs(mApplication); ActivityAssigner.warmUpSharedPrefs(mApplication); return null; } }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else { ContextUtils.getAppSharedPreferences(); DocumentTabModelImpl.warmUpSharedPrefs(mApplication); ActivityAssigner.warmUpSharedPrefs(mApplication); } }
Example #3
Source File: ChromeBrowserInitializer.java From 365browser with Apache License 2.0 | 6 votes |
/** * Pre-load shared prefs to avoid being blocked on the disk access async task in the future. * Running in an AsyncTask as pre-loading itself may cause I/O. */ private void warmUpSharedPrefs() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... params) { ContextUtils.getAppSharedPreferences(); DocumentTabModelImpl.warmUpSharedPrefs(mApplication); ActivityAssigner.warmUpSharedPrefs(mApplication); DownloadManagerService.warmUpSharedPrefs(mApplication); return null; } }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else { ContextUtils.getAppSharedPreferences(); DocumentTabModelImpl.warmUpSharedPrefs(mApplication); ActivityAssigner.warmUpSharedPrefs(mApplication); DownloadManagerService.warmUpSharedPrefs(mApplication); } }
Example #4
Source File: DocumentModeAssassin.java From delion with Apache License 2.0 | 5 votes |
/** Deletes all remnants of the document mode directory and preferences. */ final void deleteDocumentModeData() { ThreadUtils.assertOnUiThread(); if (!setStage(STAGE_CHANGE_SETTINGS_DONE, STAGE_DELETION_STARTED)) return; new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... params) { Log.d(TAG, "Starting to delete document mode data."); // Delete the old tab state directory. FileUtils.recursivelyDeleteFile(getDocumentDataDirectory()); // Clean up the {@link DocumentTabModel} shared preferences. SharedPreferences prefs = getContext().getSharedPreferences( DocumentTabModelImpl.PREF_PACKAGE, Context.MODE_PRIVATE); SharedPreferences.Editor editor = prefs.edit(); editor.clear(); editor.apply(); return null; } @Override protected void onPostExecute(Void result) { Log.d(TAG, "Finished deleting document mode data."); setStage(STAGE_DELETION_STARTED, STAGE_DONE); } }.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR); }
Example #5
Source File: DocumentUtils.java From delion with Apache License 2.0 | 5 votes |
/** * Returns the ID of the last shown Tab for the given DocumentTabModel type. * @param context Context to pull SharedPrefs from. * @param isIncognito Whether to get the ID for the regular or Incognito TabModel. * @return ID of the last shown Tab for the given TabModel type. */ public static int getLastShownTabIdFromPrefs(Context context, boolean isIncognito) { SharedPreferences prefs = context.getSharedPreferences( DocumentTabModelImpl.PREF_PACKAGE, Context.MODE_PRIVATE); String prefName = isIncognito ? DocumentTabModelImpl.PREF_LAST_SHOWN_TAB_ID_INCOGNITO : DocumentTabModelImpl.PREF_LAST_SHOWN_TAB_ID_REGULAR; return prefs.getInt(prefName, Tab.INVALID_TAB_ID); }
Example #6
Source File: DocumentModeAssassin.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** Deletes all remnants of the document mode directory and preferences. */ final void deleteDocumentModeData() { ThreadUtils.assertOnUiThread(); if (!setStage(STAGE_CHANGE_SETTINGS_DONE, STAGE_DELETION_STARTED)) return; new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... params) { Log.d(TAG, "Starting to delete document mode data."); // Delete the old tab state directory. FileUtils.recursivelyDeleteFile(getDocumentDataDirectory()); // Clean up the {@link DocumentTabModel} shared preferences. SharedPreferences prefs = getContext().getSharedPreferences( DocumentTabModelImpl.PREF_PACKAGE, Context.MODE_PRIVATE); SharedPreferences.Editor editor = prefs.edit(); editor.clear(); editor.apply(); return null; } @Override protected void onPostExecute(Void result) { Log.d(TAG, "Finished deleting document mode data."); setStage(STAGE_DELETION_STARTED, STAGE_DONE); } }.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR); }
Example #7
Source File: DocumentUtils.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * Returns the ID of the last shown Tab for the given DocumentTabModel type. * @param context Context to pull SharedPrefs from. * @param isIncognito Whether to get the ID for the regular or Incognito TabModel. * @return ID of the last shown Tab for the given TabModel type. */ public static int getLastShownTabIdFromPrefs(Context context, boolean isIncognito) { SharedPreferences prefs = context.getSharedPreferences( DocumentTabModelImpl.PREF_PACKAGE, Context.MODE_PRIVATE); String prefName = isIncognito ? DocumentTabModelImpl.PREF_LAST_SHOWN_TAB_ID_INCOGNITO : DocumentTabModelImpl.PREF_LAST_SHOWN_TAB_ID_REGULAR; return prefs.getInt(prefName, Tab.INVALID_TAB_ID); }
Example #8
Source File: DocumentModeAssassin.java From 365browser with Apache License 2.0 | 5 votes |
/** Deletes all remnants of the document mode directory and preferences. */ final void deleteDocumentModeData() { ThreadUtils.assertOnUiThread(); if (!setStage(STAGE_CHANGE_SETTINGS_DONE, STAGE_DELETION_STARTED)) return; new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... params) { Log.d(TAG, "Starting to delete document mode data."); // Delete the old tab state directory. FileUtils.recursivelyDeleteFile(getDocumentDataDirectory()); // Clean up the {@link DocumentTabModel} shared preferences. SharedPreferences prefs = getContext().getSharedPreferences( DocumentTabModelImpl.PREF_PACKAGE, Context.MODE_PRIVATE); SharedPreferences.Editor editor = prefs.edit(); editor.clear(); editor.apply(); return null; } @Override protected void onPostExecute(Void result) { Log.d(TAG, "Finished deleting document mode data."); setStage(STAGE_DELETION_STARTED, STAGE_DONE); } }.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR); }
Example #9
Source File: DocumentUtils.java From 365browser with Apache License 2.0 | 5 votes |
/** * Returns the ID of the last shown Tab for the given DocumentTabModel type. * @param context Context to pull SharedPrefs from. * @param isIncognito Whether to get the ID for the regular or Incognito TabModel. * @return ID of the last shown Tab for the given TabModel type. */ public static int getLastShownTabIdFromPrefs(Context context, boolean isIncognito) { SharedPreferences prefs = context.getSharedPreferences( DocumentTabModelImpl.PREF_PACKAGE, Context.MODE_PRIVATE); String prefName = isIncognito ? DocumentTabModelImpl.PREF_LAST_SHOWN_TAB_ID_INCOGNITO : DocumentTabModelImpl.PREF_LAST_SHOWN_TAB_ID_REGULAR; return prefs.getInt(prefName, Tab.INVALID_TAB_ID); }