Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(377)

Side by Side Diff: chrome/browser/chromeos/arc/boot_phase_monitor/arc_boot_phase_monitor_bridge.cc

Issue 2693013006: arc: Add cryptohome_id to EmitArcBooted. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
12 15
13 namespace arc { 16 namespace arc {
14 17
15 ArcBootPhaseMonitorBridge::ArcBootPhaseMonitorBridge( 18 ArcBootPhaseMonitorBridge::ArcBootPhaseMonitorBridge(
16 ArcBridgeService* bridge_service) 19 ArcBridgeService* bridge_service,
17 : ArcService(bridge_service), binding_(this) { 20 Profile* profile)
21 : ArcService(bridge_service),
22 profile(profile),
23 binding_(this),
24 weak_ptr_factory_(this) {
18 DCHECK(thread_checker_.CalledOnValidThread()); 25 DCHECK(thread_checker_.CalledOnValidThread());
19 arc_bridge_service()->boot_phase_monitor()->AddObserver(this); 26 arc_bridge_service()->boot_phase_monitor()->AddObserver(this);
20 } 27 }
21 28
22 ArcBootPhaseMonitorBridge::~ArcBootPhaseMonitorBridge() { 29 ArcBootPhaseMonitorBridge::~ArcBootPhaseMonitorBridge() {
23 DCHECK(thread_checker_.CalledOnValidThread()); 30 DCHECK(thread_checker_.CalledOnValidThread());
24 arc_bridge_service()->boot_phase_monitor()->RemoveObserver(this); 31 arc_bridge_service()->boot_phase_monitor()->RemoveObserver(this);
25 } 32 }
26 33
27 void ArcBootPhaseMonitorBridge::OnInstanceReady() { 34 void ArcBootPhaseMonitorBridge::OnInstanceReady() {
28 DCHECK(thread_checker_.CalledOnValidThread()); 35 DCHECK(thread_checker_.CalledOnValidThread());
29 auto* instance = ARC_GET_INSTANCE_FOR_METHOD( 36 auto* instance = ARC_GET_INSTANCE_FOR_METHOD(
30 arc_bridge_service()->boot_phase_monitor(), Init); 37 arc_bridge_service()->boot_phase_monitor(), Init);
31 DCHECK(instance); 38 DCHECK(instance);
32 instance->Init(binding_.CreateInterfacePtrAndBind()); 39 instance->Init(binding_.CreateInterfacePtrAndBind());
33 } 40 }
34 41
35 void ArcBootPhaseMonitorBridge::OnInstanceClosed() { 42 void ArcBootPhaseMonitorBridge::OnInstanceClosed() {
36 DCHECK(thread_checker_.CalledOnValidThread()); 43 DCHECK(thread_checker_.CalledOnValidThread());
37 } 44 }
38 45
39 void ArcBootPhaseMonitorBridge::OnBootCompleted() { 46 void ArcBootPhaseMonitorBridge::OnBootCompleted() {
40 DCHECK(thread_checker_.CalledOnValidThread()); 47 DCHECK(thread_checker_.CalledOnValidThread());
41 VLOG(2) << "OnBootCompleted"; 48 VLOG(2) << "OnBootCompleted";
42 49
43 chromeos::SessionManagerClient* session_manager_client = 50 chromeos::SessionManagerClient* session_manager_client =
44 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(); 51 chromeos::DBusThreadManager::Get()->GetSessionManagerClient();
45 session_manager_client->EmitArcBooted(); 52 session_manager_client->EmitArcBooted(
53 cryptohome::Identification(
54 multi_user_util::GetAccountIdFromProfile(profile)),
55 base::Bind(&ArcBootPhaseMonitorBridge::OnEmitArcBooted,
56 weak_ptr_factory_.GetWeakPtr()));
46 57
47 // Start monitoring window activation changes to prioritize/throttle the 58 // Start monitoring window activation changes to prioritize/throttle the
48 // container when needed. 59 // container when needed.
49 throttle_ = base::MakeUnique<ArcInstanceThrottle>(); 60 throttle_ = base::MakeUnique<ArcInstanceThrottle>();
50 } 61 }
51 62
63 void ArcBootPhaseMonitorBridge::OnEmitArcBooted(bool success) {
64 LOG_IF(ERROR, !success) << "Failed to emit arc booted signal.";
hidehiko 2017/02/15 18:48:09 Optional: how about VLOG on success?
Luis Héctor Chávez 2017/02/15 19:02:11 This does not touch any members, so please remove
xzhou 2017/02/16 18:34:49 Done.
xzhou 2017/02/16 18:34:49 Moved to Line 18. Done
xzhou 2017/02/16 18:34:49 Done.
xzhou 2017/02/16 18:34:49 Moved to Line 18. Done
65 }
66
52 } // namespace arc 67 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698