| 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 "chrome/browser/prefs/chrome_command_line_pref_store.h" | 5 #include "chrome/browser/prefs/chrome_command_line_pref_store.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "ash/common/ash_switches.h" | 13 #include "ash/common/ash_switches.h" |
| 14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
| 17 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
| 18 #include "base/strings/string_split.h" | 18 #include "base/strings/string_split.h" |
| 19 #include "base/values.h" | 19 #include "base/values.h" |
| 20 #include "build/build_config.h" | 20 #include "build/build_config.h" |
| 21 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
| 22 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
| 23 #include "components/browser_sync/browser_sync_switches.h" |
| 23 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_
names.h" | 24 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_
names.h" |
| 24 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switc
hes.h" | 25 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switc
hes.h" |
| 25 #include "components/proxy_config/proxy_config_dictionary.h" | 26 #include "components/proxy_config/proxy_config_dictionary.h" |
| 26 #include "components/proxy_config/proxy_config_pref_names.h" | 27 #include "components/proxy_config/proxy_config_pref_names.h" |
| 27 #include "components/ssl_config/ssl_config_prefs.h" | 28 #include "components/ssl_config/ssl_config_prefs.h" |
| 28 #include "components/ssl_config/ssl_config_switches.h" | 29 #include "components/ssl_config/ssl_config_switches.h" |
| 30 #include "components/sync/base/pref_names.h" |
| 29 #include "content/public/common/content_switches.h" | 31 #include "content/public/common/content_switches.h" |
| 30 #include "ui/base/ui_base_switches.h" | 32 #include "ui/base/ui_base_switches.h" |
| 31 #include "ui/display/display_switches.h" | 33 #include "ui/display/display_switches.h" |
| 32 | 34 |
| 33 #if defined(OS_ANDROID) | 35 #if defined(OS_ANDROID) |
| 34 #include "chrome/browser/android/preferences/command_line_pref_store_android.h" | 36 #include "chrome/browser/android/preferences/command_line_pref_store_android.h" |
| 35 #endif | 37 #endif |
| 36 | 38 |
| 37 #if defined(OS_CHROMEOS) | 39 #if defined(OS_CHROMEOS) |
| 38 #include "chromeos/chromeos_switches.h" | 40 #include "chromeos/chromeos_switches.h" |
| 39 #endif | 41 #endif |
| 40 | 42 |
| 41 const CommandLinePrefStore::SwitchToPreferenceMapEntry | 43 const CommandLinePrefStore::SwitchToPreferenceMapEntry |
| 42 ChromeCommandLinePrefStore::string_switch_map_[] = { | 44 ChromeCommandLinePrefStore::string_switch_map_[] = { |
| 43 { switches::kLang, prefs::kApplicationLocale }, | 45 { switches::kLang, prefs::kApplicationLocale }, |
| 44 { data_reduction_proxy::switches::kDataReductionProxy, | 46 { data_reduction_proxy::switches::kDataReductionProxy, |
| 45 data_reduction_proxy::prefs::kDataReductionProxy }, | 47 data_reduction_proxy::prefs::kDataReductionProxy }, |
| 46 { switches::kAuthServerWhitelist, prefs::kAuthServerWhitelist }, | 48 { switches::kAuthServerWhitelist, prefs::kAuthServerWhitelist }, |
| 47 { switches::kSSLVersionMin, ssl_config::prefs::kSSLVersionMin }, | 49 { switches::kSSLVersionMin, ssl_config::prefs::kSSLVersionMin }, |
| 48 { switches::kSSLVersionMax, ssl_config::prefs::kSSLVersionMax }, | 50 { switches::kSSLVersionMax, ssl_config::prefs::kSSLVersionMax }, |
| 49 #if defined(OS_ANDROID) | 51 #if defined(OS_ANDROID) |
| 50 { switches::kAuthAndroidNegotiateAccountType, | 52 { switches::kAuthAndroidNegotiateAccountType, |
| 51 prefs::kAuthAndroidNegotiateAccountType }, | 53 prefs::kAuthAndroidNegotiateAccountType }, |
| 52 #endif | 54 #endif |
| 53 }; | 55 }; |
| 54 | 56 |
| 55 const CommandLinePrefStore::SwitchToPreferenceMapEntry | 57 const CommandLinePrefStore::SwitchToPreferenceMapEntry |
| 56 ChromeCommandLinePrefStore::path_switch_map_[] = { | 58 ChromeCommandLinePrefStore::path_switch_map_[] = { |
| 57 { switches::kDiskCacheDir, prefs::kDiskCacheDir }, | 59 { switches::kDiskCacheDir, prefs::kDiskCacheDir }, |
| 60 { switches::kLocalSyncBackendDir, syncer::prefs::kLocalSyncBackendDir }, |
| 58 }; | 61 }; |
| 59 | 62 |
| 60 const CommandLinePrefStore::BooleanSwitchToPreferenceMapEntry | 63 const CommandLinePrefStore::BooleanSwitchToPreferenceMapEntry |
| 61 ChromeCommandLinePrefStore::boolean_switch_map_[] = { | 64 ChromeCommandLinePrefStore::boolean_switch_map_[] = { |
| 62 {switches::kDisable3DAPIs, prefs::kDisable3DAPIs, true}, | 65 {switches::kDisable3DAPIs, prefs::kDisable3DAPIs, true}, |
| 63 {switches::kEnableCloudPrintProxy, prefs::kCloudPrintProxyEnabled, | 66 {switches::kEnableCloudPrintProxy, prefs::kCloudPrintProxyEnabled, |
| 64 true}, | 67 true}, |
| 65 {switches::kAllowOutdatedPlugins, prefs::kPluginsAllowOutdated, true}, | 68 {switches::kAllowOutdatedPlugins, prefs::kPluginsAllowOutdated, true}, |
| 66 {switches::kAlwaysAuthorizePlugins, prefs::kPluginsAlwaysAuthorize, | 69 {switches::kAlwaysAuthorizePlugins, prefs::kPluginsAlwaysAuthorize, |
| 67 true}, | 70 true}, |
| 68 {switches::kNoPings, prefs::kEnableHyperlinkAuditing, false}, | 71 {switches::kNoPings, prefs::kEnableHyperlinkAuditing, false}, |
| 69 {switches::kNoReferrers, prefs::kEnableReferrers, false}, | 72 {switches::kNoReferrers, prefs::kEnableReferrers, false}, |
| 70 {switches::kAllowRunningInsecureContent, | 73 {switches::kAllowRunningInsecureContent, |
| 71 prefs::kWebKitAllowRunningInsecureContent, true}, | 74 prefs::kWebKitAllowRunningInsecureContent, true}, |
| 72 {switches::kAllowCrossOriginAuthPrompt, | 75 {switches::kAllowCrossOriginAuthPrompt, |
| 73 prefs::kAllowCrossOriginAuthPrompt, true}, | 76 prefs::kAllowCrossOriginAuthPrompt, true}, |
| 74 {switches::kDisablePrintPreview, prefs::kPrintPreviewDisabled, true}, | 77 {switches::kDisablePrintPreview, prefs::kPrintPreviewDisabled, true}, |
| 75 #if defined(OS_CHROMEOS) | 78 #if defined(OS_CHROMEOS) |
| 76 {chromeos::switches::kEnableTouchpadThreeFingerClick, | 79 {chromeos::switches::kEnableTouchpadThreeFingerClick, |
| 77 prefs::kEnableTouchpadThreeFingerClick, true}, | 80 prefs::kEnableTouchpadThreeFingerClick, true}, |
| 78 {switches::kEnableUnifiedDesktop, | 81 {switches::kEnableUnifiedDesktop, |
| 79 prefs::kUnifiedDesktopEnabledByDefault, true}, | 82 prefs::kUnifiedDesktopEnabledByDefault, true}, |
| 80 #endif | 83 #endif |
| 81 {switches::kUnsafePacUrl, prefs::kPacHttpsUrlStrippingEnabled, false}, | 84 {switches::kUnsafePacUrl, prefs::kPacHttpsUrlStrippingEnabled, false}, |
| 85 {switches::kEnableLocalSyncBackend, |
| 86 syncer::prefs::kEnableLocalSyncBackend, false}, |
| 82 }; | 87 }; |
| 83 | 88 |
| 84 const CommandLinePrefStore::SwitchToPreferenceMapEntry | 89 const CommandLinePrefStore::SwitchToPreferenceMapEntry |
| 85 ChromeCommandLinePrefStore::integer_switch_map_[] = { | 90 ChromeCommandLinePrefStore::integer_switch_map_[] = { |
| 86 { switches::kDiskCacheSize, prefs::kDiskCacheSize }, | 91 { switches::kDiskCacheSize, prefs::kDiskCacheSize }, |
| 87 { switches::kMediaCacheSize, prefs::kMediaCacheSize }, | 92 { switches::kMediaCacheSize, prefs::kMediaCacheSize }, |
| 88 }; | 93 }; |
| 89 | 94 |
| 90 ChromeCommandLinePrefStore::ChromeCommandLinePrefStore( | 95 ChromeCommandLinePrefStore::ChromeCommandLinePrefStore( |
| 91 const base::CommandLine* command_line) | 96 const base::CommandLine* command_line) |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 } | 167 } |
| 163 } | 168 } |
| 164 | 169 |
| 165 void ChromeCommandLinePrefStore::ApplyBackgroundModeSwitches() { | 170 void ChromeCommandLinePrefStore::ApplyBackgroundModeSwitches() { |
| 166 if (command_line()->HasSwitch(switches::kDisableExtensions)) { | 171 if (command_line()->HasSwitch(switches::kDisableExtensions)) { |
| 167 SetValue(prefs::kBackgroundModeEnabled, | 172 SetValue(prefs::kBackgroundModeEnabled, |
| 168 base::MakeUnique<base::FundamentalValue>(false), | 173 base::MakeUnique<base::FundamentalValue>(false), |
| 169 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); | 174 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); |
| 170 } | 175 } |
| 171 } | 176 } |
| OLD | NEW |