| 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/observer_list.h" |
| 10 #include "base/sequenced_task_runner.h" | 11 #include "base/sequenced_task_runner.h" |
| 11 #include "base/threading/thread_task_runner_handle.h" | 12 #include "base/threading/thread_task_runner_handle.h" |
| 12 #include "components/arc/arc_bridge_service.h" | 13 #include "components/arc/arc_bridge_service.h" |
| 13 #include "components/arc/arc_bridge_service_impl.h" | 14 #include "components/arc/arc_bridge_service_impl.h" |
| 14 #include "components/arc/audio/arc_audio_bridge.h" | 15 #include "components/arc/audio/arc_audio_bridge.h" |
| 15 #include "components/arc/bluetooth/arc_bluetooth_bridge.h" | 16 #include "components/arc/bluetooth/arc_bluetooth_bridge.h" |
| 16 #include "components/arc/boot_phase_monitor/arc_boot_phase_monitor_bridge.h" | 17 #include "components/arc/boot_phase_monitor/arc_boot_phase_monitor_bridge.h" |
| 17 #include "components/arc/clipboard/arc_clipboard_bridge.h" | 18 #include "components/arc/clipboard/arc_clipboard_bridge.h" |
| 18 #include "components/arc/crash_collector/arc_crash_collector_bridge.h" | 19 #include "components/arc/crash_collector/arc_crash_collector_bridge.h" |
| 19 #include "components/arc/ime/arc_ime_service.h" | 20 #include "components/arc/ime/arc_ime_service.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 } | 99 } |
| 99 | 100 |
| 100 void ArcServiceManager::OnPrimaryUserProfilePrepared( | 101 void ArcServiceManager::OnPrimaryUserProfilePrepared( |
| 101 const AccountId& account_id, | 102 const AccountId& account_id, |
| 102 std::unique_ptr<BooleanPrefMember> arc_enabled_pref) { | 103 std::unique_ptr<BooleanPrefMember> arc_enabled_pref) { |
| 103 DCHECK(thread_checker_.CalledOnValidThread()); | 104 DCHECK(thread_checker_.CalledOnValidThread()); |
| 104 AddService(base::MakeUnique<ArcNotificationManager>(arc_bridge_service(), | 105 AddService(base::MakeUnique<ArcNotificationManager>(arc_bridge_service(), |
| 105 account_id)); | 106 account_id)); |
| 106 } | 107 } |
| 107 | 108 |
| 109 void ArcServiceManager::AddObserver(Observer* observer) { |
| 110 observer_list_.AddObserver(observer); |
| 111 } |
| 112 |
| 113 void ArcServiceManager::RemoveObserver(Observer* observer) { |
| 114 observer_list_.RemoveObserver(observer); |
| 115 } |
| 116 |
| 117 void ArcServiceManager::OnAppsUpdated() { |
| 118 for (auto& observer : observer_list_) |
| 119 observer.OnAppsUpdated(); |
| 120 } |
| 121 |
| 108 void ArcServiceManager::Shutdown() { | 122 void ArcServiceManager::Shutdown() { |
| 109 icon_loader_ = nullptr; | 123 icon_loader_ = nullptr; |
| 110 activity_resolver_ = nullptr; | 124 activity_resolver_ = nullptr; |
| 111 services_.clear(); | 125 services_.clear(); |
| 112 arc_bridge_service_->OnShutdown(); | 126 arc_bridge_service_->OnShutdown(); |
| 113 } | 127 } |
| 114 | 128 |
| 115 // static | 129 // static |
| 116 void ArcServiceManager::SetArcBridgeServiceForTesting( | 130 void ArcServiceManager::SetArcBridgeServiceForTesting( |
| 117 std::unique_ptr<ArcBridgeService> arc_bridge_service) { | 131 std::unique_ptr<ArcBridgeService> arc_bridge_service) { |
| 118 if (g_arc_bridge_service_for_testing) { | 132 if (g_arc_bridge_service_for_testing) { |
| 119 delete g_arc_bridge_service_for_testing; | 133 delete g_arc_bridge_service_for_testing; |
| 120 } | 134 } |
| 121 g_arc_bridge_service_for_testing = arc_bridge_service.release(); | 135 g_arc_bridge_service_for_testing = arc_bridge_service.release(); |
| 122 } | 136 } |
| 123 | 137 |
| 124 } // namespace arc | 138 } // namespace arc |
| OLD | NEW |