OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 "chrome/browser/chromeos/arc/boot_phase_monitor/arc_boot_phase_monitor_ bridge.h" | 5 #include "chrome/browser/chromeos/arc/boot_phase_monitor/arc_boot_phase_monitor_ bridge.h" |
6 | 6 |
7 #include "base/bind.h" | |
7 #include "base/logging.h" | 8 #include "base/logging.h" |
8 #include "chrome/browser/chromeos/arc/boot_phase_monitor/arc_instance_throttle.h " | 9 #include "chrome/browser/chromeos/arc/boot_phase_monitor/arc_instance_throttle.h " |
10 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | |
11 #include "chromeos/cryptohome/cryptohome_parameters.h" | |
9 #include "chromeos/dbus/dbus_thread_manager.h" | 12 #include "chromeos/dbus/dbus_thread_manager.h" |
10 #include "chromeos/dbus/session_manager_client.h" | 13 #include "chromeos/dbus/session_manager_client.h" |
11 #include "components/arc/arc_bridge_service.h" | 14 #include "components/arc/arc_bridge_service.h" |
15 #include "components/signin/core/account_id/account_id.h" | |
Yusuke Sato
2017/02/16 18:42:58
remove. you already did it in .h (and not using fo
xzhou
2017/02/16 20:17:32
Done. Thanks for the link.
| |
16 | |
17 namespace { | |
18 void OnEmitArcBooted(bool success) { | |
Yusuke Sato
2017/02/16 18:42:58
space between L17/L18
xzhou
2017/02/16 20:17:31
Done.
| |
19 if (!success) | |
20 VLOG(1) << "Failed to emit arc booted signal."; | |
21 } | |
Yusuke Sato
2017/02/16 18:42:58
same as above
xzhou
2017/02/16 20:17:32
Done.
| |
22 } | |
Yusuke Sato
2017/02/16 18:42:58
} // namespace
xzhou
2017/02/16 20:17:31
Done.
| |
12 | 23 |
13 namespace arc { | 24 namespace arc { |
14 | 25 |
15 ArcBootPhaseMonitorBridge::ArcBootPhaseMonitorBridge( | 26 ArcBootPhaseMonitorBridge::ArcBootPhaseMonitorBridge( |
16 ArcBridgeService* bridge_service) | 27 ArcBridgeService* bridge_service, |
17 : ArcService(bridge_service), binding_(this) { | 28 const AccountId& account_id) |
29 : ArcService(bridge_service), account_id_(account_id), binding_(this) { | |
18 DCHECK(thread_checker_.CalledOnValidThread()); | 30 DCHECK(thread_checker_.CalledOnValidThread()); |
19 arc_bridge_service()->boot_phase_monitor()->AddObserver(this); | 31 arc_bridge_service()->boot_phase_monitor()->AddObserver(this); |
20 } | 32 } |
21 | 33 |
22 ArcBootPhaseMonitorBridge::~ArcBootPhaseMonitorBridge() { | 34 ArcBootPhaseMonitorBridge::~ArcBootPhaseMonitorBridge() { |
23 DCHECK(thread_checker_.CalledOnValidThread()); | 35 DCHECK(thread_checker_.CalledOnValidThread()); |
24 arc_bridge_service()->boot_phase_monitor()->RemoveObserver(this); | 36 arc_bridge_service()->boot_phase_monitor()->RemoveObserver(this); |
25 } | 37 } |
26 | 38 |
27 void ArcBootPhaseMonitorBridge::OnInstanceReady() { | 39 void ArcBootPhaseMonitorBridge::OnInstanceReady() { |
28 DCHECK(thread_checker_.CalledOnValidThread()); | 40 DCHECK(thread_checker_.CalledOnValidThread()); |
29 auto* instance = ARC_GET_INSTANCE_FOR_METHOD( | 41 auto* instance = ARC_GET_INSTANCE_FOR_METHOD( |
30 arc_bridge_service()->boot_phase_monitor(), Init); | 42 arc_bridge_service()->boot_phase_monitor(), Init); |
31 DCHECK(instance); | 43 DCHECK(instance); |
32 instance->Init(binding_.CreateInterfacePtrAndBind()); | 44 instance->Init(binding_.CreateInterfacePtrAndBind()); |
33 } | 45 } |
34 | 46 |
35 void ArcBootPhaseMonitorBridge::OnInstanceClosed() { | 47 void ArcBootPhaseMonitorBridge::OnInstanceClosed() { |
36 DCHECK(thread_checker_.CalledOnValidThread()); | 48 DCHECK(thread_checker_.CalledOnValidThread()); |
37 } | 49 } |
38 | 50 |
39 void ArcBootPhaseMonitorBridge::OnBootCompleted() { | 51 void ArcBootPhaseMonitorBridge::OnBootCompleted() { |
40 DCHECK(thread_checker_.CalledOnValidThread()); | 52 DCHECK(thread_checker_.CalledOnValidThread()); |
41 VLOG(2) << "OnBootCompleted"; | 53 VLOG(2) << "OnBootCompleted"; |
42 | 54 |
43 chromeos::SessionManagerClient* session_manager_client = | 55 chromeos::SessionManagerClient* session_manager_client = |
44 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(); | 56 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(); |
45 session_manager_client->EmitArcBooted(); | 57 session_manager_client->EmitArcBooted(cryptohome::Identification(account_id_), |
58 base::Bind(&OnEmitArcBooted)); | |
46 | 59 |
47 // Start monitoring window activation changes to prioritize/throttle the | 60 // Start monitoring window activation changes to prioritize/throttle the |
48 // container when needed. | 61 // container when needed. |
49 throttle_ = base::MakeUnique<ArcInstanceThrottle>(); | 62 throttle_ = base::MakeUnique<ArcInstanceThrottle>(); |
50 } | 63 } |
51 | |
52 } // namespace arc | 64 } // namespace arc |
OLD | NEW |