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

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

Issue 19733003: Implement cloud policy invalidations using the invalidation service framework. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 5 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
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/command_line.h"
9 #include "base/logging.h" 10 #include "base/logging.h"
10 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
11 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/chromeos/policy/policy_oauth2_token_fetcher.h" 13 #include "chrome/browser/chromeos/policy/policy_oauth2_token_fetcher.h"
13 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom eos.h" 14 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom eos.h"
14 #include "chrome/browser/chromeos/profiles/profile_helper.h" 15 #include "chrome/browser/chromeos/profiles/profile_helper.h"
16 #include "chrome/browser/invalidation/invalidation_service_factory.h"
15 #include "chrome/browser/policy/cloud/cloud_policy_refresh_scheduler.h" 17 #include "chrome/browser/policy/cloud/cloud_policy_refresh_scheduler.h"
16 #include "chrome/browser/policy/cloud/resource_cache.h" 18 #include "chrome/browser/policy/cloud/resource_cache.h"
17 #include "chrome/browser/policy/policy_bundle.h" 19 #include "chrome/browser/policy/policy_bundle.h"
18 #include "chrome/browser/policy/policy_domain_descriptor.h" 20 #include "chrome/browser/policy/policy_domain_descriptor.h"
21 #include "chrome/common/chrome_switches.h"
19 #include "chrome/common/pref_names.h" 22 #include "chrome/common/pref_names.h"
20 #include "net/url_request/url_request_context_getter.h" 23 #include "net/url_request/url_request_context_getter.h"
21 24
22 namespace em = enterprise_management; 25 namespace em = enterprise_management;
23 26
24 namespace policy { 27 namespace policy {
25 28
26 UserCloudPolicyManagerChromeOS::UserCloudPolicyManagerChromeOS( 29 UserCloudPolicyManagerChromeOS::UserCloudPolicyManagerChromeOS(
30 Profile* profile,
27 scoped_ptr<CloudPolicyStore> store, 31 scoped_ptr<CloudPolicyStore> store,
28 scoped_ptr<ResourceCache> resource_cache, 32 scoped_ptr<ResourceCache> resource_cache,
29 bool wait_for_policy_fetch) 33 bool wait_for_policy_fetch)
30 : CloudPolicyManager( 34 : CloudPolicyManager(
31 PolicyNamespaceKey(dm_protocol::kChromeUserPolicyType, std::string()), 35 PolicyNamespaceKey(dm_protocol::kChromeUserPolicyType, std::string()),
32 store.get()), 36 store.get()),
37 profile_(profile),
33 store_(store.Pass()), 38 store_(store.Pass()),
34 wait_for_policy_fetch_(wait_for_policy_fetch) { 39 wait_for_policy_fetch_(wait_for_policy_fetch) {
35 if (resource_cache) { 40 if (resource_cache) {
36 component_policy_service_.reset(new ComponentCloudPolicyService( 41 component_policy_service_.reset(new ComponentCloudPolicyService(
37 this, store_.get(), resource_cache.Pass())); 42 this, store_.get(), resource_cache.Pass()));
38 } 43 }
39 } 44 }
40 45
41 UserCloudPolicyManagerChromeOS::~UserCloudPolicyManagerChromeOS() {} 46 UserCloudPolicyManagerChromeOS::~UserCloudPolicyManagerChromeOS() {}
42 47
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 if (component_policy_service_ && 271 if (component_policy_service_ &&
267 !component_policy_service_->is_initialized()) { 272 !component_policy_service_->is_initialized()) {
268 // If the client doesn't have the list of components to fetch yet then don't 273 // If the client doesn't have the list of components to fetch yet then don't
269 // start the scheduler. The |component_policy_service_| will call back into 274 // start the scheduler. The |component_policy_service_| will call back into
270 // OnComponentCloudPolicyUpdated() once it's ready. 275 // OnComponentCloudPolicyUpdated() once it's ready.
271 return; 276 return;
272 } 277 }
273 278
274 core()->StartRefreshScheduler(); 279 core()->StartRefreshScheduler();
275 core()->TrackRefreshDelayPref(local_state_, prefs::kUserPolicyRefreshRate); 280 core()->TrackRefreshDelayPref(local_state_, prefs::kUserPolicyRefreshRate);
281
282 if (CommandLine::ForCurrentProcess()->HasSwitch(
Joao da Silva 2013/07/23 20:44:47 Check the command line flag on CreateInvalidator i
Steve Condie 2013/07/24 01:42:04 Done.
283 switches::kEnableCloudPolicyPush)) {
284 CreateInvalidator(
285 invalidation::InvalidationServiceFactory::GetForProfile(profile_));
286 }
276 } 287 }
277 288
278 } // namespace policy 289 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698