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 "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/sequenced_task_runner.h" | 8 #include "base/sequenced_task_runner.h" |
9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
10 #include "components/arc/arc_bridge_bootstrap.h" | 10 #include "components/arc/arc_bridge_bootstrap.h" |
11 #include "components/arc/arc_bridge_service.h" | 11 #include "components/arc/arc_bridge_service.h" |
12 #include "components/arc/arc_bridge_service_impl.h" | 12 #include "components/arc/arc_bridge_service_impl.h" |
13 #include "components/arc/audio/arc_audio_bridge.h" | 13 #include "components/arc/audio/arc_audio_bridge.h" |
14 #include "components/arc/bluetooth/arc_bluetooth_bridge.h" | 14 #include "components/arc/bluetooth/arc_bluetooth_bridge.h" |
15 #include "components/arc/clipboard/arc_clipboard_bridge.h" | 15 #include "components/arc/clipboard/arc_clipboard_bridge.h" |
16 #include "components/arc/crash_collector/arc_crash_collector_bridge.h" | 16 #include "components/arc/crash_collector/arc_crash_collector_bridge.h" |
17 #include "components/arc/ime/arc_ime_service.h" | 17 #include "components/arc/ime/arc_ime_service.h" |
18 #include "components/arc/intent_helper/activity_icon_loader.h" | 18 #include "components/arc/intent_helper/activity_icon_loader.h" |
19 #include "components/arc/intent_helper/arc_intent_helper_bridge.h" | 19 #include "components/arc/intent_helper/arc_intent_helper_bridge.h" |
20 #include "components/arc/metrics/arc_metrics_service.h" | 20 #include "components/arc/metrics/arc_metrics_service.h" |
21 #include "components/arc/net/arc_net_host_impl.h" | 21 #include "components/arc/net/arc_net_host_impl.h" |
22 #include "components/arc/obb_mounter/arc_obb_mounter_bridge.h" | 22 #include "components/arc/obb_mounter/arc_obb_mounter_bridge.h" |
23 #include "components/arc/power/arc_power_bridge.h" | 23 #include "components/arc/power/arc_power_bridge.h" |
24 #include "components/arc/storage_manager/arc_storage_manager.h" | 24 #include "components/arc/storage_manager/arc_storage_manager.h" |
| 25 #include "components/arc/user_data/arc_user_data_service.h" |
25 #include "components/arc/window_manager/arc_window_manager_bridge.h" | 26 #include "components/arc/window_manager/arc_window_manager_bridge.h" |
| 27 #include "components/prefs/pref_member.h" |
26 #include "ui/arc/notification/arc_notification_manager.h" | 28 #include "ui/arc/notification/arc_notification_manager.h" |
27 | 29 |
28 namespace arc { | 30 namespace arc { |
29 | 31 |
30 namespace { | 32 namespace { |
31 | 33 |
32 // Weak pointer. This class is owned by ChromeBrowserMainPartsChromeos. | 34 // Weak pointer. This class is owned by ChromeBrowserMainPartsChromeos. |
33 ArcServiceManager* g_arc_service_manager = nullptr; | 35 ArcServiceManager* g_arc_service_manager = nullptr; |
34 | 36 |
35 // This pointer is owned by ArcServiceManager. | 37 // This pointer is owned by ArcServiceManager. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 return arc_bridge_service_.get(); | 90 return arc_bridge_service_.get(); |
89 } | 91 } |
90 | 92 |
91 void ArcServiceManager::AddService(std::unique_ptr<ArcService> service) { | 93 void ArcServiceManager::AddService(std::unique_ptr<ArcService> service) { |
92 DCHECK(thread_checker_.CalledOnValidThread()); | 94 DCHECK(thread_checker_.CalledOnValidThread()); |
93 | 95 |
94 services_.emplace_back(std::move(service)); | 96 services_.emplace_back(std::move(service)); |
95 } | 97 } |
96 | 98 |
97 void ArcServiceManager::OnPrimaryUserProfilePrepared( | 99 void ArcServiceManager::OnPrimaryUserProfilePrepared( |
98 const AccountId& account_id) { | 100 const AccountId& account_id, |
| 101 std::unique_ptr<BooleanPrefMember> arc_enabled_pref) { |
99 DCHECK(thread_checker_.CalledOnValidThread()); | 102 DCHECK(thread_checker_.CalledOnValidThread()); |
100 | 103 |
| 104 AddService(base::WrapUnique(new ArcUserDataService( |
| 105 arc_bridge_service(), std::move(arc_enabled_pref), account_id))); |
| 106 |
101 AddService(base::WrapUnique( | 107 AddService(base::WrapUnique( |
102 new ArcNotificationManager(arc_bridge_service(), account_id))); | 108 new ArcNotificationManager(arc_bridge_service(), account_id))); |
103 } | 109 } |
104 | 110 |
105 void ArcServiceManager::OnAshStarted() { | 111 void ArcServiceManager::OnAshStarted() { |
106 DCHECK(thread_checker_.CalledOnValidThread()); | 112 DCHECK(thread_checker_.CalledOnValidThread()); |
107 // We might come here multiple times. As such we should only do this once. | 113 // We might come here multiple times. As such we should only do this once. |
108 if (on_ash_started_called_) | 114 if (on_ash_started_called_) |
109 return; | 115 return; |
110 | 116 |
(...skipping 10 matching lines...) Expand all Loading... |
121 //static | 127 //static |
122 void ArcServiceManager::SetArcBridgeServiceForTesting( | 128 void ArcServiceManager::SetArcBridgeServiceForTesting( |
123 std::unique_ptr<ArcBridgeService> arc_bridge_service) { | 129 std::unique_ptr<ArcBridgeService> arc_bridge_service) { |
124 if (g_arc_bridge_service_for_testing) { | 130 if (g_arc_bridge_service_for_testing) { |
125 delete g_arc_bridge_service_for_testing; | 131 delete g_arc_bridge_service_for_testing; |
126 } | 132 } |
127 g_arc_bridge_service_for_testing = arc_bridge_service.release(); | 133 g_arc_bridge_service_for_testing = arc_bridge_service.release(); |
128 } | 134 } |
129 | 135 |
130 } // namespace arc | 136 } // namespace arc |
OLD | NEW |