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/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/thread_task_runner_handle.h" |
10 #include "base/time/default_clock.h" | 10 #include "base/time/default_clock.h" |
11 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
12 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" | 12 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" |
13 #include "components/invalidation/profile_invalidation_provider.h" | 13 #include "components/invalidation/profile_invalidation_provider.h" |
14 #include "components/policy/core/common/cloud/cloud_policy_manager.h" | 14 #include "components/policy/core/common/cloud/cloud_policy_manager.h" |
15 #include "content/public/browser/notification_source.h" | 15 #include "content/public/browser/notification_source.h" |
16 | 16 |
17 namespace policy { | 17 namespace policy { |
18 | 18 |
19 UserCloudPolicyInvalidator::UserCloudPolicyInvalidator( | 19 UserCloudPolicyInvalidator::UserCloudPolicyInvalidator( |
20 Profile* profile, | 20 Profile* profile, |
21 CloudPolicyManager* policy_manager) | 21 CloudPolicyManager* policy_manager) |
22 : CloudPolicyInvalidator(GetPolicyType(), | 22 : CloudPolicyInvalidator(GetPolicyType(), |
23 policy_manager->core(), | 23 policy_manager->core(), |
24 base::MessageLoopProxy::current(), | 24 base::ThreadTaskRunnerHandle::Get(), |
25 scoped_ptr<base::Clock>(new base::DefaultClock()), | 25 scoped_ptr<base::Clock>(new base::DefaultClock()), |
26 0 /* highest_handled_invalidation_version */), | 26 0 /* highest_handled_invalidation_version */), |
27 profile_(profile) { | 27 profile_(profile) { |
28 DCHECK(profile); | 28 DCHECK(profile); |
29 | 29 |
30 // Register for notification that profile creation is complete. The | 30 // Register for notification that profile creation is complete. The |
31 // invalidator must not be initialized before then because the invalidation | 31 // invalidator must not be initialized before then because the invalidation |
32 // service cannot be started because it depends on components initialized | 32 // service cannot be started because it depends on components initialized |
33 // after this object is instantiated. | 33 // after this object is instantiated. |
34 // TODO(stepco): Delayed initialization can be removed once the request | 34 // TODO(stepco): Delayed initialization can be removed once the request |
(...skipping 29 matching lines...) Expand all Loading... |
64 // Initialize now that profile creation is complete and the invalidation | 64 // Initialize now that profile creation is complete and the invalidation |
65 // service can safely be initialized. | 65 // service can safely be initialized. |
66 DCHECK(type == chrome::NOTIFICATION_PROFILE_ADDED); | 66 DCHECK(type == chrome::NOTIFICATION_PROFILE_ADDED); |
67 invalidation::ProfileInvalidationProvider* invalidation_provider = | 67 invalidation::ProfileInvalidationProvider* invalidation_provider = |
68 invalidation::ProfileInvalidationProviderFactory::GetForProfile(profile_); | 68 invalidation::ProfileInvalidationProviderFactory::GetForProfile(profile_); |
69 if (invalidation_provider) | 69 if (invalidation_provider) |
70 Initialize(invalidation_provider->GetInvalidationService()); | 70 Initialize(invalidation_provider->GetInvalidationService()); |
71 } | 71 } |
72 | 72 |
73 } // namespace policy | 73 } // namespace policy |
OLD | NEW |