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

Side by Side Diff: chrome/browser/policy/cloud_policy_data_store.cc

Issue 9403010: Add support for kiosk mode on the client. Make sure the settings are written in the lockbox. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed nitty nit. Created 8 years, 10 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) 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/policy/cloud_policy_data_store.h" 5 #include "chrome/browser/policy/cloud_policy_data_store.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "chrome/browser/policy/proto/device_management_backend.pb.h" 9 #include "chrome/browser/policy/proto/device_management_backend.pb.h"
10 10
(...skipping 15 matching lines...) Expand all
26 dm_protocol::kChromeDevicePolicyType); 26 dm_protocol::kChromeDevicePolicyType);
27 } 27 }
28 28
29 CloudPolicyDataStore::CloudPolicyDataStore( 29 CloudPolicyDataStore::CloudPolicyDataStore(
30 const em::DeviceRegisterRequest_Type policy_register_type, 30 const em::DeviceRegisterRequest_Type policy_register_type,
31 const std::string& policy_type) 31 const std::string& policy_type)
32 : user_affiliation_(USER_AFFILIATION_NONE), 32 : user_affiliation_(USER_AFFILIATION_NONE),
33 policy_register_type_(policy_register_type), 33 policy_register_type_(policy_register_type),
34 policy_type_(policy_type), 34 policy_type_(policy_type),
35 known_machine_id_(false), 35 known_machine_id_(false),
36 token_cache_loaded_(false) {} 36 token_cache_loaded_(false),
37 device_mode_(DEVICE_MODE_UNKNOWN) {}
37 38
38 void CloudPolicyDataStore::SetDeviceToken(const std::string& device_token, 39 void CloudPolicyDataStore::SetDeviceToken(const std::string& device_token,
39 bool from_cache) { 40 bool from_cache) {
40 DCHECK(token_cache_loaded_ != from_cache); 41 DCHECK(token_cache_loaded_ != from_cache);
41 if (!token_cache_loaded_) { 42 if (!token_cache_loaded_) {
42 // The cache should be the first to set the token. (It may be "") 43 // The cache should be the first to set the token. (It may be "")
43 DCHECK(from_cache); 44 DCHECK(from_cache);
44 token_cache_loaded_ = true; 45 token_cache_loaded_ = true;
45 } else { 46 } else {
46 // The cache should never set the token later. 47 // The cache should never set the token later.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 105
105 void CloudPolicyDataStore::set_user_affiliation( 106 void CloudPolicyDataStore::set_user_affiliation(
106 UserAffiliation user_affiliation) { 107 UserAffiliation user_affiliation) {
107 user_affiliation_ = user_affiliation; 108 user_affiliation_ = user_affiliation;
108 } 109 }
109 110
110 void CloudPolicyDataStore::set_known_machine_id(bool known_machine_id) { 111 void CloudPolicyDataStore::set_known_machine_id(bool known_machine_id) {
111 known_machine_id_ = known_machine_id; 112 known_machine_id_ = known_machine_id;
112 } 113 }
113 114
115 void CloudPolicyDataStore::set_device_mode(DeviceMode device_mode) {
116 device_mode_ = device_mode;
117 }
118
114 const std::string& CloudPolicyDataStore::device_token() const { 119 const std::string& CloudPolicyDataStore::device_token() const {
115 return device_token_; 120 return device_token_;
116 } 121 }
117 122
118 const std::string& CloudPolicyDataStore::gaia_token() const { 123 const std::string& CloudPolicyDataStore::gaia_token() const {
119 return gaia_token_; 124 return gaia_token_;
120 } 125 }
121 126
122 const std::string& CloudPolicyDataStore::oauth_token() const { 127 const std::string& CloudPolicyDataStore::oauth_token() const {
123 return oauth_token_; 128 return oauth_token_;
(...skipping 29 matching lines...) Expand all
153 } 158 }
154 159
155 UserAffiliation CloudPolicyDataStore::user_affiliation() const { 160 UserAffiliation CloudPolicyDataStore::user_affiliation() const {
156 return user_affiliation_; 161 return user_affiliation_;
157 } 162 }
158 163
159 bool CloudPolicyDataStore::known_machine_id() const { 164 bool CloudPolicyDataStore::known_machine_id() const {
160 return known_machine_id_; 165 return known_machine_id_;
161 } 166 }
162 167
168 DeviceMode CloudPolicyDataStore::device_mode() const {
169 return device_mode_;
170 }
171
163 #if defined(OS_CHROMEOS) 172 #if defined(OS_CHROMEOS)
164 DeviceStatusCollector* 173 DeviceStatusCollector*
165 CloudPolicyDataStore::device_status_collector() { 174 CloudPolicyDataStore::device_status_collector() {
166 return device_status_collector_.get(); 175 return device_status_collector_.get();
167 } 176 }
168 177
169 void CloudPolicyDataStore::set_device_status_collector( 178 void CloudPolicyDataStore::set_device_status_collector(
170 DeviceStatusCollector* collector) { 179 DeviceStatusCollector* collector) {
171 device_status_collector_.reset(collector); 180 device_status_collector_.reset(collector);
172 } 181 }
173 #endif 182 #endif // OS_CHROMEOS
174 183
175 void CloudPolicyDataStore::AddObserver( 184 void CloudPolicyDataStore::AddObserver(
176 CloudPolicyDataStore::Observer* observer) { 185 CloudPolicyDataStore::Observer* observer) {
177 observer_list_.AddObserver(observer); 186 observer_list_.AddObserver(observer);
178 } 187 }
179 188
180 void CloudPolicyDataStore::RemoveObserver( 189 void CloudPolicyDataStore::RemoveObserver(
181 CloudPolicyDataStore::Observer* observer) { 190 CloudPolicyDataStore::Observer* observer) {
182 observer_list_.RemoveObserver(observer); 191 observer_list_.RemoveObserver(observer);
183 } 192 }
184 193
185 void CloudPolicyDataStore::NotifyCredentialsChanged() { 194 void CloudPolicyDataStore::NotifyCredentialsChanged() {
186 FOR_EACH_OBSERVER(Observer, observer_list_, OnCredentialsChanged()); 195 FOR_EACH_OBSERVER(Observer, observer_list_, OnCredentialsChanged());
187 } 196 }
188 197
189 void CloudPolicyDataStore::NotifyDeviceTokenChanged() { 198 void CloudPolicyDataStore::NotifyDeviceTokenChanged() {
190 FOR_EACH_OBSERVER(Observer, observer_list_, OnDeviceTokenChanged()); 199 FOR_EACH_OBSERVER(Observer, observer_list_, OnDeviceTokenChanged());
191 } 200 }
192 201
193 } // namespace policy 202 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/cloud_policy_data_store.h ('k') | chrome/browser/policy/cloud_policy_subsystem.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698