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

Side by Side Diff: services/ui/ws/event_dispatcher.cc

Issue 2911293002: Add EventTargeterDelegate for EventTargeter in mus-ws. (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « services/ui/ws/event_dispatcher.h ('k') | services/ui/ws/event_targeter.h » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "services/ui/ws/event_dispatcher.h" 5 #include "services/ui/ws/event_dispatcher.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 29 matching lines...) Expand all
40 } // namespace 40 } // namespace
41 41
42 //////////////////////////////////////////////////////////////////////////////// 42 ////////////////////////////////////////////////////////////////////////////////
43 43
44 EventDispatcher::EventDispatcher(EventDispatcherDelegate* delegate) 44 EventDispatcher::EventDispatcher(EventDispatcherDelegate* delegate)
45 : delegate_(delegate), 45 : delegate_(delegate),
46 capture_window_(nullptr), 46 capture_window_(nullptr),
47 capture_window_client_id_(kInvalidClientId), 47 capture_window_client_id_(kInvalidClientId),
48 modal_window_controller_(this), 48 modal_window_controller_(this),
49 event_targeter_( 49 event_targeter_(
50 base::MakeUnique<EventTargeter>(delegate_, 50 base::MakeUnique<EventTargeter>(this, &modal_window_controller_)),
51 &modal_window_controller_)),
52 mouse_button_down_(false), 51 mouse_button_down_(false),
53 mouse_cursor_source_window_(nullptr), 52 mouse_cursor_source_window_(nullptr),
54 mouse_cursor_in_non_client_area_(false) {} 53 mouse_cursor_in_non_client_area_(false) {}
55 54
56 EventDispatcher::~EventDispatcher() { 55 EventDispatcher::~EventDispatcher() {
57 SetMouseCursorSourceWindow(nullptr); 56 SetMouseCursorSourceWindow(nullptr);
58 if (capture_window_) { 57 if (capture_window_) {
59 UnobserveWindow(capture_window_); 58 UnobserveWindow(capture_window_);
60 capture_window_ = nullptr; 59 capture_window_ = nullptr;
61 capture_window_client_id_ = kInvalidClientId; 60 capture_window_client_id_ = kInvalidClientId;
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 } 309 }
311 ProcessKeyEvent(*key_event, match_phase); 310 ProcessKeyEvent(*key_event, match_phase);
312 return; 311 return;
313 } 312 }
314 313
315 DCHECK(event.IsPointerEvent()); 314 DCHECK(event.IsPointerEvent());
316 ProcessPointerEvent(*event.AsPointerEvent()); 315 ProcessPointerEvent(*event.AsPointerEvent());
317 return; 316 return;
318 } 317 }
319 318
319 ServerWindow* EventDispatcher::GetRootWindowContaining(
320 gfx::Point* location_in_display,
321 int64_t* display_id) {
322 return delegate_->GetRootWindowContaining(location_in_display, display_id);
323 }
324
320 void EventDispatcher::SetMouseCursorSourceWindow(ServerWindow* window) { 325 void EventDispatcher::SetMouseCursorSourceWindow(ServerWindow* window) {
321 if (mouse_cursor_source_window_ == window) 326 if (mouse_cursor_source_window_ == window)
322 return; 327 return;
323 328
324 if (mouse_cursor_source_window_) 329 if (mouse_cursor_source_window_)
325 UnobserveWindow(mouse_cursor_source_window_); 330 UnobserveWindow(mouse_cursor_source_window_);
326 mouse_cursor_source_window_ = window; 331 mouse_cursor_source_window_ = window;
327 if (mouse_cursor_source_window_) 332 if (mouse_cursor_source_window_)
328 ObserveWindow(mouse_cursor_source_window_); 333 ObserveWindow(mouse_cursor_source_window_);
329 } 334 }
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 if (mouse_cursor_source_window_ == window) 650 if (mouse_cursor_source_window_ == window)
646 SetMouseCursorSourceWindow(nullptr); 651 SetMouseCursorSourceWindow(nullptr);
647 } 652 }
648 653
649 void EventDispatcher::OnDragCursorUpdated() { 654 void EventDispatcher::OnDragCursorUpdated() {
650 delegate_->UpdateNativeCursorFromDispatcher(); 655 delegate_->UpdateNativeCursorFromDispatcher();
651 } 656 }
652 657
653 } // namespace ws 658 } // namespace ws
654 } // namespace ui 659 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/event_dispatcher.h ('k') | services/ui/ws/event_targeter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698