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

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

Issue 9064006: Convert DeviceTokenFetcher and CloudPolicyController response callbacks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address nits Created 8 years, 11 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 #include "chrome/browser/policy/proto/device_management_constants.h"
11 10
12 namespace em = enterprise_management; 11 namespace em = enterprise_management;
13 12
14 namespace policy { 13 namespace policy {
15 14
16 CloudPolicyDataStore::~CloudPolicyDataStore() {} 15 CloudPolicyDataStore::~CloudPolicyDataStore() {}
17 16
18 // static 17 // static
19 CloudPolicyDataStore* CloudPolicyDataStore::CreateForUserPolicies() { 18 CloudPolicyDataStore* CloudPolicyDataStore::CreateForUserPolicies() {
20 return new CloudPolicyDataStore(em::DeviceRegisterRequest::USER, 19 return new CloudPolicyDataStore(em::DeviceRegisterRequest::USER,
21 kChromeUserPolicyType); 20 dm_protocol::kChromeUserPolicyType);
22 } 21 }
23 22
24 // static 23 // static
25 CloudPolicyDataStore* CloudPolicyDataStore::CreateForDevicePolicies() { 24 CloudPolicyDataStore* CloudPolicyDataStore::CreateForDevicePolicies() {
26 return new CloudPolicyDataStore(em::DeviceRegisterRequest::DEVICE, 25 return new CloudPolicyDataStore(em::DeviceRegisterRequest::DEVICE,
27 kChromeDevicePolicyType); 26 dm_protocol::kChromeDevicePolicyType);
28 } 27 }
29 28
30 CloudPolicyDataStore::CloudPolicyDataStore( 29 CloudPolicyDataStore::CloudPolicyDataStore(
31 const em::DeviceRegisterRequest_Type policy_register_type, 30 const em::DeviceRegisterRequest_Type policy_register_type,
32 const std::string& policy_type) 31 const std::string& policy_type)
33 : user_affiliation_(USER_AFFILIATION_NONE), 32 : user_affiliation_(policy::USER_AFFILIATION_NONE),
34 policy_register_type_(policy_register_type), 33 policy_register_type_(policy_register_type),
35 policy_type_(policy_type), 34 policy_type_(policy_type),
36 token_cache_loaded_(false) {} 35 token_cache_loaded_(false) {}
37 36
38 void CloudPolicyDataStore::SetDeviceToken(const std::string& device_token, 37 void CloudPolicyDataStore::SetDeviceToken(const std::string& device_token,
39 bool from_cache) { 38 bool from_cache) {
40 DCHECK(token_cache_loaded_ != from_cache); 39 DCHECK(token_cache_loaded_ != from_cache);
41 if (!token_cache_loaded_) { 40 if (!token_cache_loaded_) {
42 // The cache should be the first to set the token. (It may be "") 41 // The cache should be the first to set the token. (It may be "")
43 DCHECK(from_cache); 42 DCHECK(from_cache);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 95
97 const std::string& CloudPolicyDataStore::device_id() const { 96 const std::string& CloudPolicyDataStore::device_id() const {
98 return device_id_; 97 return device_id_;
99 } 98 }
100 99
101 void CloudPolicyDataStore::set_user_name(const std::string& user_name) { 100 void CloudPolicyDataStore::set_user_name(const std::string& user_name) {
102 user_name_ = user_name; 101 user_name_ = user_name;
103 } 102 }
104 103
105 void CloudPolicyDataStore::set_user_affiliation( 104 void CloudPolicyDataStore::set_user_affiliation(
106 UserAffiliation user_affiliation) { 105 policy::UserAffiliation user_affiliation) {
107 user_affiliation_ = user_affiliation; 106 user_affiliation_ = user_affiliation;
108 } 107 }
109 108
110 const std::string& CloudPolicyDataStore::device_token() const { 109 const std::string& CloudPolicyDataStore::device_token() const {
111 return device_token_; 110 return device_token_;
112 } 111 }
113 112
114 const std::string& CloudPolicyDataStore::gaia_token() const { 113 const std::string& CloudPolicyDataStore::gaia_token() const {
115 return gaia_token_; 114 return gaia_token_;
116 } 115 }
(...skipping 24 matching lines...) Expand all
141 } 140 }
142 141
143 bool CloudPolicyDataStore::token_cache_loaded() const { 142 bool CloudPolicyDataStore::token_cache_loaded() const {
144 return token_cache_loaded_; 143 return token_cache_loaded_;
145 } 144 }
146 145
147 const std::string& CloudPolicyDataStore::user_name() const { 146 const std::string& CloudPolicyDataStore::user_name() const {
148 return user_name_; 147 return user_name_;
149 } 148 }
150 149
151 CloudPolicyDataStore::UserAffiliation 150 policy::UserAffiliation CloudPolicyDataStore::user_affiliation() const {
152 CloudPolicyDataStore::user_affiliation() const {
153 return user_affiliation_; 151 return user_affiliation_;
154 } 152 }
155 153
156 #if defined(OS_CHROMEOS) 154 #if defined(OS_CHROMEOS)
157 DeviceStatusCollector* 155 DeviceStatusCollector*
158 CloudPolicyDataStore::device_status_collector() { 156 CloudPolicyDataStore::device_status_collector() {
159 return device_status_collector_.get(); 157 return device_status_collector_.get();
160 } 158 }
161 159
162 void CloudPolicyDataStore::set_device_status_collector( 160 void CloudPolicyDataStore::set_device_status_collector(
(...skipping 14 matching lines...) Expand all
177 175
178 void CloudPolicyDataStore::NotifyCredentialsChanged() { 176 void CloudPolicyDataStore::NotifyCredentialsChanged() {
179 FOR_EACH_OBSERVER(Observer, observer_list_, OnCredentialsChanged()); 177 FOR_EACH_OBSERVER(Observer, observer_list_, OnCredentialsChanged());
180 } 178 }
181 179
182 void CloudPolicyDataStore::NotifyDeviceTokenChanged() { 180 void CloudPolicyDataStore::NotifyDeviceTokenChanged() {
183 FOR_EACH_OBSERVER(Observer, observer_list_, OnDeviceTokenChanged()); 181 FOR_EACH_OBSERVER(Observer, observer_list_, OnDeviceTokenChanged());
184 } 182 }
185 183
186 } // namespace policy 184 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/cloud_policy_data_store.h ('k') | chrome/browser/policy/device_token_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698