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

Unified Diff: trunk/src/media/base/user_input_monitor.cc

Issue 22871007: Revert 217768 "Adding key press detection in the browser process." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 4 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
« no previous file with comments | « trunk/src/media/base/user_input_monitor.h ('k') | trunk/src/media/base/user_input_monitor_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/media/base/user_input_monitor.cc
===================================================================
--- trunk/src/media/base/user_input_monitor.cc (revision 217773)
+++ trunk/src/media/base/user_input_monitor.cc (working copy)
@@ -1,87 +0,0 @@
-// Copyright 2013 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 "media/base/user_input_monitor.h"
-
-#include "third_party/skia/include/core/SkPoint.h"
-
-namespace media {
-
-#ifdef DISABLE_USER_INPUT_MONITOR
-scoped_ptr<UserInputMonitor> UserInputMonitor::Create(
- const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner,
- const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner) {
- return scoped_ptr<UserInputMonitor>();
-}
-#endif // DISABLE_USER_INPUT_MONITOR
-
-UserInputMonitor::~UserInputMonitor() {
- DCHECK(!monitoring_mouse_);
- DCHECK(!monitoring_keyboard_);
-}
-
-void UserInputMonitor::AddMouseListener(MouseEventListener* listener) {
- base::AutoLock auto_lock(lock_);
- mouse_listeners_.AddObserver(listener);
- if (!monitoring_mouse_) {
- StartMouseMonitoring();
- monitoring_mouse_ = true;
- DVLOG(2) << "Started mouse monitoring.";
- }
-}
-void UserInputMonitor::RemoveMouseListener(MouseEventListener* listener) {
- base::AutoLock auto_lock(lock_);
- mouse_listeners_.RemoveObserver(listener);
- if (mouse_listeners_.size() == 0) {
- StopMouseMonitoring();
- monitoring_mouse_ = false;
- DVLOG(2) << "Stopped mouse monitoring.";
- }
-}
-void UserInputMonitor::AddKeyStrokeListener(KeyStrokeListener* listener) {
- base::AutoLock auto_lock(lock_);
- key_stroke_listeners_.AddObserver(listener);
- if (!monitoring_keyboard_) {
- StartKeyboardMonitoring();
- monitoring_keyboard_ = true;
- DVLOG(2) << "Started keyboard monitoring.";
- }
-}
-void UserInputMonitor::RemoveKeyStrokeListener(KeyStrokeListener* listener) {
- base::AutoLock auto_lock(lock_);
- key_stroke_listeners_.RemoveObserver(listener);
- if (key_stroke_listeners_.size() == 0) {
- StopKeyboardMonitoring();
- monitoring_keyboard_ = false;
- DVLOG(2) << "Stopped keyboard monitoring.";
- }
-}
-
-UserInputMonitor::UserInputMonitor()
- : monitoring_mouse_(false), monitoring_keyboard_(false) {}
-
-void UserInputMonitor::OnMouseEvent(const SkIPoint& position) {
- base::AutoLock auto_lock(lock_);
- FOR_EACH_OBSERVER(
- MouseEventListener, mouse_listeners_, OnMouseMoved(position));
-}
-
-void UserInputMonitor::OnKeyboardEvent(ui::EventType event,
- ui::KeyboardCode key_code) {
- base::AutoLock auto_lock(lock_);
- // Updates the pressed keys and maybe notifies the key_stroke_listeners_.
- if (event == ui::ET_KEY_PRESSED) {
- if (pressed_keys_.find(key_code) != pressed_keys_.end())
- return;
- pressed_keys_.insert(key_code);
- DVLOG(6) << "Key stroke detected.";
- FOR_EACH_OBSERVER(KeyStrokeListener, key_stroke_listeners_, OnKeyStroke());
- } else {
- DCHECK_EQ(ui::ET_KEY_RELEASED, event);
- DCHECK(pressed_keys_.find(key_code) != pressed_keys_.end());
- pressed_keys_.erase(key_code);
- }
-}
-
-} // namespace media
« no previous file with comments | « trunk/src/media/base/user_input_monitor.h ('k') | trunk/src/media/base/user_input_monitor_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698