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

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

Issue 1602903003: Display the context menu on Windows on long press release (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments Created 4 years, 11 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 (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 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 11 matching lines...) Expand all
22 #include "base/memory/weak_ptr.h" 22 #include "base/memory/weak_ptr.h"
23 #include "build/build_config.h" 23 #include "build/build_config.h"
24 #include "content/browser/accessibility/browser_accessibility_manager.h" 24 #include "content/browser/accessibility/browser_accessibility_manager.h"
25 #include "content/browser/compositor/delegated_frame_host.h" 25 #include "content/browser/compositor/delegated_frame_host.h"
26 #include "content/browser/compositor/image_transport_factory.h" 26 #include "content/browser/compositor/image_transport_factory.h"
27 #include "content/browser/compositor/owned_mailbox.h" 27 #include "content/browser/compositor/owned_mailbox.h"
28 #include "content/browser/renderer_host/begin_frame_observer_proxy.h" 28 #include "content/browser/renderer_host/begin_frame_observer_proxy.h"
29 #include "content/browser/renderer_host/render_widget_host_view_base.h" 29 #include "content/browser/renderer_host/render_widget_host_view_base.h"
30 #include "content/common/content_export.h" 30 #include "content/common/content_export.h"
31 #include "content/common/cursors/webcursor.h" 31 #include "content/common/cursors/webcursor.h"
32 #include "content/public/common/context_menu_params.h"
32 #include "third_party/skia/include/core/SkRegion.h" 33 #include "third_party/skia/include/core/SkRegion.h"
33 #include "ui/aura/client/cursor_client_observer.h" 34 #include "ui/aura/client/cursor_client_observer.h"
34 #include "ui/aura/client/focus_change_observer.h" 35 #include "ui/aura/client/focus_change_observer.h"
35 #include "ui/aura/window_delegate.h" 36 #include "ui/aura/window_delegate.h"
36 #include "ui/aura/window_tree_host_observer.h" 37 #include "ui/aura/window_tree_host_observer.h"
37 #include "ui/base/ime/text_input_client.h" 38 #include "ui/base/ime/text_input_client.h"
38 #include "ui/base/touch/selection_bound.h" 39 #include "ui/base/touch/selection_bound.h"
39 #include "ui/events/gestures/motion_event_aura.h" 40 #include "ui/events/gestures/motion_event_aura.h"
40 #include "ui/gfx/display_observer.h" 41 #include "ui/gfx/display_observer.h"
41 #include "ui/gfx/geometry/insets.h" 42 #include "ui/gfx/geometry/insets.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 class TouchSelectionController; 76 class TouchSelectionController;
76 } 77 }
77 78
78 namespace content { 79 namespace content {
79 #if defined(OS_WIN) 80 #if defined(OS_WIN)
80 class LegacyRenderWidgetHostHWND; 81 class LegacyRenderWidgetHostHWND;
81 #endif 82 #endif
82 83
83 class OverscrollController; 84 class OverscrollController;
84 class RenderFrameHostImpl; 85 class RenderFrameHostImpl;
86 class RenderViewHostDelegateView;
85 class RenderWidgetHostImpl; 87 class RenderWidgetHostImpl;
86 class RenderWidgetHostView; 88 class RenderWidgetHostView;
87 class TouchSelectionControllerClientAura; 89 class TouchSelectionControllerClientAura;
88 90
89 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h. 91 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h.
90 class CONTENT_EXPORT RenderWidgetHostViewAura 92 class CONTENT_EXPORT RenderWidgetHostViewAura
91 : public RenderWidgetHostViewBase, 93 : public RenderWidgetHostViewBase,
92 public DelegatedFrameHostClient, 94 public DelegatedFrameHostClient,
93 public BeginFrameObserverProxyClient, 95 public BeginFrameObserverProxyClient,
94 public ui::TextInputClient, 96 public ui::TextInputClient,
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 325
324 TouchSelectionControllerClientAura* selection_controller_client() const { 326 TouchSelectionControllerClientAura* selection_controller_client() const {
325 return selection_controller_client_.get(); 327 return selection_controller_client_.get();
326 } 328 }
327 329
328 OverscrollController* overscroll_controller() const { 330 OverscrollController* overscroll_controller() const {
329 return overscroll_controller_.get(); 331 return overscroll_controller_.get();
330 } 332 }
331 333
332 // Called when the context menu is about to be displayed. 334 // Called when the context menu is about to be displayed.
333 void OnShowContextMenu(); 335 // Returns true if the context menu should be displayed. We only return false
336 // on Windows if the context menu is being displayed in response to a long
337 // press gesture. On Windows we should be consistent like other apps and
338 // display the menu when the touch is released.
339 bool OnShowContextMenu(const ContextMenuParams& params);
334 340
335 // Used in tests to set a mock client for touch selection controller. It will 341 // Used in tests to set a mock client for touch selection controller. It will
336 // create a new touch selection controller for the new client. 342 // create a new touch selection controller for the new client.
337 void SetSelectionControllerClientForTest( 343 void SetSelectionControllerClientForTest(
338 scoped_ptr<TouchSelectionControllerClientAura> client); 344 scoped_ptr<TouchSelectionControllerClientAura> client);
339 345
340 protected: 346 protected:
341 ~RenderWidgetHostViewAura() override; 347 ~RenderWidgetHostViewAura() override;
342 348
343 // Exposed for tests. 349 // Exposed for tests.
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 const ui::SelectionBound& start, 514 const ui::SelectionBound& start,
509 const ui::SelectionBound& end); 515 const ui::SelectionBound& end);
510 516
511 // Helper function to create a selection controller. 517 // Helper function to create a selection controller.
512 void CreateSelectionController(); 518 void CreateSelectionController();
513 519
514 // Performs gesture handling needed for touch text selection. Sets event as 520 // Performs gesture handling needed for touch text selection. Sets event as
515 // handled if it should not be further processed. 521 // handled if it should not be further processed.
516 void HandleGestureForTouchSelection(ui::GestureEvent* event); 522 void HandleGestureForTouchSelection(ui::GestureEvent* event);
517 523
524 // Returns the RenderViewHostDelegateView instance for this view. Returns
525 // NULL on failure.
526 RenderViewHostDelegateView* GetRenderViewHostDelegateView();
527
518 // The model object. 528 // The model object.
519 RenderWidgetHostImpl* const host_; 529 RenderWidgetHostImpl* const host_;
520 530
521 aura::Window* window_; 531 aura::Window* window_;
522 532
523 scoped_ptr<DelegatedFrameHost> delegated_frame_host_; 533 scoped_ptr<DelegatedFrameHost> delegated_frame_host_;
524 534
525 scoped_ptr<WindowObserver> window_observer_; 535 scoped_ptr<WindowObserver> window_observer_;
526 536
527 // Tracks the ancestors of the RWHVA window for window location changes. 537 // Tracks the ancestors of the RWHVA window for window location changes.
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 // Set to true if the legacy_render_widget_host_HWND_ instance was destroyed 651 // Set to true if the legacy_render_widget_host_HWND_ instance was destroyed
642 // by Windows. This could happen if the browser window was destroyed by 652 // by Windows. This could happen if the browser window was destroyed by
643 // DestroyWindow for e.g. This flag helps ensure that we don't try to create 653 // DestroyWindow for e.g. This flag helps ensure that we don't try to create
644 // the LegacyRenderWidgetHostHWND instance again as that would be a futile 654 // the LegacyRenderWidgetHostHWND instance again as that would be a futile
645 // exercise. 655 // exercise.
646 bool legacy_window_destroyed_; 656 bool legacy_window_destroyed_;
647 657
648 // Set to true when a context menu is being displayed. Reset to false when 658 // Set to true when a context menu is being displayed. Reset to false when
649 // a mouse leave is received in this context. 659 // a mouse leave is received in this context.
650 bool showing_context_menu_; 660 bool showing_context_menu_;
661
662 // Contains a copy of the last context menu request parameters. Only set when
663 // we receive a request to show the context menu on a long press.
664 scoped_ptr<ContextMenuParams> last_context_menu_params_;
651 #endif 665 #endif
652 666
653 bool has_snapped_to_boundary_; 667 bool has_snapped_to_boundary_;
654 668
655 scoped_ptr<TouchSelectionControllerClientAura> selection_controller_client_; 669 scoped_ptr<TouchSelectionControllerClientAura> selection_controller_client_;
656 scoped_ptr<ui::TouchSelectionController> selection_controller_; 670 scoped_ptr<ui::TouchSelectionController> selection_controller_;
657 671
658 scoped_ptr<OverscrollController> overscroll_controller_; 672 scoped_ptr<OverscrollController> overscroll_controller_;
659 673
660 // The last scroll offset of the view. 674 // The last scroll offset of the view.
(...skipping 25 matching lines...) Expand all
686 float device_scale_factor_; 700 float device_scale_factor_;
687 701
688 base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_; 702 base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_;
689 703
690 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); 704 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura);
691 }; 705 };
692 706
693 } // namespace content 707 } // namespace content
694 708
695 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ 709 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698