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

Side by Side Diff: chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc

Issue 56623005: Policy providers all get a SchemaRegistry to work with. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@chrome-policy-schema-9-purge-with-callback
Patch Set: Fixed mac tests Created 7 years, 1 month 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
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/chromeos/policy/user_cloud_policy_manager_chromeos.h" 5 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.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 "base/message_loop/message_loop_proxy.h" 10 #include "base/message_loop/message_loop_proxy.h"
11 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
12 #include "base/metrics/sparse_histogram.h" 12 #include "base/metrics/sparse_histogram.h"
13 #include "base/sequenced_task_runner.h" 13 #include "base/sequenced_task_runner.h"
14 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/chromeos/policy/policy_oauth2_token_fetcher.h" 15 #include "chrome/browser/chromeos/policy/policy_oauth2_token_fetcher.h"
16 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom eos.h" 16 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom eos.h"
17 #include "chrome/browser/chromeos/profiles/profile_helper.h" 17 #include "chrome/browser/chromeos/profiles/profile_helper.h"
18 #include "chrome/browser/policy/cloud/cloud_external_data_manager.h" 18 #include "chrome/browser/policy/cloud/cloud_external_data_manager.h"
19 #include "chrome/browser/policy/cloud/cloud_policy_refresh_scheduler.h" 19 #include "chrome/browser/policy/cloud/cloud_policy_refresh_scheduler.h"
20 #include "chrome/browser/policy/cloud/resource_cache.h" 20 #include "chrome/browser/policy/cloud/resource_cache.h"
21 #include "chrome/browser/policy/policy_bundle.h" 21 #include "chrome/browser/policy/policy_bundle.h"
22 #include "chrome/browser/policy/policy_domain_descriptor.h"
23 #include "components/policy/core/common/policy_pref_names.h" 22 #include "components/policy/core/common/policy_pref_names.h"
24 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
25 #include "net/url_request/url_request_context_getter.h" 24 #include "net/url_request/url_request_context_getter.h"
26 25
27 namespace em = enterprise_management; 26 namespace em = enterprise_management;
28 27
29 namespace policy { 28 namespace policy {
30 29
31 namespace { 30 namespace {
32 31
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 return false; 146 return false;
148 if (domain == POLICY_DOMAIN_CHROME) 147 if (domain == POLICY_DOMAIN_CHROME)
149 return !wait_for_policy_fetch_; 148 return !wait_for_policy_fetch_;
150 if (ComponentCloudPolicyService::SupportsDomain(domain) && 149 if (ComponentCloudPolicyService::SupportsDomain(domain) &&
151 component_policy_service_) { 150 component_policy_service_) {
152 return component_policy_service_->is_initialized(); 151 return component_policy_service_->is_initialized();
153 } 152 }
154 return true; 153 return true;
155 } 154 }
156 155
157 void UserCloudPolicyManagerChromeOS::RegisterPolicyDomain( 156 void UserCloudPolicyManagerChromeOS::OnSchemaRegistryUpdated(
158 scoped_refptr<const PolicyDomainDescriptor> descriptor) { 157 const scoped_refptr<SchemaMap>& current_map,
159 if (ComponentCloudPolicyService::SupportsDomain(descriptor->domain()) && 158 bool has_new_schemas) {
160 component_policy_service_) { 159 // Send the new map even if |has_new_schemas| is false, so that policies for
161 component_policy_service_->RegisterPolicyDomain(descriptor); 160 // component that have been removed can be dropped from the cache.
bartfab (slow) 2013/11/05 15:53:04 Nit 1: s/component/components/ Nit 2: s/drooped/dr
Joao da Silva 2013/11/07 13:15:00 Done
162 } 161 if (component_policy_service_)
162 component_policy_service_->OnSchemasUpdated(current_map);
163 } 163 }
164 164
165 scoped_ptr<PolicyBundle> UserCloudPolicyManagerChromeOS::CreatePolicyBundle() { 165 scoped_ptr<PolicyBundle> UserCloudPolicyManagerChromeOS::CreatePolicyBundle() {
166 scoped_ptr<PolicyBundle> bundle = CloudPolicyManager::CreatePolicyBundle(); 166 scoped_ptr<PolicyBundle> bundle = CloudPolicyManager::CreatePolicyBundle();
167 if (component_policy_service_) 167 if (component_policy_service_)
168 bundle->MergeFrom(component_policy_service_->policy()); 168 bundle->MergeFrom(component_policy_service_->policy());
169 return bundle.Pass(); 169 return bundle.Pass();
170 } 170 }
171 171
172 void UserCloudPolicyManagerChromeOS::OnInitializationCompleted( 172 void UserCloudPolicyManagerChromeOS::OnInitializationCompleted(
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 // OnComponentCloudPolicyUpdated() once it's ready. 349 // OnComponentCloudPolicyUpdated() once it's ready.
350 return; 350 return;
351 } 351 }
352 352
353 core()->StartRefreshScheduler(); 353 core()->StartRefreshScheduler();
354 core()->TrackRefreshDelayPref(local_state_, 354 core()->TrackRefreshDelayPref(local_state_,
355 policy_prefs::kUserPolicyRefreshRate); 355 policy_prefs::kUserPolicyRefreshRate);
356 } 356 }
357 357
358 } // namespace policy 358 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698