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

Side by Side Diff: chrome/browser/chromeos/power/power_button_observer.cc

Issue 2070053003: Remove logging added for debugging the lockscreen crashes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Remove unneeded information Created 4 years, 6 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/power/power_button_observer.h" 5 #include "chrome/browser/chromeos/power/power_button_observer.h"
6 6
7 #include "ash/common/system/tray/system_tray_delegate.h" 7 #include "ash/common/system/tray/system_tray_delegate.h"
8 #include "ash/common/wm_shell.h" 8 #include "ash/common/wm_shell.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/system/user/login_status.h" 10 #include "ash/system/user/login_status.h"
(...skipping 16 matching lines...) Expand all
27 ash::LoginStatus GetCurrentLoginStatus() { 27 ash::LoginStatus GetCurrentLoginStatus() {
28 if (ash::WmShell::Get()->system_tray_delegate()) 28 if (ash::WmShell::Get()->system_tray_delegate())
29 return ash::WmShell::Get()->system_tray_delegate()->GetUserLoginStatus(); 29 return ash::WmShell::Get()->system_tray_delegate()->GetUserLoginStatus();
30 30
31 return ash::LoginStatus::NOT_LOGGED_IN; 31 return ash::LoginStatus::NOT_LOGGED_IN;
32 } 32 }
33 33
34 } // namespace 34 } // namespace
35 35
36 PowerButtonObserver::PowerButtonObserver() { 36 PowerButtonObserver::PowerButtonObserver() {
37 // TODO: Remove after resolving crbug.com/452599.
38 VLOG(0) << "Creating PowerButtonObserver " << this;
39
40 ash::Shell::GetInstance()->lock_state_controller()->SetDelegate( 37 ash::Shell::GetInstance()->lock_state_controller()->SetDelegate(
41 std::unique_ptr<ash::LockStateControllerDelegate>( 38 std::unique_ptr<ash::LockStateControllerDelegate>(
42 new SessionStateControllerDelegateChromeos)); 39 new SessionStateControllerDelegateChromeos));
43 40
44 registrar_.Add( 41 registrar_.Add(
45 this, 42 this,
46 chrome::NOTIFICATION_LOGIN_USER_CHANGED, 43 chrome::NOTIFICATION_LOGIN_USER_CHANGED,
47 content::NotificationService::AllSources()); 44 content::NotificationService::AllSources());
48 registrar_.Add( 45 registrar_.Add(
49 this, 46 this,
50 chrome::NOTIFICATION_APP_TERMINATING, 47 chrome::NOTIFICATION_APP_TERMINATING,
51 content::NotificationService::AllSources()); 48 content::NotificationService::AllSources());
52 registrar_.Add( 49 registrar_.Add(
53 this, 50 this,
54 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, 51 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED,
55 content::NotificationService::AllSources()); 52 content::NotificationService::AllSources());
56 53
57 DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this); 54 DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this);
58 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this); 55 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this);
59 56
60 // Tell the controller about the initial state. 57 // Tell the controller about the initial state.
61 ash::Shell::GetInstance()->OnLoginStateChanged(GetCurrentLoginStatus()); 58 ash::Shell::GetInstance()->OnLoginStateChanged(GetCurrentLoginStatus());
62 59
63 const ScreenLocker* locker = ScreenLocker::default_screen_locker(); 60 const ScreenLocker* locker = ScreenLocker::default_screen_locker();
64 bool locked = locker && locker->locked(); 61 bool locked = locker && locker->locked();
65 ash::Shell::GetInstance()->OnLockStateChanged(locked); 62 ash::Shell::GetInstance()->OnLockStateChanged(locked);
66 } 63 }
67 64
68 PowerButtonObserver::~PowerButtonObserver() { 65 PowerButtonObserver::~PowerButtonObserver() {
69 // TODO: Remove after resolving crbug.com/452599.
70 VLOG(0) << "Destroying PowerButtonObserver " << this;
71
72 DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this); 66 DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this);
73 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); 67 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this);
74 } 68 }
75 69
76 void PowerButtonObserver::Observe(int type, 70 void PowerButtonObserver::Observe(int type,
77 const content::NotificationSource& source, 71 const content::NotificationSource& source,
78 const content::NotificationDetails& details) { 72 const content::NotificationDetails& details) {
79 switch (type) { 73 switch (type) {
80 case chrome::NOTIFICATION_LOGIN_USER_CHANGED: { 74 case chrome::NOTIFICATION_LOGIN_USER_CHANGED: {
81 ash::Shell::GetInstance()->OnLoginStateChanged(GetCurrentLoginStatus()); 75 ash::Shell::GetInstance()->OnLoginStateChanged(GetCurrentLoginStatus());
82 break; 76 break;
83 } 77 }
84 case chrome::NOTIFICATION_APP_TERMINATING: 78 case chrome::NOTIFICATION_APP_TERMINATING:
85 ash::Shell::GetInstance()->OnAppTerminating(); 79 ash::Shell::GetInstance()->OnAppTerminating();
86 break; 80 break;
87 case chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED: { 81 case chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED: {
88 // TODO(jdufault): Remove after resolving crbug.com/452599.
89 VLOG(0) << "PowerButtonObserver " << this
90 << "calling ash::Shell OnLockStateChanged";
91 bool locked = *content::Details<bool>(details).ptr(); 82 bool locked = *content::Details<bool>(details).ptr();
92 ash::Shell::GetInstance()->OnLockStateChanged(locked); 83 ash::Shell::GetInstance()->OnLockStateChanged(locked);
93 break; 84 break;
94 } 85 }
95 default: 86 default:
96 NOTREACHED() << "Unexpected notification " << type; 87 NOTREACHED() << "Unexpected notification " << type;
97 } 88 }
98 } 89 }
99 90
100 void PowerButtonObserver::PowerButtonEventReceived( 91 void PowerButtonObserver::PowerButtonEventReceived(
101 bool down, const base::TimeTicks& timestamp) { 92 bool down, const base::TimeTicks& timestamp) {
102 ash::Shell::GetInstance()->power_button_controller()-> 93 ash::Shell::GetInstance()->power_button_controller()->
103 OnPowerButtonEvent(down, timestamp); 94 OnPowerButtonEvent(down, timestamp);
104 } 95 }
105 96
106 } // namespace chromeos 97 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698