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

Unified Diff: ash/shell.cc

Issue 10544011: chromeos: Notify power manager about user activity. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 months 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: ash/shell.cc
diff --git a/ash/shell.cc b/ash/shell.cc
index 8380945b567c68edec0f120db417a7bb8faa11a4..128e1ca73688f5c869a15f87c20cb67687a190a1 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -54,6 +54,7 @@
#include "ash/wm/system_gesture_event_filter.h"
#include "ash/wm/system_modal_container_layout_manager.h"
#include "ash/wm/toplevel_window_event_filter.h"
+#include "ash/wm/user_activity_detector.h"
#include "ash/wm/video_detector.h"
#include "ash/wm/visibility_controller.h"
#include "ash/wm/window_cycle_controller.h"
@@ -575,6 +576,7 @@ Shell::~Shell() {
views::FocusManagerFactory::Install(NULL);
// Please keep in same order as in Init() because it's easy to miss one.
+ RemoveRootWindowEventFilter(user_activity_detector_.get());
RemoveRootWindowEventFilter(key_rewriter_filter_.get());
RemoveRootWindowEventFilter(partial_screenshot_filter_.get());
RemoveRootWindowEventFilter(input_method_filter_.get());
@@ -714,24 +716,25 @@ void Shell::Init() {
// Pass ownership of the filter to the root window.
root_window->SetEventFilter(root_filter_);
- // KeyRewriterEventFilter must be the first one.
+ // The order in which event filters are added is significant.
DCHECK(!GetRootWindowEventFilterCount());
+ user_activity_detector_.reset(new UserActivityDetector);
+ AddRootWindowEventFilter(user_activity_detector_.get());
+
+ DCHECK_EQ(1U, GetRootWindowEventFilterCount());
key_rewriter_filter_.reset(new internal::KeyRewriterEventFilter);
AddRootWindowEventFilter(key_rewriter_filter_.get());
- // PartialScreenshotEventFilter must be the second one to capture key
- // events when the taking partial screenshot UI is there.
- DCHECK_EQ(1U, GetRootWindowEventFilterCount());
+ DCHECK_EQ(2U, GetRootWindowEventFilterCount());
partial_screenshot_filter_.reset(new internal::PartialScreenshotEventFilter);
AddRootWindowEventFilter(partial_screenshot_filter_.get());
AddShellObserver(partial_screenshot_filter_.get());
- // InputMethodEventFilter must be the third one. It has to be added before
- // AcceleratorFilter.
- DCHECK_EQ(2U, GetRootWindowEventFilterCount());
+ DCHECK_EQ(3U, GetRootWindowEventFilterCount());
input_method_filter_.reset(new aura::shared::InputMethodEventFilter());
input_method_filter_->SetInputMethodPropertyInRootWindow(root_window);
AddRootWindowEventFilter(input_method_filter_.get());
+
#if !defined(OS_MACOSX)
accelerator_filter_.reset(new internal::AcceleratorFilter);
AddRootWindowEventFilter(accelerator_filter_.get());
« no previous file with comments | « ash/shell.h ('k') | ash/wm/user_activity_detector.h » ('j') | ash/wm/user_activity_detector.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698