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

Side by Side Diff: chrome/browser/policy/configuration_policy_pref_store.h

Issue 6004003: Introduce a separate preference for 'proxy server mode' (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Extraction undone - as per Mattias' request Created 10 years 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PREF_STORE_H_ 5 #ifndef CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PREF_STORE_H_
6 #define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PREF_STORE_H_ 6 #define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PREF_STORE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 22 matching lines...) Expand all
33 explicit ConfigurationPolicyPrefStore(ConfigurationPolicyProvider* provider); 33 explicit ConfigurationPolicyPrefStore(ConfigurationPolicyProvider* provider);
34 virtual ~ConfigurationPolicyPrefStore(); 34 virtual ~ConfigurationPolicyPrefStore();
35 35
36 // PrefStore methods: 36 // PrefStore methods:
37 virtual ReadResult GetValue(const std::string& key, Value** result) const; 37 virtual ReadResult GetValue(const std::string& key, Value** result) const;
38 38
39 virtual DictionaryValue* prefs() const; 39 virtual DictionaryValue* prefs() const;
40 40
41 // ConfigurationPolicyStore methods: 41 // ConfigurationPolicyStore methods:
42 virtual void Apply(ConfigurationPolicyType setting, Value* value); 42 virtual void Apply(ConfigurationPolicyType setting, Value* value);
43 virtual void Completed();
danno 2010/12/21 16:16:38 Where are the tests to make sure that completed ac
battre (please use the other) 2010/12/21 20:14:09 I have deleted this.
43 44
44 // Creates a ConfigurationPolicyPrefStore that reads managed platform policy. 45 // Creates a ConfigurationPolicyPrefStore that reads managed platform policy.
45 static ConfigurationPolicyPrefStore* CreateManagedPlatformPolicyPrefStore(); 46 static ConfigurationPolicyPrefStore* CreateManagedPlatformPolicyPrefStore();
46 47
47 // Creates a ConfigurationPolicyPrefStore that supplies policy from 48 // Creates a ConfigurationPolicyPrefStore that supplies policy from
48 // the device management server. 49 // the device management server.
49 static ConfigurationPolicyPrefStore* CreateDeviceManagementPolicyPrefStore( 50 static ConfigurationPolicyPrefStore* CreateDeviceManagementPolicyPrefStore(
50 Profile* profile); 51 Profile* profile);
51 52
52 // Creates a ConfigurationPolicyPrefStore that reads recommended policy. 53 // Creates a ConfigurationPolicyPrefStore that reads recommended policy.
53 static ConfigurationPolicyPrefStore* CreateRecommendedPolicyPrefStore(); 54 static ConfigurationPolicyPrefStore* CreateRecommendedPolicyPrefStore();
54 55
55 // Returns the default policy definition list for Chrome. 56 // Returns the default policy definition list for Chrome.
56 static const ConfigurationPolicyProvider::PolicyDefinitionList* 57 static const ConfigurationPolicyProvider::PolicyDefinitionList*
57 GetChromePolicyDefinitionList(); 58 GetChromePolicyDefinitionList();
58 59
59 // Returns the set of preference paths that can be affected by a proxy
60 // policy.
61 static void GetProxyPreferenceSet(ProxyPreferenceSet* proxy_pref_set);
62
63 private: 60 private:
64 // Policies that map to a single preference are handled 61 // Policies that map to a single preference are handled
65 // by an automated converter. Each one of these policies 62 // by an automated converter. Each one of these policies
66 // has an entry in |simple_policy_map_| with the following type. 63 // has an entry in |simple_policy_map_| with the following type.
67 struct PolicyToPreferenceMapEntry { 64 struct PolicyToPreferenceMapEntry {
68 Value::ValueType value_type; 65 Value::ValueType value_type;
69 ConfigurationPolicyType policy_type; 66 ConfigurationPolicyType policy_type;
70 const char* preference_path; // A DictionaryValue path, not a file path. 67 const char* preference_path; // A DictionaryValue path, not a file path.
71 }; 68 };
72 69
73 static const PolicyToPreferenceMapEntry kSimplePolicyMap[]; 70 static const PolicyToPreferenceMapEntry kSimplePolicyMap[];
74 static const PolicyToPreferenceMapEntry kProxyPolicyMap[]; 71 static const PolicyToPreferenceMapEntry kProxyPolicyMap[];
75 static const PolicyToPreferenceMapEntry kDefaultSearchPolicyMap[]; 72 static const PolicyToPreferenceMapEntry kDefaultSearchPolicyMap[];
76 static const ConfigurationPolicyProvider::PolicyDefinitionList 73 static const ConfigurationPolicyProvider::PolicyDefinitionList
77 kPolicyDefinitionList; 74 kPolicyDefinitionList;
78 75
79 ConfigurationPolicyProvider* provider_; 76 ConfigurationPolicyProvider* provider_;
80 scoped_ptr<DictionaryValue> prefs_; 77 scoped_ptr<DictionaryValue> prefs_;
81 78
82 // Set to false until the first proxy-relevant policy is applied. At that 79 // Temporary containers that store values until Completed() is called.
83 // time, default values are provided for all proxy-relevant prefs 80 scoped_ptr<Value> proxy_mode_container_;
84 // to override any values set from stores with a lower priority. 81 scoped_ptr<Value> proxy_server_container_;
85 bool lower_priority_proxy_settings_overridden_; 82 scoped_ptr<Value> proxy_pac_url_container_;
83 scoped_ptr<Value> proxy_bypass_list_container_;
86 84
87 // The following are used to track what proxy-relevant policy has been applied 85 bool error_in_proxy_settings_;
88 // accross calls to Apply to provide a warning if a policy specifies a
89 // contradictory proxy configuration. |proxy_disabled_| is set to true if and
90 // only if the kPolicyNoProxyServer has been applied,
91 // |proxy_configuration_specified_| is set to true if and only if any other
92 // proxy policy other than kPolicyNoProxyServer has been applied.
93 bool proxy_disabled_;
94 bool proxy_configuration_specified_;
95
96 // Set to true if a the proxy mode policy has been set to force Chrome
97 // to use the system proxy.
98 bool use_system_proxy_;
99 86
100 // Returns the map entry that corresponds to |policy| in the map. 87 // Returns the map entry that corresponds to |policy| in the map.
101 const PolicyToPreferenceMapEntry* FindPolicyInMap( 88 const PolicyToPreferenceMapEntry* FindPolicyInMap(
102 ConfigurationPolicyType policy, 89 ConfigurationPolicyType policy,
103 const PolicyToPreferenceMapEntry* map, 90 const PolicyToPreferenceMapEntry* map,
104 int size) const; 91 int size) const;
105 92
106 // Remove the preferences found in the map from |prefs_|. Returns true if 93 // Remove the preferences found in the map from |prefs_|. Returns true if
107 // any such preferences were found and removed. 94 // any such preferences were found and removed.
108 bool RemovePreferencesOfMap(const PolicyToPreferenceMapEntry* map, 95 bool RemovePreferencesOfMap(const PolicyToPreferenceMapEntry* map,
(...skipping 20 matching lines...) Expand all
129 // Make sure that the |path| if present in |prefs_|. If not, set it to 116 // Make sure that the |path| if present in |prefs_|. If not, set it to
130 // a blank string. 117 // a blank string.
131 void EnsureStringPrefExists(const std::string& path); 118 void EnsureStringPrefExists(const std::string& path);
132 119
133 // If the required entries for default search are specified and valid, 120 // If the required entries for default search are specified and valid,
134 // finalizes the policy-specified configuration by initializing the 121 // finalizes the policy-specified configuration by initializing the
135 // unspecified map entries. Otherwise wipes all default search related 122 // unspecified map entries. Otherwise wipes all default search related
136 // map entries from |prefs_|. 123 // map entries from |prefs_|.
137 void FinalizeDefaultSearchPolicySettings(); 124 void FinalizeDefaultSearchPolicySettings();
138 125
126 // Returns true if the policy values stored in proxy_* represent a valid
127 // proxy configuration.
128 bool CheckProxySettings();
129
130 // Assumes CheckProxySettings returns true and applies the values stored
131 // in proxy_*.
132 void ApplyProxySettings();
133
139 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyPrefStore); 134 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyPrefStore);
140 }; 135 };
141 136
142 } // namespace policy 137 } // namespace policy
143 138
144 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PREF_STORE_H_ 139 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PREF_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698