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