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

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

Issue 10628008: If there is a device id use that instead of a new one for re-enrolling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 reregister_(false),
36 token_cache_loaded_(false), 37 token_cache_loaded_(false),
37 policy_fetching_enabled_(true), 38 policy_fetching_enabled_(true),
38 device_mode_(DEVICE_MODE_PENDING) {} 39 device_mode_(DEVICE_MODE_PENDING) {}
39 40
40 void CloudPolicyDataStore::SetDeviceToken(const std::string& device_token, 41 void CloudPolicyDataStore::SetDeviceToken(const std::string& device_token,
41 bool from_cache) { 42 bool from_cache) {
42 DCHECK(token_cache_loaded_ != from_cache); 43 DCHECK(token_cache_loaded_ != from_cache);
43 if (!token_cache_loaded_) { 44 if (!token_cache_loaded_) {
44 // The cache should be the first to set the token (it may be empty). 45 // The cache should be the first to set the token (it may be empty).
45 DCHECK(from_cache); 46 DCHECK(from_cache);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 116
116 void CloudPolicyDataStore::set_policy_fetching_enabled( 117 void CloudPolicyDataStore::set_policy_fetching_enabled(
117 bool policy_fetching_enabled) { 118 bool policy_fetching_enabled) {
118 policy_fetching_enabled_ = policy_fetching_enabled; 119 policy_fetching_enabled_ = policy_fetching_enabled;
119 } 120 }
120 121
121 void CloudPolicyDataStore::set_device_mode(DeviceMode device_mode) { 122 void CloudPolicyDataStore::set_device_mode(DeviceMode device_mode) {
122 device_mode_ = device_mode; 123 device_mode_ = device_mode;
123 } 124 }
124 125
126 void CloudPolicyDataStore::set_reregister(bool reregister) {
127 reregister_ = reregister;
128 }
129
125 const std::string& CloudPolicyDataStore::device_token() const { 130 const std::string& CloudPolicyDataStore::device_token() const {
126 return device_token_; 131 return device_token_;
127 } 132 }
128 133
129 const std::string& CloudPolicyDataStore::gaia_token() const { 134 const std::string& CloudPolicyDataStore::gaia_token() const {
130 return gaia_token_; 135 return gaia_token_;
131 } 136 }
132 137
133 const std::string& CloudPolicyDataStore::oauth_token() const { 138 const std::string& CloudPolicyDataStore::oauth_token() const {
134 return oauth_token_; 139 return oauth_token_;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 } 177 }
173 178
174 bool CloudPolicyDataStore::known_machine_id() const { 179 bool CloudPolicyDataStore::known_machine_id() const {
175 return known_machine_id_; 180 return known_machine_id_;
176 } 181 }
177 182
178 DeviceMode CloudPolicyDataStore::device_mode() const { 183 DeviceMode CloudPolicyDataStore::device_mode() const {
179 return device_mode_; 184 return device_mode_;
180 } 185 }
181 186
187 bool CloudPolicyDataStore::reregister() const {
188 return reregister_;
189 }
190
182 #if defined(OS_CHROMEOS) 191 #if defined(OS_CHROMEOS)
183 DeviceStatusCollector* 192 DeviceStatusCollector*
184 CloudPolicyDataStore::device_status_collector() { 193 CloudPolicyDataStore::device_status_collector() {
185 return device_status_collector_.get(); 194 return device_status_collector_.get();
186 } 195 }
187 196
188 void CloudPolicyDataStore::set_device_status_collector( 197 void CloudPolicyDataStore::set_device_status_collector(
189 DeviceStatusCollector* collector) { 198 DeviceStatusCollector* collector) {
190 device_status_collector_.reset(collector); 199 device_status_collector_.reset(collector);
191 } 200 }
(...skipping 11 matching lines...) Expand all
203 212
204 void CloudPolicyDataStore::NotifyCredentialsChanged() { 213 void CloudPolicyDataStore::NotifyCredentialsChanged() {
205 FOR_EACH_OBSERVER(Observer, observer_list_, OnCredentialsChanged()); 214 FOR_EACH_OBSERVER(Observer, observer_list_, OnCredentialsChanged());
206 } 215 }
207 216
208 void CloudPolicyDataStore::NotifyDeviceTokenChanged() { 217 void CloudPolicyDataStore::NotifyDeviceTokenChanged() {
209 FOR_EACH_OBSERVER(Observer, observer_list_, OnDeviceTokenChanged()); 218 FOR_EACH_OBSERVER(Observer, observer_list_, OnDeviceTokenChanged());
210 } 219 }
211 220
212 } // namespace policy 221 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/cloud_policy_data_store.h ('k') | chrome/browser/policy/device_token_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698