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

Side by Side Diff: chrome/browser/chromeos/accessibility/system_event_observer.cc

Issue 8664014: chromeos: move screen lock handling to power manager client (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebased Created 9 years 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/accessibility/system_event_observer.h" 5 #include "chrome/browser/chromeos/accessibility/system_event_observer.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/accessibility/accessibility_events.h" 8 #include "chrome/browser/accessibility/accessibility_events.h"
9 #include "chrome/browser/chromeos/cros/cros_library.h"
10 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" 9 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h"
11 #include "chrome/browser/profiles/profile_manager.h" 10 #include "chrome/browser/profiles/profile_manager.h"
12 #include "chrome/common/chrome_notification_types.h" 11 #include "chrome/common/chrome_notification_types.h"
13 12
14 namespace chromeos { 13 namespace chromeos {
15 namespace accessibility { 14 namespace accessibility {
16 15
17 namespace { 16 namespace {
18 17
19 SystemEventObserver* g_system_event_observer = NULL; 18 SystemEventObserver* g_system_event_observer = NULL;
20 19
21 } 20 }
22 21
23 SystemEventObserver::SystemEventObserver() { 22 SystemEventObserver::SystemEventObserver() {
24 CrosLibrary::Get()->GetScreenLockLibrary()->AddObserver(this);
25 } 23 }
26 24
27 SystemEventObserver::~SystemEventObserver() { 25 SystemEventObserver::~SystemEventObserver() {
28 CrosLibrary::Get()->GetScreenLockLibrary()->RemoveObserver(this);
29 } 26 }
30 27
31 void SystemEventObserver::SystemResumed() { 28 void SystemEventObserver::SystemResumed() {
32 Profile* profile = ProfileManager::GetDefaultProfile(); 29 Profile* profile = ProfileManager::GetDefaultProfile();
33 WokeUpEventInfo info(profile); 30 WokeUpEventInfo info(profile);
34 SendAccessibilityNotification( 31 SendAccessibilityNotification(
35 chrome::NOTIFICATION_ACCESSIBILITY_WOKE_UP, &info); 32 chrome::NOTIFICATION_ACCESSIBILITY_WOKE_UP, &info);
36 } 33 }
37 34
38 void SystemEventObserver::LockScreen(ScreenLockLibrary* screen_lock_library) { 35 void SystemEventObserver::LockScreen() {}
39 }
40 36
41 void SystemEventObserver::UnlockScreen(ScreenLockLibrary* screen_lock_library) { 37 void SystemEventObserver::UnlockScreen() {
42 Profile* profile = ProfileManager::GetDefaultProfile(); 38 Profile* profile = ProfileManager::GetDefaultProfile();
43 ScreenUnlockedEventInfo info(profile); 39 ScreenUnlockedEventInfo info(profile);
44 SendAccessibilityNotification( 40 SendAccessibilityNotification(
45 chrome::NOTIFICATION_ACCESSIBILITY_SCREEN_UNLOCKED, &info); 41 chrome::NOTIFICATION_ACCESSIBILITY_SCREEN_UNLOCKED, &info);
46 } 42 }
47 43
48 void SystemEventObserver::UnlockScreenFailed( 44 void SystemEventObserver::UnlockScreenFailed() {}
49 ScreenLockLibrary* screen_lock_library) {
50 }
51 45
52 // static 46 // static
53 void SystemEventObserver::Initialize() { 47 void SystemEventObserver::Initialize() {
54 DCHECK(!g_system_event_observer); 48 DCHECK(!g_system_event_observer);
55 g_system_event_observer = new SystemEventObserver(); 49 g_system_event_observer = new SystemEventObserver();
56 VLOG(1) << "SystemEventObserver initialized"; 50 VLOG(1) << "SystemEventObserver initialized";
57 DBusThreadManager::Get()->GetPowerManagerClient()-> 51 DBusThreadManager::Get()->GetPowerManagerClient()->
58 AddObserver(g_system_event_observer); 52 AddObserver(g_system_event_observer);
59 } 53 }
60 54
61 // static 55 // static
62 SystemEventObserver* SystemEventObserver::GetInstance() { 56 SystemEventObserver* SystemEventObserver::GetInstance() {
63 return g_system_event_observer; 57 return g_system_event_observer;
64 } 58 }
65 59
66 // static 60 // static
67 void SystemEventObserver::Shutdown() { 61 void SystemEventObserver::Shutdown() {
68 DCHECK(g_system_event_observer); 62 DCHECK(g_system_event_observer);
69 DBusThreadManager::Get()->GetPowerManagerClient()-> 63 DBusThreadManager::Get()->GetPowerManagerClient()->
70 RemoveObserver(g_system_event_observer); 64 RemoveObserver(g_system_event_observer);
71 delete g_system_event_observer; 65 delete g_system_event_observer;
72 g_system_event_observer = NULL; 66 g_system_event_observer = NULL;
73 VLOG(1) << "SystemEventObserver Shutdown completed"; 67 VLOG(1) << "SystemEventObserver Shutdown completed";
74 } 68 }
75 69
76 } // namespace accessibility 70 } // namespace accessibility
77 } // namespace chromeos 71 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698