OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/arc/arc_service_manager.h" | 5 #include "components/arc/arc_service_manager.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 } | 98 } |
99 | 99 |
100 void ArcServiceManager::OnPrimaryUserProfilePrepared( | 100 void ArcServiceManager::OnPrimaryUserProfilePrepared( |
101 const AccountId& account_id, | 101 const AccountId& account_id, |
102 std::unique_ptr<BooleanPrefMember> arc_enabled_pref) { | 102 std::unique_ptr<BooleanPrefMember> arc_enabled_pref) { |
103 DCHECK(thread_checker_.CalledOnValidThread()); | 103 DCHECK(thread_checker_.CalledOnValidThread()); |
104 AddService(base::MakeUnique<ArcNotificationManager>(arc_bridge_service(), | 104 AddService(base::MakeUnique<ArcNotificationManager>(arc_bridge_service(), |
105 account_id)); | 105 account_id)); |
106 } | 106 } |
107 | 107 |
| 108 void ArcServiceManager::AddObserver(Observer* observer) { |
| 109 observer_list_.AddObserver(observer); |
| 110 } |
| 111 |
| 112 void ArcServiceManager::RemoveObserver(Observer* observer) { |
| 113 observer_list_.RemoveObserver(observer); |
| 114 } |
| 115 |
| 116 void ArcServiceManager::OnAppsUpdated() { |
| 117 for (auto& observer : observer_list_) |
| 118 observer.OnAppsUpdated(); |
| 119 } |
| 120 |
108 void ArcServiceManager::Shutdown() { | 121 void ArcServiceManager::Shutdown() { |
109 icon_loader_ = nullptr; | 122 icon_loader_ = nullptr; |
110 activity_resolver_ = nullptr; | 123 activity_resolver_ = nullptr; |
111 services_.clear(); | 124 services_.clear(); |
112 arc_bridge_service_->OnShutdown(); | 125 arc_bridge_service_->OnShutdown(); |
113 } | 126 } |
114 | 127 |
115 // static | 128 // static |
116 void ArcServiceManager::SetArcBridgeServiceForTesting( | 129 void ArcServiceManager::SetArcBridgeServiceForTesting( |
117 std::unique_ptr<ArcBridgeService> arc_bridge_service) { | 130 std::unique_ptr<ArcBridgeService> arc_bridge_service) { |
118 if (g_arc_bridge_service_for_testing) { | 131 if (g_arc_bridge_service_for_testing) { |
119 delete g_arc_bridge_service_for_testing; | 132 delete g_arc_bridge_service_for_testing; |
120 } | 133 } |
121 g_arc_bridge_service_for_testing = arc_bridge_service.release(); | 134 g_arc_bridge_service_for_testing = arc_bridge_service.release(); |
122 } | 135 } |
123 | 136 |
124 } // namespace arc | 137 } // namespace arc |
OLD | NEW |