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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_event_handler.cc

Issue 2890143003: Move ContextMenu show/hide state tracking to WebContents (Closed)
Patch Set: Fixing another compile error Created 3 years, 7 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
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 "content/browser/renderer_host/render_widget_host_view_event_handler.h" 5 #include "content/browser/renderer_host/render_widget_host_view_event_handler.h"
6 6
7 #include "base/metrics/user_metrics.h" 7 #include "base/metrics/user_metrics.h"
8 #include "base/metrics/user_metrics_action.h" 8 #include "base/metrics/user_metrics_action.h"
9 #include "content/browser/renderer_host/input/touch_selection_controller_client_ aura.h" 9 #include "content/browser/renderer_host/input/touch_selection_controller_client_ aura.h"
10 #include "content/browser/renderer_host/overscroll_controller.h" 10 #include "content/browser/renderer_host/overscroll_controller.h"
(...skipping 17 matching lines...) Expand all
28 #include "ui/events/blink/web_input_event.h" 28 #include "ui/events/blink/web_input_event.h"
29 #include "ui/touch_selection/touch_selection_controller.h" 29 #include "ui/touch_selection/touch_selection_controller.h"
30 30
31 #if defined(OS_WIN) 31 #if defined(OS_WIN)
32 #include "content/browser/frame_host/render_frame_host_impl.h" 32 #include "content/browser/frame_host/render_frame_host_impl.h"
33 #include "content/public/common/context_menu_params.h" 33 #include "content/public/common/context_menu_params.h"
34 #include "ui/aura/window_tree_host.h" 34 #include "ui/aura/window_tree_host.h"
35 #include "ui/display/screen.h" 35 #include "ui/display/screen.h"
36 #endif // defined(OS_WIN) 36 #endif // defined(OS_WIN)
37 37
38 #if defined(USE_AURA)
39 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
kenrb 2017/06/05 17:39:16 It doesn't look like this is needed.
EhsanK 2017/06/06 12:34:46 Uh thanks for finding this. Left over from WIP pha
40 #endif
41
38 namespace { 42 namespace {
39 43
40 // In mouse lock mode, we need to prevent the (invisible) cursor from hitting 44 // In mouse lock mode, we need to prevent the (invisible) cursor from hitting
41 // the border of the view, in order to get valid movement information. However, 45 // the border of the view, in order to get valid movement information. However,
42 // forcing the cursor back to the center of the view after each mouse move 46 // forcing the cursor back to the center of the view after each mouse move
43 // doesn't work well. It reduces the frequency of useful mouse move messages 47 // doesn't work well. It reduces the frequency of useful mouse move messages
44 // significantly. Therefore, we move the cursor to the center of the view only 48 // significantly. Therefore, we move the cursor to the center of the view only
45 // if it approaches the border. |kMouseLockBorderPercentage| specifies the width 49 // if it approaches the border. |kMouseLockBorderPercentage| specifies the width
46 // of the border area, in percentage of the corresponding dimension. 50 // of the border area, in percentage of the corresponding dimension.
47 const int kMouseLockBorderPercentage = 15; 51 const int kMouseLockBorderPercentage = 15;
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 if (event->type() == ui::ET_MOUSE_CAPTURE_CHANGED) 574 if (event->type() == ui::ET_MOUSE_CAPTURE_CHANGED)
571 return false; 575 return false;
572 576
573 if (event->type() == ui::ET_MOUSE_EXITED) { 577 if (event->type() == ui::ET_MOUSE_EXITED) {
574 if (mouse_locked || selection_popup) 578 if (mouse_locked || selection_popup)
575 return false; 579 return false;
576 #if defined(OS_WIN) || defined(OS_LINUX) 580 #if defined(OS_WIN) || defined(OS_LINUX)
577 // Don't forward the mouse leave message which is received when the context 581 // Don't forward the mouse leave message which is received when the context
578 // menu is displayed by the page. This confuses the page and causes state 582 // menu is displayed by the page. This confuses the page and causes state
579 // changes. 583 // changes.
580 if (host_view_->IsShowingContextMenu()) 584 if (host_->delegate() && host_->delegate()->IsShowingContextMenuOnPage())
581 return false; 585 return false;
582 #endif 586 #endif
583 return true; 587 return true;
584 } 588 }
585 589
586 #if defined(OS_WIN) 590 #if defined(OS_WIN)
587 // Renderer cannot handle WM_XBUTTON or NC events. 591 // Renderer cannot handle WM_XBUTTON or NC events.
588 switch (event->native_event().message) { 592 switch (event->native_event().message) {
589 case WM_XBUTTONDOWN: 593 case WM_XBUTTONDOWN:
590 case WM_XBUTTONUP: 594 case WM_XBUTTONUP:
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 bool non_zero_delta = 957 bool non_zero_delta =
954 mouse_wheel_event.delta_x || mouse_wheel_event.delta_y; 958 mouse_wheel_event.delta_x || mouse_wheel_event.delta_y;
955 mouse_wheel_event.phase = non_zero_delta 959 mouse_wheel_event.phase = non_zero_delta
956 ? blink::WebMouseWheelEvent::kPhaseChanged 960 ? blink::WebMouseWheelEvent::kPhaseChanged
957 : blink::WebMouseWheelEvent::kPhaseStationary; 961 : blink::WebMouseWheelEvent::kPhaseStationary;
958 mouse_wheel_end_dispatch_timer_.Reset(); 962 mouse_wheel_end_dispatch_timer_.Reset();
959 } 963 }
960 } 964 }
961 965
962 } // namespace content 966 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698