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

Side by Side Diff: chrome/browser/policy/cloud/user_cloud_policy_invalidator.cc

Issue 213743014: Add an extra delay for policy invalidations to be available. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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
« no previous file with comments | « chrome/browser/policy/cloud/cloud_policy_invalidator_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/user_cloud_policy_invalidator.h" 5 #include "chrome/browser/policy/cloud/user_cloud_policy_invalidator.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/scoped_ptr.h"
8 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "base/time/default_clock.h"
9 #include "chrome/browser/chrome_notification_types.h" 11 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/invalidation/invalidation_service_factory.h" 12 #include "chrome/browser/invalidation/invalidation_service_factory.h"
11 #include "components/policy/core/common/cloud/cloud_policy_manager.h" 13 #include "components/policy/core/common/cloud/cloud_policy_manager.h"
12 #include "content/public/browser/notification_source.h" 14 #include "content/public/browser/notification_source.h"
13 15
14 namespace policy { 16 namespace policy {
15 17
16 UserCloudPolicyInvalidator::UserCloudPolicyInvalidator( 18 UserCloudPolicyInvalidator::UserCloudPolicyInvalidator(
17 Profile* profile, 19 Profile* profile,
18 CloudPolicyManager* policy_manager) 20 CloudPolicyManager* policy_manager)
19 : CloudPolicyInvalidator( 21 : CloudPolicyInvalidator(
20 policy_manager->core(), 22 policy_manager->core(),
21 base::MessageLoopProxy::current()), 23 base::MessageLoopProxy::current(),
24 scoped_ptr<base::Clock>(new base::DefaultClock())),
22 profile_(profile) { 25 profile_(profile) {
23 DCHECK(profile); 26 DCHECK(profile);
24 27
25 // Register for notification that profile creation is complete. The 28 // Register for notification that profile creation is complete. The
26 // invalidator must not be initialized before then because the invalidation 29 // invalidator must not be initialized before then because the invalidation
27 // service cannot be started because it depends on components initialized 30 // service cannot be started because it depends on components initialized
28 // after this object is instantiated. 31 // after this object is instantiated.
29 // TODO(stepco): Delayed initialization can be removed once the request 32 // TODO(stepco): Delayed initialization can be removed once the request
30 // context can be accessed during profile-keyed service creation. Tracked by 33 // context can be accessed during profile-keyed service creation. Tracked by
31 // bug 286209. 34 // bug 286209.
(...skipping 13 matching lines...) Expand all
45 // Initialize now that profile creation is complete and the invalidation 48 // Initialize now that profile creation is complete and the invalidation
46 // service can safely be initialized. 49 // service can safely be initialized.
47 DCHECK(type == chrome::NOTIFICATION_PROFILE_ADDED); 50 DCHECK(type == chrome::NOTIFICATION_PROFILE_ADDED);
48 invalidation::InvalidationService* invalidation_service = 51 invalidation::InvalidationService* invalidation_service =
49 invalidation::InvalidationServiceFactory::GetForProfile(profile_); 52 invalidation::InvalidationServiceFactory::GetForProfile(profile_);
50 if (invalidation_service) 53 if (invalidation_service)
51 Initialize(invalidation_service); 54 Initialize(invalidation_service);
52 } 55 }
53 56
54 } // namespace policy 57 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/cloud/cloud_policy_invalidator_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698