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" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 DCHECK(thread_checker_.CalledOnValidThread()); | 92 DCHECK(thread_checker_.CalledOnValidThread()); |
93 | 93 |
94 services_.emplace_back(std::move(service)); | 94 services_.emplace_back(std::move(service)); |
95 } | 95 } |
96 | 96 |
97 void ArcServiceManager::OnPrimaryUserProfilePrepared( | 97 void ArcServiceManager::OnPrimaryUserProfilePrepared( |
98 const AccountId& account_id, | 98 const AccountId& account_id, |
99 std::unique_ptr<BooleanPrefMember> arc_enabled_pref) { | 99 std::unique_ptr<BooleanPrefMember> arc_enabled_pref) { |
100 DCHECK(thread_checker_.CalledOnValidThread()); | 100 DCHECK(thread_checker_.CalledOnValidThread()); |
101 | 101 |
102 AddService(base::WrapUnique(new ArcUserDataService( | 102 arc_user_data_service_.reset(new ArcUserDataService(arc_bridge_service(), |
103 arc_bridge_service(), std::move(arc_enabled_pref), account_id))); | 103 std::move(arc_enabled_pref), account_id)); |
104 | 104 |
105 AddService(base::WrapUnique( | 105 AddService(base::WrapUnique( |
106 new ArcNotificationManager(arc_bridge_service(), account_id))); | 106 new ArcNotificationManager(arc_bridge_service(), account_id))); |
107 } | 107 } |
108 | 108 |
109 void ArcServiceManager::OnAshStarted() { | 109 void ArcServiceManager::OnAshStarted() { |
110 DCHECK(thread_checker_.CalledOnValidThread()); | 110 DCHECK(thread_checker_.CalledOnValidThread()); |
111 // We might come here multiple times. As such we should only do this once. | 111 // We might come here multiple times. As such we should only do this once. |
112 if (on_ash_started_called_) | 112 if (on_ash_started_called_) |
113 return; | 113 return; |
114 | 114 |
115 on_ash_started_called_ = true; | 115 on_ash_started_called_ = true; |
116 AddService( | 116 AddService( |
117 base::WrapUnique(new ArcWindowManagerBridge(arc_bridge_service()))); | 117 base::WrapUnique(new ArcWindowManagerBridge(arc_bridge_service()))); |
118 } | 118 } |
119 | 119 |
120 void ArcServiceManager::Shutdown() { | 120 void ArcServiceManager::Shutdown() { |
121 icon_loader_ = nullptr; | 121 icon_loader_ = nullptr; |
122 activity_resolver_ = nullptr; | 122 activity_resolver_ = nullptr; |
| 123 arc_user_data_service_ = nullptr; |
123 services_.clear(); | 124 services_.clear(); |
124 } | 125 } |
125 | 126 |
126 //static | 127 //static |
127 void ArcServiceManager::SetArcBridgeServiceForTesting( | 128 void ArcServiceManager::SetArcBridgeServiceForTesting( |
128 std::unique_ptr<ArcBridgeService> arc_bridge_service) { | 129 std::unique_ptr<ArcBridgeService> arc_bridge_service) { |
129 if (g_arc_bridge_service_for_testing) { | 130 if (g_arc_bridge_service_for_testing) { |
130 delete g_arc_bridge_service_for_testing; | 131 delete g_arc_bridge_service_for_testing; |
131 } | 132 } |
132 g_arc_bridge_service_for_testing = arc_bridge_service.release(); | 133 g_arc_bridge_service_for_testing = arc_bridge_service.release(); |
133 } | 134 } |
134 | 135 |
135 } // namespace arc | 136 } // namespace arc |
OLD | NEW |