| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <jni.h> | 5 #include <jni.h> |
| 6 | 6 |
| 7 #include "chrome/browser/android/chrome_startup_flags.h" | 7 #include "chrome/browser/android/chrome_startup_flags.h" |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| 11 #include "base/android/scoped_java_ref.h" | 11 #include "base/android/scoped_java_ref.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 void SetCommandLineSwitch(const std::string& switch_string) { | 18 void SetCommandLineSwitch(const std::string& switch_string) { |
| 19 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 19 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 20 if (!command_line->HasSwitch(switch_string)) | 20 if (!command_line->HasSwitch(switch_string)) |
| 21 command_line->AppendSwitch(switch_string); | 21 command_line->AppendSwitch(switch_string); |
| 22 } | 22 } |
| 23 | 23 |
| 24 void SetCommandLineSwitchASCII(const std::string& switch_string, |
| 25 const std::string& value) { |
| 26 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 27 if (!command_line->HasSwitch(switch_string)) |
| 28 command_line->AppendSwitchASCII(switch_string, value); |
| 29 } |
| 30 |
| 24 bool IsTabletUi() { | 31 bool IsTabletUi() { |
| 25 NOTIMPLEMENTED() << "TODO(yfriedman): Upstream this"; | 32 NOTIMPLEMENTED() << "TODO(yfriedman): Upstream this"; |
| 26 return false; | 33 return false; |
| 27 } | 34 } |
| 28 } // namespace | 35 |
| 36 } // namespace |
| 29 | 37 |
| 30 void SetChromeSpecificCommandLineFlags() { | 38 void SetChromeSpecificCommandLineFlags() { |
| 31 CommandLine* parsed_command_line = CommandLine::ForCurrentProcess(); | 39 // Always enable SPDY. |
| 40 SetCommandLineSwitch(switches::kEnableNpn); |
| 32 | 41 |
| 33 // Always enable SPDY | 42 // Turn on autofill. |
| 34 parsed_command_line->AppendSwitch(switches::kEnableNpn); | 43 SetCommandLineSwitch(switches::kExternalAutofillPopup); |
| 35 | 44 |
| 36 // Turn on autofill | 45 // Turn on autologin. |
| 37 SetCommandLineSwitch(switches::kExternalAutofillPopup); | 46 SetCommandLineSwitch(switches::kEnableAutologin); |
| 38 | 47 |
| 39 // Tablet UI switch (used for using correct version of NTP HTML). | 48 // Tablet UI switch (used for using correct version of NTP HTML). |
| 40 if (IsTabletUi()) | 49 if (IsTabletUi()) |
| 41 parsed_command_line->AppendSwitch(switches::kTabletUi); | 50 SetCommandLineSwitch(switches::kTabletUi); |
| 42 | 51 |
| 43 // Enable prerender for the omnibox. | 52 // Enable prerender for the omnibox. |
| 44 parsed_command_line->AppendSwitchASCII( | 53 SetCommandLineSwitchASCII( |
| 45 switches::kPrerenderMode, switches::kPrerenderModeSwitchValueEnabled); | 54 switches::kPrerenderMode, switches::kPrerenderModeSwitchValueEnabled); |
| 46 parsed_command_line->AppendSwitchASCII( | 55 SetCommandLineSwitchASCII( |
| 47 switches::kPrerenderFromOmnibox, | 56 switches::kPrerenderFromOmnibox, |
| 48 switches::kPrerenderFromOmniboxSwitchValueEnabled); | 57 switches::kPrerenderFromOmniboxSwitchValueEnabled); |
| 49 } | 58 } |
| OLD | NEW |