chrome_startup_flags.cc revision c2e0dbddbe15c98d52c4786dac06cb8952a8ae6d
1// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include <jni.h>
6
7#include "chrome/browser/android/chrome_startup_flags.h"
8
9#include "base/android/jni_android.h"
10#include "base/android/jni_string.h"
11#include "base/android/scoped_java_ref.h"
12#include "base/command_line.h"
13#include "base/logging.h"
14#include "chrome/common/chrome_switches.h"
15#include "content/public/common/content_switches.h"
16#include "media/base/media_switches.h"
17
18namespace {
19
20void SetCommandLineSwitch(const std::string& switch_string) {
21  CommandLine* command_line = CommandLine::ForCurrentProcess();
22  if (!command_line->HasSwitch(switch_string))
23    command_line->AppendSwitch(switch_string);
24}
25
26void SetCommandLineSwitchASCII(const std::string& switch_string,
27                               const std::string& value) {
28  CommandLine* command_line = CommandLine::ForCurrentProcess();
29  if (!command_line->HasSwitch(switch_string))
30    command_line->AppendSwitchASCII(switch_string, value);
31}
32
33}  // namespace
34
35void SetChromeSpecificCommandLineFlags() {
36  // Turn on autologin.
37  SetCommandLineSwitch(switches::kEnableAutologin);
38
39  // Enable prerender for the omnibox.
40  SetCommandLineSwitchASCII(
41      switches::kPrerenderMode, switches::kPrerenderModeSwitchValueEnabled);
42  SetCommandLineSwitchASCII(
43      switches::kPrerenderFromOmnibox,
44      switches::kPrerenderFromOmniboxSwitchValueEnabled);
45#if defined(GOOGLE_TV)
46  SetCommandLineSwitch(switches::kPpapiInProcess);
47#else
48  SetCommandLineSwitch(switches::kDisableEncryptedMedia);
49#endif
50}
51