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

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

Issue 10449071: Enable user policy handling through the new cloud policy stack. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. 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_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;
11 11
12 namespace policy { 12 namespace policy {
13 13
14 CloudPolicyService::CloudPolicyService(scoped_ptr<CloudPolicyClient> client, 14 CloudPolicyService::CloudPolicyService(scoped_ptr<CloudPolicyClient> client,
15 scoped_ptr<CloudPolicyStore> store) 15 CloudPolicyStore* store)
16 : client_(client.Pass()), 16 : client_(client.Pass()),
17 store_(store.Pass()), 17 store_(store),
18 refresh_state_(REFRESH_NONE) { 18 refresh_state_(REFRESH_NONE) {
19 client_->AddObserver(this); 19 client_->AddObserver(this);
20 store_->AddObserver(this); 20 store_->AddObserver(this);
21
22 // Make sure we initialize |client_| from the policy data that might be
23 // already present in |store_|.
24 OnStoreLoaded(store_);
21 } 25 }
22 26
23 CloudPolicyService::~CloudPolicyService() { 27 CloudPolicyService::~CloudPolicyService() {
24 client_->RemoveObserver(this); 28 client_->RemoveObserver(this);
25 store_->RemoveObserver(this); 29 store_->RemoveObserver(this);
26 } 30 }
27 31
28 std::string CloudPolicyService::ManagedBy() const { 32 std::string CloudPolicyService::ManagedBy() const {
29 const em::PolicyData* policy = store_->policy(); 33 const em::PolicyData* policy = store_->policy();
30 if (policy) { 34 if (policy) {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 refresh_state_ = REFRESH_NONE; 126 refresh_state_ = REFRESH_NONE;
123 127
124 for (std::vector<base::Closure>::iterator callback(callbacks.begin()); 128 for (std::vector<base::Closure>::iterator callback(callbacks.begin());
125 callback != callbacks.end(); 129 callback != callbacks.end();
126 ++callback) { 130 ++callback) {
127 callback->Run(); 131 callback->Run();
128 } 132 }
129 } 133 }
130 134
131 } // namespace policy 135 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/cloud_policy_service.h ('k') | chrome/browser/policy/cloud_policy_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698