chrome_startup_flags.cc revision a1401311d1ab56c4ed0a474bd38c108f75cb0cd9
1f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// Copyright (c) 2012 The Chromium Authors. All rights reserved. 2f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// Use of this source code is governed by a BSD-style license that can be 3f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// found in the LICENSE file. 4f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 5f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include <jni.h> 6f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 7f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "chrome/browser/android/chrome_startup_flags.h" 8f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 9f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "base/android/jni_android.h" 10f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "base/android/jni_string.h" 11f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "base/android/scoped_java_ref.h" 12f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "base/android/sys_utils.h" 13f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "base/command_line.h" 14f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "base/logging.h" 15f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "chrome/common/chrome_switches.h" 16f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "chrome/common/chrome_version_info.h" 17f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "content/public/common/content_switches.h" 18f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "media/base/media_switches.h" 19f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 20f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgnamespace { 21f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 22f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid SetCommandLineSwitch(const std::string& switch_string) { 23f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org CommandLine* command_line = CommandLine::ForCurrentProcess(); 24f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org if (!command_line->HasSwitch(switch_string)) 25f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org command_line->AppendSwitch(switch_string); 26f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 27f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 28f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid SetCommandLineSwitchASCII(const std::string& switch_string, 29f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org const std::string& value) { 30f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org CommandLine* command_line = CommandLine::ForCurrentProcess(); 31f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org if (!command_line->HasSwitch(switch_string)) 32f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org command_line->AppendSwitchASCII(switch_string, value); 33f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 34f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 35f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} // namespace 36f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 37f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid SetChromeSpecificCommandLineFlags() { 38f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org // Turn on autologin. 39f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org SetCommandLineSwitch(switches::kEnableAutologin); 40f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 41f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org // Enable prerender for the omnibox. 42f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org SetCommandLineSwitchASCII(switches::kPrerenderMode, 43f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org switches::kPrerenderModeSwitchValueEnabled); 44f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org SetCommandLineSwitchASCII(switches::kPrerenderFromOmnibox, 45f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org switches::kPrerenderFromOmniboxSwitchValueEnabled); 46f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 47f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org // Disable syncing favicons on low end devices. 48f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org if (base::android::SysUtils::IsLowEndDevice()) 49f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org SetCommandLineSwitch(switches::kDisableSyncFavicons); 50f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 51f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org // Enable DOM Distiller on local builds, canary and dev-channel. 52f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); 53f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org if (channel == chrome::VersionInfo::CHANNEL_UNKNOWN || 54f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org channel == chrome::VersionInfo::CHANNEL_CANARY || 55f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org channel == chrome::VersionInfo::CHANNEL_DEV) { 56f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org SetCommandLineSwitch(switches::kEnableDomDistiller); 57f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org } 58f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 59f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org