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

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

Issue 1692593002: Use showing_context_menu_ from RenderWidgetHostViewBase to avoid MouseLeave event on Context Menu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 | « content/browser/renderer_host/render_widget_host_view_aura.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/browser/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 can_compose_inline_(true), 467 can_compose_inline_(true),
468 has_composition_text_(false), 468 has_composition_text_(false),
469 accept_return_character_(false), 469 accept_return_character_(false),
470 last_swapped_software_frame_scale_factor_(1.f), 470 last_swapped_software_frame_scale_factor_(1.f),
471 paint_canvas_(NULL), 471 paint_canvas_(NULL),
472 synthetic_move_sent_(false), 472 synthetic_move_sent_(false),
473 cursor_visibility_state_in_renderer_(UNKNOWN), 473 cursor_visibility_state_in_renderer_(UNKNOWN),
474 #if defined(OS_WIN) 474 #if defined(OS_WIN)
475 legacy_render_widget_host_HWND_(NULL), 475 legacy_render_widget_host_HWND_(NULL),
476 legacy_window_destroyed_(false), 476 legacy_window_destroyed_(false),
477 showing_context_menu_(false),
478 #endif 477 #endif
479 has_snapped_to_boundary_(false), 478 has_snapped_to_boundary_(false),
480 is_guest_view_hack_(is_guest_view_hack), 479 is_guest_view_hack_(is_guest_view_hack),
481 begin_frame_observer_proxy_(this), 480 begin_frame_observer_proxy_(this),
482 set_focus_on_mouse_down_or_key_event_(false), 481 set_focus_on_mouse_down_or_key_event_(false),
483 device_scale_factor_(0.0f), 482 device_scale_factor_(0.0f),
484 weak_ptr_factory_(this) { 483 weak_ptr_factory_(this) {
485 if (!is_guest_view_hack_) 484 if (!is_guest_view_hack_)
486 host_->SetView(this); 485 host_->SetView(this);
487 486
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 rvh->GetDelegate()->GetFrameTree()->GetFocusedFrame(); 789 rvh->GetDelegate()->GetFrameTree()->GetFocusedFrame();
791 if (!focused_frame) 790 if (!focused_frame)
792 return nullptr; 791 return nullptr;
793 792
794 return focused_frame->current_frame_host(); 793 return focused_frame->current_frame_host();
795 } 794 }
796 795
797 bool RenderWidgetHostViewAura::CanRendererHandleEvent( 796 bool RenderWidgetHostViewAura::CanRendererHandleEvent(
798 const ui::MouseEvent* event, 797 const ui::MouseEvent* event,
799 bool mouse_locked, 798 bool mouse_locked,
800 bool selection_popup) { 799 bool selection_popup) {
sadrul 2016/02/12 15:30:12 Oh, and while you are here, make this a const func
801 #if defined(OS_WIN)
802 bool showing_context_menu = showing_context_menu_;
803 showing_context_menu_ = false;
804 #endif
805
806 if (event->type() == ui::ET_MOUSE_CAPTURE_CHANGED) 800 if (event->type() == ui::ET_MOUSE_CAPTURE_CHANGED)
807 return false; 801 return false;
808 802
809 if (event->type() == ui::ET_MOUSE_EXITED) { 803 if (event->type() == ui::ET_MOUSE_EXITED) {
810 if (mouse_locked || selection_popup) 804 if (mouse_locked || selection_popup)
811 return false; 805 return false;
812 #if defined(OS_WIN) 806 #if defined(OS_WIN)
813 // Don't forward the mouse leave message which is received when the context 807 // Don't forward the mouse leave message which is received when the context
814 // menu is displayed by the page. This confuses the page and causes state 808 // menu is displayed by the page. This confuses the page and causes state
815 // changes. 809 // changes.
816 if (showing_context_menu) 810 if (showing_context_menu_)
sadrul 2016/02/12 01:06:52 IsShowingContextMenu()
817 return false; 811 return false;
818 #endif 812 #endif
819 return true; 813 return true;
820 } 814 }
821 815
822 #if defined(OS_WIN) 816 #if defined(OS_WIN)
823 // Renderer cannot handle WM_XBUTTON or NC events. 817 // Renderer cannot handle WM_XBUTTON or NC events.
824 switch (event->native_event().message) { 818 switch (event->native_event().message) {
825 case WM_XBUTTONDOWN: 819 case WM_XBUTTONDOWN:
826 case WM_XBUTTONUP: 820 case WM_XBUTTONUP:
(...skipping 1888 matching lines...) Expand 10 before | Expand all | Expand 10 after
2715 bool RenderWidgetHostViewAura::OnShowContextMenu( 2709 bool RenderWidgetHostViewAura::OnShowContextMenu(
2716 const ContextMenuParams& params) { 2710 const ContextMenuParams& params) {
2717 #if defined(OS_WIN) 2711 #if defined(OS_WIN)
2718 last_context_menu_params_.reset(); 2712 last_context_menu_params_.reset();
2719 2713
2720 if (params.source_type == ui::MENU_SOURCE_LONG_PRESS) { 2714 if (params.source_type == ui::MENU_SOURCE_LONG_PRESS) {
2721 last_context_menu_params_.reset(new ContextMenuParams); 2715 last_context_menu_params_.reset(new ContextMenuParams);
2722 *last_context_menu_params_ = params; 2716 *last_context_menu_params_ = params;
2723 return false; 2717 return false;
2724 } 2718 }
2725 showing_context_menu_ = true;
2726 #endif 2719 #endif
2727 return true; 2720 return true;
2728 } 2721 }
2729 2722
2730 void RenderWidgetHostViewAura::SetSelectionControllerClientForTest( 2723 void RenderWidgetHostViewAura::SetSelectionControllerClientForTest(
2731 scoped_ptr<TouchSelectionControllerClientAura> client) { 2724 scoped_ptr<TouchSelectionControllerClientAura> client) {
2732 selection_controller_client_.swap(client); 2725 selection_controller_client_.swap(client);
2733 CreateSelectionController(); 2726 CreateSelectionController();
2734 } 2727 }
2735 2728
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
3072 3065
3073 //////////////////////////////////////////////////////////////////////////////// 3066 ////////////////////////////////////////////////////////////////////////////////
3074 // RenderWidgetHostViewBase, public: 3067 // RenderWidgetHostViewBase, public:
3075 3068
3076 // static 3069 // static
3077 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { 3070 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) {
3078 GetScreenInfoForWindow(results, NULL); 3071 GetScreenInfoForWindow(results, NULL);
3079 } 3072 }
3080 3073
3081 } // namespace content 3074 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698