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

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

Issue 8774035: Revert "chromeos: move screen lock handling to power manager client" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reverted 3 patches in correct order, without conflict 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 | Annotate | Revision Log
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"
9 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" 10 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h"
10 #include "chrome/browser/profiles/profile_manager.h" 11 #include "chrome/browser/profiles/profile_manager.h"
11 #include "chrome/common/chrome_notification_types.h" 12 #include "chrome/common/chrome_notification_types.h"
12 13
13 namespace chromeos { 14 namespace chromeos {
14 namespace accessibility { 15 namespace accessibility {
15 16
16 namespace { 17 namespace {
17 18
18 SystemEventObserver* g_system_event_observer = NULL; 19 SystemEventObserver* g_system_event_observer = NULL;
19 20
20 } 21 }
21 22
22 SystemEventObserver::SystemEventObserver() { 23 SystemEventObserver::SystemEventObserver() {
24 CrosLibrary::Get()->GetScreenLockLibrary()->AddObserver(this);
23 } 25 }
24 26
25 SystemEventObserver::~SystemEventObserver() { 27 SystemEventObserver::~SystemEventObserver() {
28 CrosLibrary::Get()->GetScreenLockLibrary()->RemoveObserver(this);
26 } 29 }
27 30
28 void SystemEventObserver::SystemResumed() { 31 void SystemEventObserver::SystemResumed() {
29 Profile* profile = ProfileManager::GetDefaultProfile(); 32 Profile* profile = ProfileManager::GetDefaultProfile();
30 WokeUpEventInfo info(profile); 33 WokeUpEventInfo info(profile);
31 SendAccessibilityNotification( 34 SendAccessibilityNotification(
32 chrome::NOTIFICATION_ACCESSIBILITY_WOKE_UP, &info); 35 chrome::NOTIFICATION_ACCESSIBILITY_WOKE_UP, &info);
33 } 36 }
34 37
35 void SystemEventObserver::LockScreen() {} 38 void SystemEventObserver::LockScreen(ScreenLockLibrary* screen_lock_library) {
39 }
36 40
37 void SystemEventObserver::UnlockScreen() { 41 void SystemEventObserver::UnlockScreen(ScreenLockLibrary* screen_lock_library) {
38 Profile* profile = ProfileManager::GetDefaultProfile(); 42 Profile* profile = ProfileManager::GetDefaultProfile();
39 ScreenUnlockedEventInfo info(profile); 43 ScreenUnlockedEventInfo info(profile);
40 SendAccessibilityNotification( 44 SendAccessibilityNotification(
41 chrome::NOTIFICATION_ACCESSIBILITY_SCREEN_UNLOCKED, &info); 45 chrome::NOTIFICATION_ACCESSIBILITY_SCREEN_UNLOCKED, &info);
42 } 46 }
43 47
44 void SystemEventObserver::UnlockScreenFailed() {} 48 void SystemEventObserver::UnlockScreenFailed(
49 ScreenLockLibrary* screen_lock_library) {
50 }
45 51
46 // static 52 // static
47 void SystemEventObserver::Initialize() { 53 void SystemEventObserver::Initialize() {
48 DCHECK(!g_system_event_observer); 54 DCHECK(!g_system_event_observer);
49 g_system_event_observer = new SystemEventObserver(); 55 g_system_event_observer = new SystemEventObserver();
50 VLOG(1) << "SystemEventObserver initialized"; 56 VLOG(1) << "SystemEventObserver initialized";
51 DBusThreadManager::Get()->GetPowerManagerClient()-> 57 DBusThreadManager::Get()->GetPowerManagerClient()->
52 AddObserver(g_system_event_observer); 58 AddObserver(g_system_event_observer);
53 } 59 }
54 60
55 // static 61 // static
56 SystemEventObserver* SystemEventObserver::GetInstance() { 62 SystemEventObserver* SystemEventObserver::GetInstance() {
57 return g_system_event_observer; 63 return g_system_event_observer;
58 } 64 }
59 65
60 // static 66 // static
61 void SystemEventObserver::Shutdown() { 67 void SystemEventObserver::Shutdown() {
62 DCHECK(g_system_event_observer); 68 DCHECK(g_system_event_observer);
63 DBusThreadManager::Get()->GetPowerManagerClient()-> 69 DBusThreadManager::Get()->GetPowerManagerClient()->
64 RemoveObserver(g_system_event_observer); 70 RemoveObserver(g_system_event_observer);
65 delete g_system_event_observer; 71 delete g_system_event_observer;
66 g_system_event_observer = NULL; 72 g_system_event_observer = NULL;
67 VLOG(1) << "SystemEventObserver Shutdown completed"; 73 VLOG(1) << "SystemEventObserver Shutdown completed";
68 } 74 }
69 75
70 } // namespace accessibility 76 } // namespace accessibility
71 } // namespace chromeos 77 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/accessibility/system_event_observer.h ('k') | chrome/browser/chromeos/chrome_browser_main_chromeos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698