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

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

Issue 10825415: Added code to persist downloaded cloud policy to disk. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed unneeded #include Created 8 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) 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_service.h" 5 #include "chrome/browser/policy/cloud_policy_service.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "chrome/browser/policy/proto/device_management_backend.pb.h" 8 #include "chrome/browser/policy/proto/device_management_backend.pb.h"
9 9
10 namespace em = enterprise_management; 10 namespace em = enterprise_management;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 98
99 // Whether to submit the machine ID. 99 // Whether to submit the machine ID.
100 bool submit_machine_id = false; 100 bool submit_machine_id = false;
101 if (policy && policy->has_valid_serial_number_missing()) 101 if (policy && policy->has_valid_serial_number_missing())
102 submit_machine_id = policy->valid_serial_number_missing(); 102 submit_machine_id = policy->valid_serial_number_missing();
103 client_->set_submit_machine_id(submit_machine_id); 103 client_->set_submit_machine_id(submit_machine_id);
104 104
105 // Finally, set up registration if necessary. 105 // Finally, set up registration if necessary.
106 if (policy && policy->has_request_token() && policy->has_device_id() && 106 if (policy && policy->has_request_token() && policy->has_device_id() &&
107 !client_->is_registered()) { 107 !client_->is_registered()) {
108 DVLOG(1) << "Setting up registration with request token: "
109 << policy->request_token();
108 client_->SetupRegistration(policy->request_token(), 110 client_->SetupRegistration(policy->request_token(),
109 policy->device_id()); 111 policy->device_id());
110 } 112 }
111 113
112 if (refresh_state_ == REFRESH_POLICY_STORE) 114 if (refresh_state_ == REFRESH_POLICY_STORE)
113 RefreshCompleted(); 115 RefreshCompleted();
114 } 116 }
115 117
116 void CloudPolicyService::OnStoreError(CloudPolicyStore* store) { 118 void CloudPolicyService::OnStoreError(CloudPolicyStore* store) {
117 if (refresh_state_ == REFRESH_POLICY_STORE) 119 if (refresh_state_ == REFRESH_POLICY_STORE)
118 RefreshCompleted(); 120 RefreshCompleted();
119 } 121 }
120 122
121 void CloudPolicyService::RefreshCompleted() { 123 void CloudPolicyService::RefreshCompleted() {
122 // Clear state and |refresh_callbacks_| before actually invoking them, s.t. 124 // Clear state and |refresh_callbacks_| before actually invoking them, s.t.
123 // triggering new policy fetches behaves as expected. 125 // triggering new policy fetches behaves as expected.
124 std::vector<base::Closure> callbacks; 126 std::vector<base::Closure> callbacks;
125 callbacks.swap(refresh_callbacks_); 127 callbacks.swap(refresh_callbacks_);
126 refresh_state_ = REFRESH_NONE; 128 refresh_state_ = REFRESH_NONE;
127 129
128 for (std::vector<base::Closure>::iterator callback(callbacks.begin()); 130 for (std::vector<base::Closure>::iterator callback(callbacks.begin());
129 callback != callbacks.end(); 131 callback != callbacks.end();
130 ++callback) { 132 ++callback) {
131 callback->Run(); 133 callback->Run();
132 } 134 }
133 } 135 }
134 136
135 } // namespace policy 137 } // namespace policy
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/policy/cloud_policy_store.h » ('j') | chrome/browser/policy/user_cloud_policy_store.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698