| 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" | 26 #include "components/prefs/pref_member.h" |
| 28 #include "ui/arc/notification/arc_notification_manager.h" | 27 #include "ui/arc/notification/arc_notification_manager.h" |
| 29 | 28 |
| 30 namespace arc { | 29 namespace arc { |
| 31 | 30 |
| 32 namespace { | 31 namespace { |
| 33 | 32 |
| 34 // Weak pointer. This class is owned by ChromeBrowserMainPartsChromeos. | 33 // Weak pointer. This class is owned by ChromeBrowserMainPartsChromeos. |
| 35 ArcServiceManager* g_arc_service_manager = nullptr; | 34 ArcServiceManager* g_arc_service_manager = nullptr; |
| 36 | 35 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 DCHECK(thread_checker_.CalledOnValidThread()); | 92 DCHECK(thread_checker_.CalledOnValidThread()); |
| 94 | 93 |
| 95 services_.emplace_back(std::move(service)); | 94 services_.emplace_back(std::move(service)); |
| 96 } | 95 } |
| 97 | 96 |
| 98 void ArcServiceManager::OnPrimaryUserProfilePrepared( | 97 void ArcServiceManager::OnPrimaryUserProfilePrepared( |
| 99 const AccountId& account_id, | 98 const AccountId& account_id, |
| 100 std::unique_ptr<BooleanPrefMember> arc_enabled_pref) { | 99 std::unique_ptr<BooleanPrefMember> arc_enabled_pref) { |
| 101 DCHECK(thread_checker_.CalledOnValidThread()); | 100 DCHECK(thread_checker_.CalledOnValidThread()); |
| 102 | 101 |
| 103 AddService(base::WrapUnique(new ArcUserDataService( | |
| 104 arc_bridge_service(), std::move(arc_enabled_pref), account_id))); | |
| 105 | |
| 106 AddService(base::WrapUnique( | 102 AddService(base::WrapUnique( |
| 107 new ArcNotificationManager(arc_bridge_service(), account_id))); | 103 new ArcNotificationManager(arc_bridge_service(), account_id))); |
| 108 } | 104 } |
| 109 | 105 |
| 110 void ArcServiceManager::Shutdown() { | 106 void ArcServiceManager::Shutdown() { |
| 111 icon_loader_ = nullptr; | 107 icon_loader_ = nullptr; |
| 112 activity_resolver_ = nullptr; | 108 activity_resolver_ = nullptr; |
| 113 services_.clear(); | 109 services_.clear(); |
| 114 } | 110 } |
| 115 | 111 |
| 116 // static | 112 // static |
| 117 void ArcServiceManager::SetArcBridgeServiceForTesting( | 113 void ArcServiceManager::SetArcBridgeServiceForTesting( |
| 118 std::unique_ptr<ArcBridgeService> arc_bridge_service) { | 114 std::unique_ptr<ArcBridgeService> arc_bridge_service) { |
| 119 if (g_arc_bridge_service_for_testing) { | 115 if (g_arc_bridge_service_for_testing) { |
| 120 delete g_arc_bridge_service_for_testing; | 116 delete g_arc_bridge_service_for_testing; |
| 121 } | 117 } |
| 122 g_arc_bridge_service_for_testing = arc_bridge_service.release(); | 118 g_arc_bridge_service_for_testing = arc_bridge_service.release(); |
| 123 } | 119 } |
| 124 | 120 |
| 125 } // namespace arc | 121 } // namespace arc |
| OLD | NEW |