| 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/sequenced_task_runner.h" | 9 #include "base/sequenced_task_runner.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| 11 #include "components/arc/arc_bridge_bootstrap.h" | 11 #include "components/arc/arc_bridge_bootstrap.h" |
| 12 #include "components/arc/arc_bridge_service_impl.h" | 12 #include "components/arc/arc_bridge_service_impl.h" |
| 13 #include "components/arc/auth/arc_auth_service.h" | 13 #include "components/arc/auth/arc_auth_service.h" |
| 14 #include "components/arc/clipboard/arc_clipboard_bridge.h" | 14 #include "components/arc/clipboard/arc_clipboard_bridge.h" |
| 15 #include "components/arc/input/arc_input_bridge.h" | 15 #include "components/arc/input/arc_input_bridge.h" |
| 16 #include "components/arc/intent_helper/arc_intent_helper_bridge.h" |
| 16 #include "components/arc/power/arc_power_bridge.h" | 17 #include "components/arc/power/arc_power_bridge.h" |
| 17 #include "components/arc/settings/arc_settings_bridge.h" | 18 #include "components/arc/settings/arc_settings_bridge.h" |
| 18 #include "components/arc/video/arc_video_bridge.h" | 19 #include "components/arc/video/arc_video_bridge.h" |
| 19 #include "ui/arc/notification/arc_notification_manager.h" | 20 #include "ui/arc/notification/arc_notification_manager.h" |
| 20 | 21 |
| 21 namespace arc { | 22 namespace arc { |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| 24 | 25 |
| 25 // Weak pointer. This class is owned by ChromeBrowserMainPartsChromeos. | 26 // Weak pointer. This class is owned by ChromeBrowserMainPartsChromeos. |
| 26 ArcServiceManager* g_arc_service_manager = nullptr; | 27 ArcServiceManager* g_arc_service_manager = nullptr; |
| 27 | 28 |
| 28 } // namespace | 29 } // namespace |
| 29 | 30 |
| 30 ArcServiceManager::ArcServiceManager( | 31 ArcServiceManager::ArcServiceManager( |
| 31 scoped_ptr<ArcAuthService> auth_service, | 32 scoped_ptr<ArcAuthService> auth_service, |
| 33 scoped_ptr<ArcIntentHelperBridge> intent_helper_bridge, |
| 32 scoped_ptr<ArcSettingsBridge> settings_bridge, | 34 scoped_ptr<ArcSettingsBridge> settings_bridge, |
| 33 scoped_ptr<ArcVideoBridge> video_bridge) | 35 scoped_ptr<ArcVideoBridge> video_bridge) |
| 34 : arc_bridge_service_( | 36 : arc_bridge_service_( |
| 35 new ArcBridgeServiceImpl(ArcBridgeBootstrap::Create())), | 37 new ArcBridgeServiceImpl(ArcBridgeBootstrap::Create())), |
| 36 arc_auth_service_(std::move(auth_service)), | 38 arc_auth_service_(std::move(auth_service)), |
| 37 arc_clipboard_bridge_(new ArcClipboardBridge(arc_bridge_service_.get())), | 39 arc_clipboard_bridge_(new ArcClipboardBridge(arc_bridge_service_.get())), |
| 38 arc_input_bridge_(ArcInputBridge::Create(arc_bridge_service_.get())), | 40 arc_input_bridge_(ArcInputBridge::Create(arc_bridge_service_.get())), |
| 41 arc_intent_helper_bridge_(std::move(intent_helper_bridge)), |
| 39 arc_settings_bridge_(std::move(settings_bridge)), | 42 arc_settings_bridge_(std::move(settings_bridge)), |
| 40 arc_power_bridge_(new ArcPowerBridge(arc_bridge_service_.get())), | 43 arc_power_bridge_(new ArcPowerBridge(arc_bridge_service_.get())), |
| 41 arc_video_bridge_(std::move(video_bridge)) { | 44 arc_video_bridge_(std::move(video_bridge)) { |
| 42 DCHECK(!g_arc_service_manager); | 45 DCHECK(!g_arc_service_manager); |
| 43 g_arc_service_manager = this; | 46 g_arc_service_manager = this; |
| 44 | 47 |
| 45 arc_settings_bridge_->StartObservingBridgeServiceChanges(); | 48 arc_settings_bridge_->StartObservingBridgeServiceChanges(); |
| 46 arc_auth_service_->StartObservingBridgeServiceChanges(); | 49 arc_auth_service_->StartObservingBridgeServiceChanges(); |
| 50 arc_intent_helper_bridge_->StartObservingBridgeServiceChanges(); |
| 47 arc_video_bridge_->StartObservingBridgeServiceChanges(); | 51 arc_video_bridge_->StartObservingBridgeServiceChanges(); |
| 48 } | 52 } |
| 49 | 53 |
| 50 ArcServiceManager::~ArcServiceManager() { | 54 ArcServiceManager::~ArcServiceManager() { |
| 51 DCHECK(thread_checker_.CalledOnValidThread()); | 55 DCHECK(thread_checker_.CalledOnValidThread()); |
| 52 DCHECK(g_arc_service_manager == this); | 56 DCHECK(g_arc_service_manager == this); |
| 53 g_arc_service_manager = nullptr; | 57 g_arc_service_manager = nullptr; |
| 54 } | 58 } |
| 55 | 59 |
| 56 // static | 60 // static |
| (...skipping 10 matching lines...) Expand all Loading... |
| 67 | 71 |
| 68 void ArcServiceManager::OnPrimaryUserProfilePrepared( | 72 void ArcServiceManager::OnPrimaryUserProfilePrepared( |
| 69 const AccountId& account_id) { | 73 const AccountId& account_id) { |
| 70 DCHECK(thread_checker_.CalledOnValidThread()); | 74 DCHECK(thread_checker_.CalledOnValidThread()); |
| 71 | 75 |
| 72 arc_notification_manager_.reset( | 76 arc_notification_manager_.reset( |
| 73 new ArcNotificationManager(arc_bridge_service(), account_id)); | 77 new ArcNotificationManager(arc_bridge_service(), account_id)); |
| 74 } | 78 } |
| 75 | 79 |
| 76 } // namespace arc | 80 } // namespace arc |
| OLD | NEW |