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

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

Issue 8558014: Add experimental extension APIs to notify about wakeup and screen unlock (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Codereview Created 9 years, 1 month 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/chromeos/accessibility/system_event_observer.h"
6
7 #include "base/logging.h"
8 #include "chrome/browser/accessibility_events.h"
9 #include "chrome/browser/chromeos/cros/cros_library.h"
10 #include "chrome/browser/profiles/profile_manager.h"
11 #include "chrome/common/chrome_notification_types.h"
12
13 namespace chromeos {
14 namespace accessibility {
15
16 namespace {
17
18 SystemEventObserver* g_system_event_observer = NULL;
19
20 }
21
22 SystemEventObserver::SystemEventObserver() {
23 CrosLibrary::Get()->GetPowerLibrary()->AddObserver(this);
24 CrosLibrary::Get()->GetScreenLockLibrary()->AddObserver(this);
25 }
26
27 SystemEventObserver::~SystemEventObserver() {
28 CrosLibrary::Get()->GetScreenLockLibrary()->RemoveObserver(this);
29 CrosLibrary::Get()->GetPowerLibrary()->RemoveObserver(this);
30 }
31
32 void SystemEventObserver::SystemResumed() {
33 Profile* profile = ProfileManager::GetDefaultProfile();
34 AccessibilityEmptyEventInfo info(profile);
35 SendAccessibilityNotification(
36 chrome::NOTIFICATION_ACCESSIBILITY_WOKE_UP, &info);
37 }
38
39 void SystemEventObserver::LockScreen(ScreenLockLibrary* screen_lock_library) {
40 }
41
42 void SystemEventObserver::UnlockScreen(ScreenLockLibrary* screen_lock_library) {
43 Profile* profile = ProfileManager::GetDefaultProfile();
44 AccessibilityEmptyEventInfo info(profile);
45 SendAccessibilityNotification(
46 chrome::NOTIFICATION_ACCESSIBILITY_SCREEN_UNLOCKED, &info);
47 }
48
49 void SystemEventObserver::UnlockScreenFailed(
50 ScreenLockLibrary* screen_lock_library) {
51 }
52
53 // static
54 void SystemEventObserver::Initialize() {
55 DCHECK(!g_system_event_observer);
56 g_system_event_observer = new SystemEventObserver();
57 VLOG(1) << "SystemEventObserver initialized";
58 }
59
60 // static
61 SystemEventObserver* SystemEventObserver::GetInstance() {
62 return g_system_event_observer;
63 }
64
65 // static
66 void SystemEventObserver::Shutdown() {
67 DCHECK(g_system_event_observer);
68 delete g_system_event_observer;
69 g_system_event_observer = NULL;
70 VLOG(1) << "SystemEventObserver Shutdown completed";
71 }
72
73 } // namespace accessibility
74 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698