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

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

Issue 11444029: Added UserPolicySigninService::FetchPolicyForSignedInUser(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review feedback 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/device_local_account_policy_provider.h" 5 #include "chrome/browser/policy/device_local_account_policy_provider.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "chrome/browser/policy/cloud_policy_service.h" 8 #include "chrome/browser/policy/cloud_policy_service.h"
9 #include "chrome/browser/policy/policy_bundle.h" 9 #include "chrome/browser/policy/policy_bundle.h"
10 #include "chrome/browser/policy/policy_service.h" 10 #include "chrome/browser/policy/policy_service.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } 51 }
52 52
53 void DeviceLocalAccountPolicyProvider::OnDeviceLocalAccountsChanged() { 53 void DeviceLocalAccountPolicyProvider::OnDeviceLocalAccountsChanged() {
54 UpdateFromBroker(); 54 UpdateFromBroker();
55 } 55 }
56 56
57 DeviceLocalAccountPolicyBroker* DeviceLocalAccountPolicyProvider::GetBroker() { 57 DeviceLocalAccountPolicyBroker* DeviceLocalAccountPolicyProvider::GetBroker() {
58 return service_->GetBrokerForAccount(account_id_); 58 return service_->GetBrokerForAccount(account_id_);
59 } 59 }
60 60
61 void DeviceLocalAccountPolicyProvider::ReportPolicyRefresh() { 61 void DeviceLocalAccountPolicyProvider::ReportPolicyRefresh(bool success) {
62 waiting_for_policy_refresh_ = false; 62 waiting_for_policy_refresh_ = false;
63 UpdateFromBroker(); 63 UpdateFromBroker();
64 } 64 }
65 65
66 void DeviceLocalAccountPolicyProvider::UpdateFromBroker() { 66 void DeviceLocalAccountPolicyProvider::UpdateFromBroker() {
67 DeviceLocalAccountPolicyBroker* broker = GetBroker(); 67 DeviceLocalAccountPolicyBroker* broker = GetBroker();
68 scoped_ptr<PolicyBundle> bundle(new PolicyBundle()); 68 scoped_ptr<PolicyBundle> bundle(new PolicyBundle());
69 if (broker) { 69 if (broker) {
70 store_initialized_ |= broker->core()->store()->is_initialized(); 70 store_initialized_ |= broker->core()->store()->is_initialized();
71 if (!waiting_for_policy_refresh_) { 71 if (!waiting_for_policy_refresh_) {
72 // Copy policy from the broker. 72 // Copy policy from the broker.
73 bundle->Get(POLICY_DOMAIN_CHROME, std::string()).CopyFrom( 73 bundle->Get(POLICY_DOMAIN_CHROME, std::string()).CopyFrom(
74 broker->core()->store()->policy_map()); 74 broker->core()->store()->policy_map());
75 } else { 75 } else {
76 // Wait for the refresh to finish. 76 // Wait for the refresh to finish.
77 return; 77 return;
78 } 78 }
79 } else { 79 } else {
80 // Keep existing policy, but do send an update. 80 // Keep existing policy, but do send an update.
81 waiting_for_policy_refresh_ = false; 81 waiting_for_policy_refresh_ = false;
82 weak_factory_.InvalidateWeakPtrs(); 82 weak_factory_.InvalidateWeakPtrs();
83 bundle->CopyFrom(policies()); 83 bundle->CopyFrom(policies());
84 } 84 }
85 UpdatePolicy(bundle.Pass()); 85 UpdatePolicy(bundle.Pass());
86 } 86 }
87 87
88 } // namespace policy 88 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698