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

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

Issue 11444029: Added UserPolicySigninService::FetchPolicyForSignedInUser(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years 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_manager.h" 5 #include "chrome/browser/policy/cloud_policy_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chrome/browser/policy/cloud_policy_refresh_scheduler.h" 10 #include "chrome/browser/policy/cloud_policy_refresh_scheduler.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 return store_->is_initialized(); 44 return store_->is_initialized();
45 } 45 }
46 46
47 void CloudPolicyManager::RefreshPolicies() { 47 void CloudPolicyManager::RefreshPolicies() {
48 if (service_.get()) { 48 if (service_.get()) {
49 waiting_for_policy_refresh_ = true; 49 waiting_for_policy_refresh_ = true;
50 service_->RefreshPolicy( 50 service_->RefreshPolicy(
51 base::Bind(&CloudPolicyManager::OnRefreshComplete, 51 base::Bind(&CloudPolicyManager::OnRefreshComplete,
52 base::Unretained(this))); 52 base::Unretained(this)));
53 } else { 53 } else {
54 OnRefreshComplete(); 54 OnRefreshComplete(false);
55 } 55 }
56 } 56 }
57 57
58 void CloudPolicyManager::OnStoreLoaded(CloudPolicyStore* store) { 58 void CloudPolicyManager::OnStoreLoaded(CloudPolicyStore* store) {
59 DCHECK_EQ(store_, store); 59 DCHECK_EQ(store_, store);
60 CheckAndPublishPolicy(); 60 CheckAndPublishPolicy();
61 } 61 }
62 62
63 void CloudPolicyManager::OnStoreError(CloudPolicyStore* store) { 63 void CloudPolicyManager::OnStoreError(CloudPolicyStore* store) {
64 DCHECK_EQ(store_, store); 64 DCHECK_EQ(store_, store);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 98
99 void CloudPolicyManager::CheckAndPublishPolicy() { 99 void CloudPolicyManager::CheckAndPublishPolicy() {
100 if (IsInitializationComplete() && !waiting_for_policy_refresh_) { 100 if (IsInitializationComplete() && !waiting_for_policy_refresh_) {
101 scoped_ptr<PolicyBundle> bundle(new PolicyBundle()); 101 scoped_ptr<PolicyBundle> bundle(new PolicyBundle());
102 bundle->Get(POLICY_DOMAIN_CHROME, std::string()).CopyFrom( 102 bundle->Get(POLICY_DOMAIN_CHROME, std::string()).CopyFrom(
103 store_->policy_map()); 103 store_->policy_map());
104 UpdatePolicy(bundle.Pass()); 104 UpdatePolicy(bundle.Pass());
105 } 105 }
106 } 106 }
107 107
108 void CloudPolicyManager::OnRefreshComplete() { 108 void CloudPolicyManager::OnRefreshComplete(bool success) {
109 waiting_for_policy_refresh_ = false; 109 waiting_for_policy_refresh_ = false;
110 CheckAndPublishPolicy(); 110 CheckAndPublishPolicy();
111 } 111 }
112 112
113 void CloudPolicyManager::UpdateRefreshDelay() { 113 void CloudPolicyManager::UpdateRefreshDelay() {
114 refresh_scheduler_->SetRefreshDelay(refresh_delay_->GetValue()); 114 refresh_scheduler_->SetRefreshDelay(refresh_delay_->GetValue());
115 } 115 }
116 116
117 } // namespace policy 117 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698