| 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 |
| 101 AddService(base::WrapUnique( | 105 AddService(base::WrapUnique( |
| 102 new ArcNotificationManager(arc_bridge_service(), account_id))); | 106 new ArcNotificationManager(arc_bridge_service(), account_id))); |
| 103 } | 107 } |
| 104 | 108 |
| 105 void ArcServiceManager::OnAshStarted() { | 109 void ArcServiceManager::OnAshStarted() { |
| 106 DCHECK(thread_checker_.CalledOnValidThread()); | 110 DCHECK(thread_checker_.CalledOnValidThread()); |
| 107 // 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. |
| 108 if (on_ash_started_called_) | 112 if (on_ash_started_called_) |
| 109 return; | 113 return; |
| 110 | 114 |
| 111 on_ash_started_called_ = true; | 115 on_ash_started_called_ = true; |
| 112 AddService( | 116 AddService( |
| 113 base::WrapUnique(new ArcWindowManagerBridge(arc_bridge_service()))); | 117 base::WrapUnique(new ArcWindowManagerBridge(arc_bridge_service()))); |
| 114 } | 118 } |
| 115 | 119 |
| 116 void ArcServiceManager::Shutdown() { | 120 void ArcServiceManager::Shutdown() { |
| 117 icon_loader_ = nullptr; | 121 icon_loader_ = nullptr; |
| 118 activity_resolver_ = nullptr; | 122 activity_resolver_ = nullptr; |
| 123 arc_user_data_service_ = nullptr; |
| 119 services_.clear(); | 124 services_.clear(); |
| 120 } | 125 } |
| 121 | 126 |
| 122 //static | 127 //static |
| 123 void ArcServiceManager::SetArcBridgeServiceForTesting( | 128 void ArcServiceManager::SetArcBridgeServiceForTesting( |
| 124 std::unique_ptr<ArcBridgeService> arc_bridge_service) { | 129 std::unique_ptr<ArcBridgeService> arc_bridge_service) { |
| 125 if (g_arc_bridge_service_for_testing) { | 130 if (g_arc_bridge_service_for_testing) { |
| 126 delete g_arc_bridge_service_for_testing; | 131 delete g_arc_bridge_service_for_testing; |
| 127 } | 132 } |
| 128 g_arc_bridge_service_for_testing = arc_bridge_service.release(); | 133 g_arc_bridge_service_for_testing = arc_bridge_service.release(); |
| 129 } | 134 } |
| 130 | 135 |
| 131 } // namespace arc | 136 } // namespace arc |
| OLD | NEW |