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

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

Issue 16254003: WIP (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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/policy_service_impl.h" 5 #include "chrome/browser/policy/policy_service_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/stl_util.h" 12 #include "base/stl_util.h"
13 #include "chrome/browser/policy/policy_map.h"
14 13
15 namespace policy { 14 namespace policy {
16 15
17 PolicyServiceImpl::PolicyChangeInfo::PolicyChangeInfo( 16 PolicyServiceImpl::PolicyChangeInfo::PolicyChangeInfo(
18 const PolicyNamespace& policy_namespace, 17 const PolicyNamespace& policy_namespace,
19 const PolicyMap& previous, 18 const PolicyMap& previous,
20 const PolicyMap& current) 19 const PolicyMap& current)
21 : policy_namespace_(policy_namespace) { 20 : policy_namespace_(policy_namespace) {
22 previous_.CopyFrom(previous); 21 previous_.CopyFrom(previous);
23 current_.CopyFrom(current); 22 current_.CopyFrom(current);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 const std::set<std::string>& components) { 78 const std::set<std::string>& components) {
80 for (Iterator it = providers_.begin(); it != providers_.end(); ++it) 79 for (Iterator it = providers_.begin(); it != providers_.end(); ++it)
81 (*it)->RegisterPolicyDomain(domain, components); 80 (*it)->RegisterPolicyDomain(domain, components);
82 } 81 }
83 82
84 const PolicyMap& PolicyServiceImpl::GetPolicies( 83 const PolicyMap& PolicyServiceImpl::GetPolicies(
85 const PolicyNamespace& ns) const { 84 const PolicyNamespace& ns) const {
86 return policy_bundle_.Get(ns); 85 return policy_bundle_.Get(ns);
87 } 86 }
88 87
88 const PolicyBundle& PolicyServiceImpl::GetAllPolicies() const {
89 return policy_bundle_;
90 }
91
89 bool PolicyServiceImpl::IsInitializationComplete(PolicyDomain domain) const { 92 bool PolicyServiceImpl::IsInitializationComplete(PolicyDomain domain) const {
90 DCHECK(domain >= 0 && domain < POLICY_DOMAIN_SIZE); 93 DCHECK(domain >= 0 && domain < POLICY_DOMAIN_SIZE);
91 return initialization_complete_[domain]; 94 return initialization_complete_[domain];
92 } 95 }
93 96
94 void PolicyServiceImpl::RefreshPolicies(const base::Closure& callback) { 97 void PolicyServiceImpl::RefreshPolicies(const base::Closure& callback) {
95 if (!callback.is_null()) 98 if (!callback.is_null())
96 refresh_callbacks_.push_back(callback); 99 refresh_callbacks_.push_back(callback);
97 100
98 if (providers_.empty()) { 101 if (providers_.empty()) {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 if (refresh_pending_.empty() && !refresh_callbacks_.empty()) { 236 if (refresh_pending_.empty() && !refresh_callbacks_.empty()) {
234 std::vector<base::Closure> callbacks; 237 std::vector<base::Closure> callbacks;
235 callbacks.swap(refresh_callbacks_); 238 callbacks.swap(refresh_callbacks_);
236 std::vector<base::Closure>::iterator it; 239 std::vector<base::Closure>::iterator it;
237 for (it = callbacks.begin(); it != callbacks.end(); ++it) 240 for (it = callbacks.begin(); it != callbacks.end(); ++it)
238 it->Run(); 241 it->Run();
239 } 242 }
240 } 243 }
241 244
242 } // namespace policy 245 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/policy_service_impl.h ('k') | chrome/browser/policy/policy_service_stub.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698