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

Unified 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: Rebased to ToT 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/accessibility/system_event_observer.cc
diff --git a/chrome/browser/chromeos/accessibility/system_event_observer.cc b/chrome/browser/chromeos/accessibility/system_event_observer.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9b16e7fa9c4a875399afda5d26d6092a6b473f56
--- /dev/null
+++ b/chrome/browser/chromeos/accessibility/system_event_observer.cc
@@ -0,0 +1,74 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/chromeos/accessibility/system_event_observer.h"
+
+#include "base/logging.h"
+#include "chrome/browser/accessibility_events.h"
+#include "chrome/browser/chromeos/cros/cros_library.h"
+#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/common/chrome_notification_types.h"
+
+namespace chromeos {
+namespace accessibility {
+
+namespace {
+
+SystemEventObserver* g_system_event_observer = NULL;
+
+}
+
+SystemEventObserver::SystemEventObserver() {
+ CrosLibrary::Get()->GetPowerLibrary()->AddObserver(this);
+ CrosLibrary::Get()->GetScreenLockLibrary()->AddObserver(this);
+}
+
+SystemEventObserver::~SystemEventObserver() {
+ CrosLibrary::Get()->GetScreenLockLibrary()->RemoveObserver(this);
+ CrosLibrary::Get()->GetPowerLibrary()->RemoveObserver(this);
+}
+
+void SystemEventObserver::SystemResumed() {
+ Profile* profile = ProfileManager::GetDefaultProfile();
+ WokeUpEventInfo info(profile);
+ SendAccessibilityNotification(
+ chrome::NOTIFICATION_ACCESSIBILITY_WOKE_UP, &info);
+}
+
+void SystemEventObserver::LockScreen(ScreenLockLibrary* screen_lock_library) {
+}
+
+void SystemEventObserver::UnlockScreen(ScreenLockLibrary* screen_lock_library) {
+ Profile* profile = ProfileManager::GetDefaultProfile();
+ ScreenUnlockedEventInfo info(profile);
+ SendAccessibilityNotification(
+ chrome::NOTIFICATION_ACCESSIBILITY_SCREEN_UNLOCKED, &info);
+}
+
+void SystemEventObserver::UnlockScreenFailed(
+ ScreenLockLibrary* screen_lock_library) {
+}
+
+// static
+void SystemEventObserver::Initialize() {
+ DCHECK(!g_system_event_observer);
+ g_system_event_observer = new SystemEventObserver();
+ VLOG(1) << "SystemEventObserver initialized";
+}
+
+// static
+SystemEventObserver* SystemEventObserver::GetInstance() {
+ return g_system_event_observer;
+}
+
+// static
+void SystemEventObserver::Shutdown() {
+ DCHECK(g_system_event_observer);
+ delete g_system_event_observer;
+ g_system_event_observer = NULL;
+ VLOG(1) << "SystemEventObserver Shutdown completed";
+}
+
+} // namespace accessibility
+} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/accessibility/system_event_observer.h ('k') | chrome/browser/chromeos/chrome_browser_main_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698