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

Side by Side Diff: ui/views/mouse_watcher.cc

Issue 11030017: Add context to gfx::Screen calls in support of simultaneous desktop+ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tidy Created 8 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/views/mouse_watcher.h" 5 #include "ui/views/mouse_watcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/event_types.h" 9 #include "base/event_types.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 } 79 }
80 } 80 }
81 #endif 81 #endif
82 82
83 private: 83 private:
84 MouseWatcherHost* host() const { return mouse_watcher_->host_.get(); } 84 MouseWatcherHost* host() const { return mouse_watcher_->host_.get(); }
85 85
86 // Called from the message loop observer when a mouse movement has occurred. 86 // Called from the message loop observer when a mouse movement has occurred.
87 void HandleGlobalMouseMoveEvent(MouseWatcherHost::MouseEventType event_type) { 87 void HandleGlobalMouseMoveEvent(MouseWatcherHost::MouseEventType event_type) {
88 bool contained = host()->Contains( 88 bool contained = host()->Contains(
89 gfx::Screen::GetCursorScreenPoint(), event_type); 89 gfx::Screen::GetCursorScreenPoint(gfx::Screen::BadTwoWorldsContext()),
90 event_type);
90 if (!contained) { 91 if (!contained) {
91 // Mouse moved outside the host's zone, start a timer to notify the 92 // Mouse moved outside the host's zone, start a timer to notify the
92 // listener. 93 // listener.
93 if (!notify_listener_factory_.HasWeakPtrs()) { 94 if (!notify_listener_factory_.HasWeakPtrs()) {
94 MessageLoop::current()->PostDelayedTask( 95 MessageLoop::current()->PostDelayedTask(
95 FROM_HERE, 96 FROM_HERE,
96 base::Bind(&Observer::NotifyListener, 97 base::Bind(&Observer::NotifyListener,
97 notify_listener_factory_.GetWeakPtr()), 98 notify_listener_factory_.GetWeakPtr()),
98 event_type == MouseWatcherHost::MOUSE_MOVE ? 99 event_type == MouseWatcherHost::MOUSE_MOVE ?
99 base::TimeDelta::FromMilliseconds(kNotifyListenerTimeMs) : 100 base::TimeDelta::FromMilliseconds(kNotifyListenerTimeMs) :
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 void MouseWatcher::Stop() { 146 void MouseWatcher::Stop() {
146 observer_.reset(NULL); 147 observer_.reset(NULL);
147 } 148 }
148 149
149 void MouseWatcher::NotifyListener() { 150 void MouseWatcher::NotifyListener() {
150 observer_.reset(NULL); 151 observer_.reset(NULL);
151 listener_->MouseMovedOutOfHost(); 152 listener_->MouseMovedOutOfHost();
152 } 153 }
153 154
154 } // namespace views 155 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698