| OLD | NEW |
| 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/message_loop/message_loop_proxy.h" | 8 #include "base/message_loop/message_loop_proxy.h" |
| 9 #include "base/time/default_clock.h" |
| 9 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/invalidation/invalidation_service_factory.h" | 11 #include "chrome/browser/invalidation/invalidation_service_factory.h" |
| 11 #include "components/policy/core/common/cloud/cloud_policy_manager.h" | 12 #include "components/policy/core/common/cloud/cloud_policy_manager.h" |
| 12 #include "content/public/browser/notification_source.h" | 13 #include "content/public/browser/notification_source.h" |
| 13 | 14 |
| 14 namespace policy { | 15 namespace policy { |
| 15 | 16 |
| 16 UserCloudPolicyInvalidator::UserCloudPolicyInvalidator( | 17 UserCloudPolicyInvalidator::UserCloudPolicyInvalidator( |
| 17 Profile* profile, | 18 Profile* profile, |
| 18 CloudPolicyManager* policy_manager) | 19 CloudPolicyManager* policy_manager) |
| 19 : CloudPolicyInvalidator( | 20 : CloudPolicyInvalidator( |
| 20 policy_manager->core(), | 21 policy_manager->core(), |
| 21 base::MessageLoopProxy::current()), | 22 base::MessageLoopProxy::current(), |
| 23 new base::DefaultClock()), |
| 22 profile_(profile) { | 24 profile_(profile) { |
| 23 DCHECK(profile); | 25 DCHECK(profile); |
| 24 | 26 |
| 25 // Register for notification that profile creation is complete. The | 27 // Register for notification that profile creation is complete. The |
| 26 // invalidator must not be initialized before then because the invalidation | 28 // invalidator must not be initialized before then because the invalidation |
| 27 // service cannot be started because it depends on components initialized | 29 // service cannot be started because it depends on components initialized |
| 28 // after this object is instantiated. | 30 // after this object is instantiated. |
| 29 // TODO(stepco): Delayed initialization can be removed once the request | 31 // TODO(stepco): Delayed initialization can be removed once the request |
| 30 // context can be accessed during profile-keyed service creation. Tracked by | 32 // context can be accessed during profile-keyed service creation. Tracked by |
| 31 // bug 286209. | 33 // bug 286209. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 45 // Initialize now that profile creation is complete and the invalidation | 47 // Initialize now that profile creation is complete and the invalidation |
| 46 // service can safely be initialized. | 48 // service can safely be initialized. |
| 47 DCHECK(type == chrome::NOTIFICATION_PROFILE_ADDED); | 49 DCHECK(type == chrome::NOTIFICATION_PROFILE_ADDED); |
| 48 invalidation::InvalidationService* invalidation_service = | 50 invalidation::InvalidationService* invalidation_service = |
| 49 invalidation::InvalidationServiceFactory::GetForProfile(profile_); | 51 invalidation::InvalidationServiceFactory::GetForProfile(profile_); |
| 50 if (invalidation_service) | 52 if (invalidation_service) |
| 51 Initialize(invalidation_service); | 53 Initialize(invalidation_service); |
| 52 } | 54 } |
| 53 | 55 |
| 54 } // namespace policy | 56 } // namespace policy |
| OLD | NEW |