org.chromium.content.common.ContentSwitches Java Examples
The following examples show how to use
org.chromium.content.common.ContentSwitches.
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: ApplicationInitialization.java From delion with Apache License 2.0 | 6 votes |
/** * Enable fullscreen related startup flags. * @param resources Resources to use while calculating initialization constants. * @param resControlContainerHeight The resource id for the height of the top controls. */ public static void enableFullscreenFlags( Resources resources, Context context, int resControlContainerHeight) { ContentApplication.initCommandLine(context); CommandLine commandLine = CommandLine.getInstance(); if (commandLine.hasSwitch(ChromeSwitches.DISABLE_FULLSCREEN)) return; TypedValue threshold = new TypedValue(); resources.getValue(R.dimen.top_controls_show_threshold, threshold, true); commandLine.appendSwitchWithValue( ContentSwitches.TOP_CONTROLS_SHOW_THRESHOLD, threshold.coerceToString().toString()); resources.getValue(R.dimen.top_controls_hide_threshold, threshold, true); commandLine.appendSwitchWithValue( ContentSwitches.TOP_CONTROLS_HIDE_THRESHOLD, threshold.coerceToString().toString()); }
Example #2
Source File: ApplicationInitialization.java From AndroidChromium with Apache License 2.0 | 6 votes |
/** * Enable fullscreen related startup flags. * @param resources Resources to use while calculating initialization constants. * @param resControlContainerHeight The resource id for the height of the browser controls. */ public static void enableFullscreenFlags( Resources resources, Context context, int resControlContainerHeight) { ContentApplication.initCommandLine(context); CommandLine commandLine = CommandLine.getInstance(); if (commandLine.hasSwitch(ChromeSwitches.DISABLE_FULLSCREEN)) return; TypedValue threshold = new TypedValue(); resources.getValue(R.dimen.top_controls_show_threshold, threshold, true); commandLine.appendSwitchWithValue( ContentSwitches.TOP_CONTROLS_SHOW_THRESHOLD, threshold.coerceToString().toString()); resources.getValue(R.dimen.top_controls_hide_threshold, threshold, true); Log.w("renshuai: ", "hello" + threshold.coerceToString().toString()); commandLine.appendSwitchWithValue( ContentSwitches.TOP_CONTROLS_HIDE_THRESHOLD, threshold.coerceToString().toString()); }
Example #3
Source File: ChromeTabbedActivity.java From 365browser with Apache License 2.0 | 6 votes |
@Override public void onNewIntentWithNative(Intent intent) { try { TraceEvent.begin("ChromeTabbedActivity.onNewIntentWithNative"); super.onNewIntentWithNative(intent); if (isMainIntentFromLauncher(intent)) { if (IntentHandler.getUrlFromIntent(intent) == null) { maybeLaunchNtpFromMainIntent(intent); } logMainIntentBehavior(intent); } if (CommandLine.getInstance().hasSwitch(ContentSwitches.ENABLE_TEST_INTENTS)) { handleDebugIntent(intent); } } finally { TraceEvent.end("ChromeTabbedActivity.onNewIntentWithNative"); } }
Example #4
Source File: ApplicationInitialization.java From 365browser with Apache License 2.0 | 6 votes |
/** * Enable fullscreen related startup flags. * @param resources Resources to use while calculating initialization constants. * @param resControlContainerHeight The resource id for the height of the browser controls. */ public static void enableFullscreenFlags( Resources resources, Context context, int resControlContainerHeight) { ContentApplication.initCommandLine(context); CommandLine commandLine = CommandLine.getInstance(); if (commandLine.hasSwitch(ChromeSwitches.DISABLE_FULLSCREEN)) return; TypedValue threshold = new TypedValue(); resources.getValue(R.dimen.top_controls_show_threshold, threshold, true); commandLine.appendSwitchWithValue( ContentSwitches.TOP_CONTROLS_SHOW_THRESHOLD, threshold.coerceToString().toString()); resources.getValue(R.dimen.top_controls_hide_threshold, threshold, true); commandLine.appendSwitchWithValue( ContentSwitches.TOP_CONTROLS_HIDE_THRESHOLD, threshold.coerceToString().toString()); }
Example #5
Source File: ChromeTabbedActivity.java From delion with Apache License 2.0 | 5 votes |
@Override public void onNewIntentWithNative(Intent intent) { try { TraceEvent.begin("ChromeTabbedActivity.onNewIntentWithNative"); super.onNewIntentWithNative(intent); if (CommandLine.getInstance().hasSwitch(ContentSwitches.ENABLE_TEST_INTENTS)) { handleDebugIntent(intent); } } finally { TraceEvent.end("ChromeTabbedActivity.onNewIntentWithNative"); } }
Example #6
Source File: ChromeTabbedActivity.java From delion with Apache License 2.0 | 5 votes |
@Override public void preInflationStartup() { super.preInflationStartup(); // Decide whether to record startup UMA histograms. This is done early in the main // Activity.onCreate() to avoid recording navigation delays when they require user input to // proceed. For example, FRE (First Run Experience) happens before the activity is created, // and triggers initialization of the native library. At the moment it seems safe to assume // that uninitialized native library is an indication of an application start that is // followed by navigation immediately without user input. if (!LibraryLoader.isInitialized()) { UmaUtils.setRunningApplicationStart(true); } CommandLine commandLine = CommandLine.getInstance(); if (commandLine.hasSwitch(ContentSwitches.ENABLE_TEST_INTENTS) && getIntent() != null && getIntent().hasExtra( ChromeTabbedActivity.INTENT_EXTRA_TEST_RENDER_PROCESS_LIMIT)) { int value = getIntent().getIntExtra( ChromeTabbedActivity.INTENT_EXTRA_TEST_RENDER_PROCESS_LIMIT, -1); if (value != -1) { String[] args = new String[1]; args[0] = "--" + ContentSwitches.RENDER_PROCESS_LIMIT + "=" + Integer.toString(value); commandLine.appendSwitchesAndArguments(args); } } supportRequestWindowFeature(Window.FEATURE_ACTION_MODE_OVERLAY); // We are starting from history with a URL after data has been cleared. On Samsung this // can happen after user clears data and clicks on a recents item on pre-L devices. if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP && getIntent().getData() != null && (getIntent().getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0 && OmahaClient.isFreshInstallOrDataHasBeenCleared(getApplicationContext())) { getIntent().setData(null); } }
Example #7
Source File: ChromeActivity.java From delion with Apache License 2.0 | 5 votes |
@Override public void initializeState() { super.initializeState(); IntentHandler.setTestIntentsEnabled( CommandLine.getInstance().hasSwitch(ContentSwitches.ENABLE_TEST_INTENTS)); mIntentHandler = new IntentHandler(createIntentHandlerDelegate(), getPackageName()); }
Example #8
Source File: ChromeTabbedActivity.java From AndroidChromium with Apache License 2.0 | 5 votes |
@Override public void onNewIntentWithNative(Intent intent) { try { TraceEvent.begin("ChromeTabbedActivity.onNewIntentWithNative"); super.onNewIntentWithNative(intent); if (CommandLine.getInstance().hasSwitch(ContentSwitches.ENABLE_TEST_INTENTS)) { handleDebugIntent(intent); } if (mVrShellDelegate.isVrIntent(intent)) mVrShellDelegate.enterVRFromIntent(intent); } finally { TraceEvent.end("ChromeTabbedActivity.onNewIntentWithNative"); } }
Example #9
Source File: ChromeTabbedActivity.java From AndroidChromium with Apache License 2.0 | 5 votes |
@Override public void preInflationStartup() { super.preInflationStartup(); // Decide whether to record startup UMA histograms. This is done early in the main // Activity.onCreate() to avoid recording navigation delays when they require user input to // proceed. For example, FRE (First Run Experience) happens before the activity is created, // and triggers initialization of the native library. At the moment it seems safe to assume // that uninitialized native library is an indication of an application start that is // followed by navigation immediately without user input. if (!LibraryLoader.isInitialized()) { UmaUtils.setRunningApplicationStart(true); } CommandLine commandLine = CommandLine.getInstance(); if (commandLine.hasSwitch(ContentSwitches.ENABLE_TEST_INTENTS) && getIntent() != null && getIntent().hasExtra( ChromeTabbedActivity.INTENT_EXTRA_TEST_RENDER_PROCESS_LIMIT)) { int value = getIntent().getIntExtra( ChromeTabbedActivity.INTENT_EXTRA_TEST_RENDER_PROCESS_LIMIT, -1); if (value != -1) { String[] args = new String[1]; args[0] = "--" + ContentSwitches.RENDER_PROCESS_LIMIT + "=" + Integer.toString(value); commandLine.appendSwitchesAndArguments(args); } } supportRequestWindowFeature(Window.FEATURE_ACTION_MODE_OVERLAY); // We are starting from history with a URL after data has been cleared. On Samsung this // can happen after user clears data and clicks on a recents item on pre-L devices. if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP && getIntent().getData() != null && (getIntent().getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0 && OmahaClient.isFreshInstallOrDataHasBeenCleared(getApplicationContext())) { getIntent().setData(null); } }
Example #10
Source File: ChromeActivity.java From AndroidChromium with Apache License 2.0 | 5 votes |
@Override public void initializeState() { super.initializeState(); mBlimpClientContextDelegate = ChromeBlimpClientContextDelegate.createAndSetDelegateForContext( Profile.getLastUsedProfile().getOriginalProfile()); IntentHandler.setTestIntentsEnabled( CommandLine.getInstance().hasSwitch(ContentSwitches.ENABLE_TEST_INTENTS)); mIntentHandler = new IntentHandler(createIntentHandlerDelegate(), getPackageName()); }
Example #11
Source File: ChromeActivity.java From 365browser with Apache License 2.0 | 5 votes |
@Override public void initializeState() { super.initializeState(); IntentHandler.setTestIntentsEnabled( CommandLine.getInstance().hasSwitch(ContentSwitches.ENABLE_TEST_INTENTS)); mIntentHandler = new IntentHandler(createIntentHandlerDelegate(), getPackageName()); }
Example #12
Source File: ChildProcessLauncherHelper.java From 365browser with Apache License 2.0 | 5 votes |
@VisibleForTesting public static ChildProcessLauncherHelper createAndStartForTesting(long nativePointer, String[] commandLine, FileDescriptorInfo[] filesToBeMapped, ChildProcessCreationParams creationParams, boolean sandboxed, boolean alwaysInForeground) { String processType = ContentSwitches.getSwitchValue(commandLine, ContentSwitches.SWITCH_PROCESS_TYPE); ChildProcessLauncherHelper launcherHelper = new ChildProcessLauncherHelper(nativePointer, processType); launcherHelper.start(ContextUtils.getApplicationContext(), commandLine, filesToBeMapped, creationParams, sandboxed, alwaysInForeground); return launcherHelper; }
Example #13
Source File: ChromeTabbedActivity.java From 365browser with Apache License 2.0 | 4 votes |
@Override public void preInflationStartup() { super.preInflationStartup(); // Decide whether to record startup UMA histograms. This is done early in the main // Activity.onCreate() to avoid recording navigation delays when they require user input to // proceed. For example, FRE (First Run Experience) happens before the activity is created, // and triggers initialization of the native library. At the moment it seems safe to assume // that uninitialized native library is an indication of an application start that is // followed by navigation immediately without user input. if (!LibraryLoader.isInitialized()) { UmaUtils.setRunningApplicationStart(true); } CommandLine commandLine = CommandLine.getInstance(); if (commandLine.hasSwitch(ContentSwitches.ENABLE_TEST_INTENTS) && getIntent() != null && getIntent().hasExtra( ChromeTabbedActivity.INTENT_EXTRA_TEST_RENDER_PROCESS_LIMIT)) { int value = getIntent().getIntExtra( ChromeTabbedActivity.INTENT_EXTRA_TEST_RENDER_PROCESS_LIMIT, -1); if (value != -1) { String[] args = new String[1]; args[0] = "--" + ContentSwitches.RENDER_PROCESS_LIMIT + "=" + Integer.toString(value); commandLine.appendSwitchesAndArguments(args); } } supportRequestWindowFeature(Window.FEATURE_ACTION_MODE_OVERLAY); // We are starting from history with a URL after data has been cleared. On Samsung this // can happen after user clears data and clicks on a recents item on pre-L devices. if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP && getIntent().getData() != null && (getIntent().getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0 && OmahaBase.isProbablyFreshInstall(this)) { getIntent().setData(null); } launchFirstRunExperience(); }
Example #14
Source File: DeviceUtils.java From 365browser with Apache License 2.0 | 4 votes |
/** * Appends the switch specifying which user agent should be used for this device. * @param context The context for the caller activity. */ public static void addDeviceSpecificUserAgentSwitch(Context context) { if (!DeviceFormFactor.isTablet()) { CommandLine.getInstance().appendSwitch(ContentSwitches.USE_MOBILE_UA); } }