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

Side by Side Diff: ui/views/mus/pointer_watcher_event_router.cc

Issue 2256343003: Update ui::PointerEvent to support mouse wheel and capture change events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 3 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
« no previous file with comments | « ui/events/event_unittest.cc ('k') | ui/views/mus/pointer_watcher_event_router_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/mus/pointer_watcher_event_router.h" 5 #include "ui/views/mus/pointer_watcher_event_router.h"
6 6
7 #include "services/ui/public/cpp/window.h" 7 #include "services/ui/public/cpp/window.h"
8 #include "services/ui/public/cpp/window_tree_client.h" 8 #include "services/ui/public/cpp/window_tree_client.h"
9 #include "ui/display/screen.h"
9 #include "ui/events/base_event_utils.h" 10 #include "ui/events/base_event_utils.h"
10 #include "ui/events/event.h" 11 #include "ui/events/event.h"
11 #include "ui/views/mus/native_widget_mus.h" 12 #include "ui/views/mus/native_widget_mus.h"
12 #include "ui/views/pointer_watcher.h" 13 #include "ui/views/pointer_watcher.h"
13 14
14 namespace views { 15 namespace views {
15 namespace { 16 namespace {
16 17
17 bool HasPointerWatcher( 18 bool HasPointerWatcher(
18 base::ObserverList<views::PointerWatcher, true>* observer_list) { 19 base::ObserverList<views::PointerWatcher, true>* observer_list) {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 122
122 if (HasPointerWatcher(&non_move_watchers_)) 123 if (HasPointerWatcher(&non_move_watchers_))
123 return EventTypes::NON_MOVE_EVENTS; 124 return EventTypes::NON_MOVE_EVENTS;
124 125
125 return EventTypes::NONE; 126 return EventTypes::NONE;
126 } 127 }
127 128
128 void PointerWatcherEventRouter::OnWindowTreeCaptureChanged( 129 void PointerWatcherEventRouter::OnWindowTreeCaptureChanged(
129 ui::Window* gained_capture, 130 ui::Window* gained_capture,
130 ui::Window* lost_capture) { 131 ui::Window* lost_capture) {
131 FOR_EACH_OBSERVER(PointerWatcher, move_watchers_, OnMouseCaptureChanged()); 132 const ui::MouseEvent mouse_event(ui::ET_MOUSE_CAPTURE_CHANGED, gfx::Point(),
133 gfx::Point(), ui::EventTimeForNow(), 0, 0);
134 const ui::PointerEvent event(mouse_event);
135 gfx::Point location_in_screen =
136 display::Screen::GetScreen()->GetCursorScreenPoint();
137 FOR_EACH_OBSERVER(PointerWatcher, move_watchers_,
138 OnPointerEventObserved(event, location_in_screen, nullptr));
132 FOR_EACH_OBSERVER(PointerWatcher, non_move_watchers_, 139 FOR_EACH_OBSERVER(PointerWatcher, non_move_watchers_,
133 OnMouseCaptureChanged()); 140 OnPointerEventObserved(event, location_in_screen, nullptr));
134 } 141 }
135 142
136 void PointerWatcherEventRouter::OnDidDestroyClient( 143 void PointerWatcherEventRouter::OnDidDestroyClient(
137 ui::WindowTreeClient* client) { 144 ui::WindowTreeClient* client) {
138 // We expect that all observers have been removed by this time. 145 // We expect that all observers have been removed by this time.
139 DCHECK_EQ(event_types_, EventTypes::NONE); 146 DCHECK_EQ(event_types_, EventTypes::NONE);
140 DCHECK_EQ(client, window_tree_client_); 147 DCHECK_EQ(client, window_tree_client_);
141 window_tree_client_->RemoveObserver(this); 148 window_tree_client_->RemoveObserver(this);
142 window_tree_client_ = nullptr; 149 window_tree_client_ = nullptr;
143 } 150 }
144 151
145 } // namespace views 152 } // namespace views
OLDNEW
« no previous file with comments | « ui/events/event_unittest.cc ('k') | ui/views/mus/pointer_watcher_event_router_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698