OLD | NEW |
---|---|
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_events.h" | 8 #include "chrome/browser/accessibility_events.h" |
9 #include "chrome/browser/chromeos/cros/cros_library.h" | 9 #include "chrome/browser/chromeos/cros/cros_library.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() { |
23 CrosLibrary::Get()->GetPowerLibrary()->AddObserver(this); | 24 DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this); |
24 CrosLibrary::Get()->GetScreenLockLibrary()->AddObserver(this); | 25 CrosLibrary::Get()->GetScreenLockLibrary()->AddObserver(this); |
satorux1
2011/11/23 08:24:48
Looking at chrome_browser_main_chromeos.cc, this s
satorux1
2011/11/23 18:25:57
I take it back. Forget about adding Init(). I thin
Simon Que
2011/11/23 18:35:23
Isn't Initialize() a static function?
Simon Que
2011/11/23 18:36:07
Oh I see that it has a single instance.
Simon Que
2011/11/23 19:24:17
Done.
| |
25 } | 26 } |
26 | 27 |
27 SystemEventObserver::~SystemEventObserver() { | 28 SystemEventObserver::~SystemEventObserver() { |
28 CrosLibrary::Get()->GetScreenLockLibrary()->RemoveObserver(this); | 29 CrosLibrary::Get()->GetScreenLockLibrary()->RemoveObserver(this); |
29 CrosLibrary::Get()->GetPowerLibrary()->RemoveObserver(this); | 30 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); |
satorux1
2011/11/23 08:24:48
Introduce Shutdown() to do this.
| |
30 } | 31 } |
31 | 32 |
32 void SystemEventObserver::SystemResumed() { | 33 void SystemEventObserver::SystemResumed() { |
33 Profile* profile = ProfileManager::GetDefaultProfile(); | 34 Profile* profile = ProfileManager::GetDefaultProfile(); |
34 WokeUpEventInfo info(profile); | 35 WokeUpEventInfo info(profile); |
35 SendAccessibilityNotification( | 36 SendAccessibilityNotification( |
36 chrome::NOTIFICATION_ACCESSIBILITY_WOKE_UP, &info); | 37 chrome::NOTIFICATION_ACCESSIBILITY_WOKE_UP, &info); |
37 } | 38 } |
38 | 39 |
39 void SystemEventObserver::LockScreen(ScreenLockLibrary* screen_lock_library) { | 40 void SystemEventObserver::LockScreen(ScreenLockLibrary* screen_lock_library) { |
(...skipping 25 matching lines...) Expand all Loading... | |
65 // static | 66 // static |
66 void SystemEventObserver::Shutdown() { | 67 void SystemEventObserver::Shutdown() { |
67 DCHECK(g_system_event_observer); | 68 DCHECK(g_system_event_observer); |
68 delete g_system_event_observer; | 69 delete g_system_event_observer; |
69 g_system_event_observer = NULL; | 70 g_system_event_observer = NULL; |
70 VLOG(1) << "SystemEventObserver Shutdown completed"; | 71 VLOG(1) << "SystemEventObserver Shutdown completed"; |
71 } | 72 } |
72 | 73 |
73 } // namespace accessibility | 74 } // namespace accessibility |
74 } // namespace chromeos | 75 } // namespace chromeos |
OLD | NEW |