| 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" |
| 11 #include "base/threading/thread_task_runner_handle.h" | 11 #include "base/threading/thread_task_runner_handle.h" |
| 12 #include "components/arc/arc_bridge_bootstrap.h" | 12 #include "components/arc/arc_bridge_bootstrap.h" |
| 13 #include "components/arc/arc_bridge_service.h" | 13 #include "components/arc/arc_bridge_service.h" |
| 14 #include "components/arc/arc_bridge_service_impl.h" | 14 #include "components/arc/arc_bridge_service_impl.h" |
| 15 #include "components/arc/audio/arc_audio_bridge.h" | 15 #include "components/arc/audio/arc_audio_bridge.h" |
| 16 #include "components/arc/bluetooth/arc_bluetooth_bridge.h" | 16 #include "components/arc/bluetooth/arc_bluetooth_bridge.h" |
| 17 #include "components/arc/clipboard/arc_clipboard_bridge.h" | 17 #include "components/arc/clipboard/arc_clipboard_bridge.h" |
| 18 #include "components/arc/crash_collector/arc_crash_collector_bridge.h" | 18 #include "components/arc/crash_collector/arc_crash_collector_bridge.h" |
| 19 #include "components/arc/ime/arc_ime_service.h" | 19 #include "components/arc/ime/arc_ime_service.h" |
| 20 #include "components/arc/intent_helper/activity_icon_loader.h" | 20 #include "components/arc/intent_helper/activity_icon_loader.h" |
| 21 #include "components/arc/metrics/arc_metrics_service.h" | 21 #include "components/arc/metrics/arc_metrics_service.h" |
| 22 #include "components/arc/net/arc_net_host_impl.h" | 22 #include "components/arc/net/arc_net_host_impl.h" |
| 23 #include "components/arc/obb_mounter/arc_obb_mounter_bridge.h" | 23 #include "components/arc/obb_mounter/arc_obb_mounter_bridge.h" |
| 24 #include "components/arc/power/arc_power_bridge.h" | 24 #include "components/arc/power/arc_power_bridge.h" |
| 25 #include "components/arc/storage_manager/arc_storage_manager.h" | 25 #include "components/arc/storage_manager/arc_storage_manager.h" |
| 26 #include "components/arc/user_data/arc_user_data_service.h" | |
| 27 #include "components/prefs/pref_member.h" | |
| 28 #include "ui/arc/notification/arc_notification_manager.h" | 26 #include "ui/arc/notification/arc_notification_manager.h" |
| 29 | 27 |
| 30 namespace arc { | 28 namespace arc { |
| 31 | 29 |
| 32 namespace { | 30 namespace { |
| 33 | 31 |
| 34 // Weak pointer. This class is owned by ChromeBrowserMainPartsChromeos. | 32 // Weak pointer. This class is owned by ChromeBrowserMainPartsChromeos. |
| 35 ArcServiceManager* g_arc_service_manager = nullptr; | 33 ArcServiceManager* g_arc_service_manager = nullptr; |
| 36 | 34 |
| 37 // This pointer is owned by ArcServiceManager. | 35 // This pointer is owned by ArcServiceManager. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 return arc_bridge_service_.get(); | 87 return arc_bridge_service_.get(); |
| 90 } | 88 } |
| 91 | 89 |
| 92 void ArcServiceManager::AddService(std::unique_ptr<ArcService> service) { | 90 void ArcServiceManager::AddService(std::unique_ptr<ArcService> service) { |
| 93 DCHECK(thread_checker_.CalledOnValidThread()); | 91 DCHECK(thread_checker_.CalledOnValidThread()); |
| 94 | 92 |
| 95 services_.emplace_back(std::move(service)); | 93 services_.emplace_back(std::move(service)); |
| 96 } | 94 } |
| 97 | 95 |
| 98 void ArcServiceManager::OnPrimaryUserProfilePrepared( | 96 void ArcServiceManager::OnPrimaryUserProfilePrepared( |
| 99 const AccountId& account_id, | 97 const AccountId& account_id) { |
| 100 std::unique_ptr<BooleanPrefMember> arc_enabled_pref) { | |
| 101 DCHECK(thread_checker_.CalledOnValidThread()); | 98 DCHECK(thread_checker_.CalledOnValidThread()); |
| 102 | 99 |
| 103 AddService(base::WrapUnique(new ArcUserDataService( | |
| 104 arc_bridge_service(), std::move(arc_enabled_pref), account_id))); | |
| 105 | |
| 106 AddService(base::WrapUnique( | 100 AddService(base::WrapUnique( |
| 107 new ArcNotificationManager(arc_bridge_service(), account_id))); | 101 new ArcNotificationManager(arc_bridge_service(), account_id))); |
| 108 } | 102 } |
| 109 | 103 |
| 110 void ArcServiceManager::Shutdown() { | 104 void ArcServiceManager::Shutdown() { |
| 111 icon_loader_ = nullptr; | 105 icon_loader_ = nullptr; |
| 112 activity_resolver_ = nullptr; | 106 activity_resolver_ = nullptr; |
| 113 services_.clear(); | 107 services_.clear(); |
| 114 } | 108 } |
| 115 | 109 |
| 116 // static | 110 // static |
| 117 void ArcServiceManager::SetArcBridgeServiceForTesting( | 111 void ArcServiceManager::SetArcBridgeServiceForTesting( |
| 118 std::unique_ptr<ArcBridgeService> arc_bridge_service) { | 112 std::unique_ptr<ArcBridgeService> arc_bridge_service) { |
| 119 if (g_arc_bridge_service_for_testing) { | 113 if (g_arc_bridge_service_for_testing) { |
| 120 delete g_arc_bridge_service_for_testing; | 114 delete g_arc_bridge_service_for_testing; |
| 121 } | 115 } |
| 122 g_arc_bridge_service_for_testing = arc_bridge_service.release(); | 116 g_arc_bridge_service_for_testing = arc_bridge_service.release(); |
| 123 } | 117 } |
| 124 | 118 |
| 125 } // namespace arc | 119 } // namespace arc |
| OLD | NEW |