Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(572)

Side by Side Diff: chrome/browser/prefs/command_line_pref_store.cc

Issue 7520023: Converted IncognitoForced boolean policy into IncognitoModeAvailability enum policy. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/command_line_pref_store.h" 5 #include "chrome/browser/prefs/command_line_pref_store.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/string_split.h" 8 #include "base/string_split.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/prefs/incognito_mode_availability_prefs.h"
10 #include "chrome/browser/prefs/proxy_config_dictionary.h" 11 #include "chrome/browser/prefs/proxy_config_dictionary.h"
11 #include "chrome/common/chrome_switches.h" 12 #include "chrome/common/chrome_switches.h"
12 #include "chrome/common/pref_names.h" 13 #include "chrome/common/pref_names.h"
13 #include "ui/base/ui_base_switches.h" 14 #include "ui/base/ui_base_switches.h"
14 15
15 const CommandLinePrefStore::StringSwitchToPreferenceMapEntry 16 const CommandLinePrefStore::StringSwitchToPreferenceMapEntry
16 CommandLinePrefStore::string_switch_map_[] = { 17 CommandLinePrefStore::string_switch_map_[] = {
17 { switches::kLang, prefs::kApplicationLocale }, 18 { switches::kLang, prefs::kApplicationLocale },
18 { switches::kAuthSchemes, prefs::kAuthSchemes }, 19 { switches::kAuthSchemes, prefs::kAuthSchemes },
19 { switches::kAuthServerWhitelist, prefs::kAuthServerWhitelist }, 20 { switches::kAuthServerWhitelist, prefs::kAuthServerWhitelist },
(...skipping 15 matching lines...) Expand all
35 { switches::kAlwaysAuthorizePlugins, prefs::kPluginsAlwaysAuthorize, 36 { switches::kAlwaysAuthorizePlugins, prefs::kPluginsAlwaysAuthorize,
36 true }, 37 true },
37 { switches::kNoPings, prefs::kEnableHyperlinkAuditing, false }, 38 { switches::kNoPings, prefs::kEnableHyperlinkAuditing, false },
38 { switches::kNoReferrers, prefs::kEnableReferrers, false }, 39 { switches::kNoReferrers, prefs::kEnableReferrers, false },
39 { switches::kAllowRunningInsecureContent, 40 { switches::kAllowRunningInsecureContent,
40 prefs::kWebKitAllowRunningInsecureContent, true }, 41 prefs::kWebKitAllowRunningInsecureContent, true },
41 { switches::kNoDisplayingInsecureContent, 42 { switches::kNoDisplayingInsecureContent,
42 prefs::kWebKitAllowDisplayingInsecureContent, false }, 43 prefs::kWebKitAllowDisplayingInsecureContent, false },
43 { switches::kAllowCrossOriginAuthPrompt, 44 { switches::kAllowCrossOriginAuthPrompt,
44 prefs::kAllowCrossOriginAuthPrompt, true }, 45 prefs::kAllowCrossOriginAuthPrompt, true },
45 { switches::kIncognito, prefs::kIncognitoForced, true },
46 }; 46 };
47 47
48 CommandLinePrefStore::CommandLinePrefStore(const CommandLine* command_line) 48 CommandLinePrefStore::CommandLinePrefStore(const CommandLine* command_line)
49 : command_line_(command_line) { 49 : command_line_(command_line) {
50 ApplySimpleSwitches(); 50 ApplySimpleSwitches();
51 ApplyProxyMode(); 51 ApplyProxyMode();
52 ValidateProxySwitches(); 52 ValidateProxySwitches();
53 ApplySSLSwitches(); 53 ApplySSLSwitches();
54 ApplyIncognitoSwitches();
54 } 55 }
55 56
56 CommandLinePrefStore::~CommandLinePrefStore() {} 57 CommandLinePrefStore::~CommandLinePrefStore() {}
57 58
58 void CommandLinePrefStore::ApplySimpleSwitches() { 59 void CommandLinePrefStore::ApplySimpleSwitches() {
59 // Look for each switch we know about and set its preference accordingly. 60 // Look for each switch we know about and set its preference accordingly.
60 for (size_t i = 0; i < arraysize(string_switch_map_); ++i) { 61 for (size_t i = 0; i < arraysize(string_switch_map_); ++i) {
61 if (command_line_->HasSwitch(string_switch_map_[i].switch_name)) { 62 if (command_line_->HasSwitch(string_switch_map_[i].switch_name)) {
62 Value* value = Value::CreateStringValue(command_line_-> 63 Value* value = Value::CreateStringValue(command_line_->
63 GetSwitchValueASCII(string_switch_map_[i].switch_name)); 64 GetSwitchValueASCII(string_switch_map_[i].switch_name));
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 std::vector<std::string> cipher_strings; 118 std::vector<std::string> cipher_strings;
118 base::SplitString(cipher_suites, ',', &cipher_strings); 119 base::SplitString(cipher_suites, ',', &cipher_strings);
119 base::ListValue* list_value = new base::ListValue(); 120 base::ListValue* list_value = new base::ListValue();
120 for (std::vector<std::string>::const_iterator it = cipher_strings.begin(); 121 for (std::vector<std::string>::const_iterator it = cipher_strings.begin();
121 it != cipher_strings.end(); ++it) { 122 it != cipher_strings.end(); ++it) {
122 list_value->Append(base::Value::CreateStringValue(*it)); 123 list_value->Append(base::Value::CreateStringValue(*it));
123 } 124 }
124 SetValue(prefs::kCipherSuiteBlacklist, list_value); 125 SetValue(prefs::kCipherSuiteBlacklist, list_value);
125 } 126 }
126 } 127 }
128
129 void CommandLinePrefStore::ApplyIncognitoSwitches() {
130 if (command_line_->HasSwitch(switches::kIncognito)) {
131 SetValue(prefs::kIncognitoModeAvailability,
132 Value::CreateIntegerValue(IncognitoModeAvailabilityPrefs::FORCED));
Bernhard Bauer 2011/07/28 11:34:03 The --incognito flag opens the first window in inc
rustema 2011/07/29 06:49:23 This is now gone.
133 }
134 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698