OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/chromeos/arc/arc_service_launcher.h" |
| 6 |
| 7 #include "base/bind.h" |
| 8 #include "chrome/browser/chromeos/arc/arc_auth_service.h" |
| 9 #include "chrome/browser/chromeos/arc/arc_intent_helper_bridge.h" |
| 10 #include "chromeos/dbus/dbus_thread_manager.h" |
| 11 #include "chromeos/dbus/session_manager_client.h" |
| 12 #include "components/arc/arc_bridge_service.h" |
| 13 |
| 14 namespace arc { |
| 15 |
| 16 ArcServiceLauncher::ArcServiceLauncher() : weak_factory_(this) {} |
| 17 |
| 18 ArcServiceLauncher::~ArcServiceLauncher() {} |
| 19 |
| 20 void ArcServiceLauncher::Initialize() { |
| 21 // Create ARC service manager. |
| 22 arc_service_manager_.reset(new ArcServiceManager()); |
| 23 arc_service_manager_->AddService(make_scoped_ptr( |
| 24 new ArcAuthService(arc_service_manager_->arc_bridge_service()))); |
| 25 arc_service_manager_->AddService(make_scoped_ptr( |
| 26 new ArcIntentHelperBridge(arc_service_manager_->arc_bridge_service()))); |
| 27 |
| 28 // Detect availiability. |
| 29 chromeos::SessionManagerClient* session_manager_client = |
| 30 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(); |
| 31 session_manager_client->CheckArcAvailability(base::Bind( |
| 32 &ArcServiceLauncher::OnArcAvailable, weak_factory_.GetWeakPtr())); |
| 33 } |
| 34 |
| 35 void ArcServiceLauncher::Shutdown() { |
| 36 DCHECK(arc_service_manager_); |
| 37 arc_service_manager_->arc_bridge_service()->Shutdown(); |
| 38 } |
| 39 |
| 40 void ArcServiceLauncher::OnArcAvailable(bool arc_available) { |
| 41 arc_service_manager_->arc_bridge_service()->SetDetectedAvailability( |
| 42 arc_available); |
| 43 } |
| 44 |
| 45 } // namespace arc |
OLD | NEW |