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

Unified Diff: content/browser/renderer_host/render_widget_host_view_aura.h

Issue 2317333002: Refactor EventHandler out of RenderWidgetHostViewAura (Closed)
Patch Set: Fix popups 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_widget_host_view_aura.h
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.h b/content/browser/renderer_host/render_widget_host_view_aura.h
index 7667e0fb6cca2e8d199bc0ac2c827e1a6042e63e..83d68c57b38786b23fc676cb924cf9832e7c068d 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.h
+++ b/content/browser/renderer_host/render_widget_host_view_aura.h
@@ -35,22 +35,14 @@
#include "ui/aura/client/cursor_client_observer.h"
#include "ui/aura/client/focus_change_observer.h"
#include "ui/aura/window_delegate.h"
-#include "ui/aura/window_tracker.h"
#include "ui/aura/window_tree_host_observer.h"
#include "ui/base/ime/text_input_client.h"
#include "ui/display/display_observer.h"
-#include "ui/events/gestures/motion_event_aura.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/selection_bound.h"
#include "ui/wm/public/activation_delegate.h"
-namespace aura {
-namespace client {
-class ScopedTooltipDisabler;
-}
-}
-
namespace cc {
class CopyOutputRequest;
class CopyOutputResult;
@@ -80,6 +72,7 @@ class TouchSelectionController;
}
namespace content {
+class RenderWidgetHostViewEventHandler;
#if defined(OS_WIN)
class LegacyRenderWidgetHostHWND;
#endif
@@ -129,6 +122,7 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
bool IsShowing() override;
gfx::Rect GetViewBounds() const override;
void SetBackgroundColor(SkColor color) override;
+ bool IsMouseLocked() override;
gfx::Size GetVisibleViewportSize() const override;
void SetInsets(const gfx::Insets& insets) override;
void FocusedNodeTouched(const gfx::Point& location_dips_screen,
@@ -331,6 +325,30 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
// Exposed for tests.
cc::SurfaceId SurfaceIdForTesting() const override;
+ // Converts |rect| from window coordinate to screen coordinate.
+ gfx::Rect ConvertRectToScreen(const gfx::Rect& rect) const;
+
+ RenderFrameHostImpl* GetFocusedFrame();
+
+ // Before calling RenderWidgetHost::ForwardKeyboardEvent(), this method
+ // calls our keybindings handler against the event and send matched
+ // edit commands to renderer instead.
+ void ForwardKeyboardEvent(const NativeWebKeyboardEvent& event);
+
+ // Returns whether the widget needs to grab mouse capture to work properly.
+ bool NeedsMouseCapture();
+
+ // Sends shutdown request.
+ void Shutdown();
+
+ RenderWidgetHostViewEventHandler* event_handler() {
+ return event_handler_.get();
+ }
+
+ bool is_fullscreen() { return is_fullscreen_; }
+
+ blink::WebPopupType popup_type() { return popup_type_; }
+
protected:
~RenderWidgetHostViewAura() override;
@@ -341,8 +359,6 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
return delegated_frame_host_.get();
}
- const ui::MotionEventAura& pointer_state() const { return pointer_state_; }
-
private:
friend class InputMethodAuraTestBase;
friend class RenderWidgetHostViewAuraCopyRequestTest;
@@ -408,23 +424,9 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
ui::InputMethod* GetInputMethod() const;
- // Sends shutdown request.
- void Shutdown();
-
// Returns whether the widget needs an input grab to work properly.
bool NeedsInputGrab();
- // Returns whether the widget needs to grab mouse capture to work properly.
- bool NeedsMouseCapture();
-
- // Confirm existing composition text in the webpage and ask the input method
- // to cancel its ongoing composition session.
- void FinishImeCompositionSession();
-
- // This method computes movementX/Y and keeps track of mouse location for
- // mouse lock on all mouse move events.
- void ModifyEventMovementAndCoords(blink::WebMouseEvent* event);
-
// Sends an IPC to the renderer process to communicate whether or not
// the mouse cursor is visible anywhere on the screen.
void NotifyRendererOfCursorVisibilityState(bool is_visible);
@@ -433,10 +435,6 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
// SchedulePaint() is invoked for |rect|.
void SchedulePaintIfNotInClip(const gfx::Rect& rect, const gfx::Rect& clip);
- // Helper method to determine if, in mouse locked mode, the cursor should be
- // moved to center.
- bool ShouldMoveToCenter();
-
// Called after |window_| is parented to a WindowEventDispatcher.
void AddedToRootWindow();
@@ -480,34 +478,13 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
// Detaches |this| from the input method object.
void DetachFromInputMethod();
- // Before calling RenderWidgetHost::ForwardKeyboardEvent(), this method
- // calls our keybindings handler against the event and send matched
- // edit commands to renderer instead.
- void ForwardKeyboardEvent(const NativeWebKeyboardEvent& event);
-
// Dismisses a Web Popup on a mouse or touch press outside the popup and its
// parent.
void ApplyEventFilterForPopupExit(ui::LocatedEvent* event);
- // Converts |rect| from window coordinate to screen coordinate.
- gfx::Rect ConvertRectToScreen(const gfx::Rect& rect) const;
-
// Converts |rect| from screen coordinate to window coordinate.
gfx::Rect ConvertRectFromScreen(const gfx::Rect& rect) const;
- // Helper function to set keyboard focus to the main window.
- void SetKeyboardFocus();
-
- RenderFrameHostImpl* GetFocusedFrame();
-
- // Returns true if the |event| passed in can be forwarded to the renderer.
- bool CanRendererHandleEvent(const ui::MouseEvent* event,
- bool mouse_locked,
- bool selection_popup) const;
-
- // Returns true when we can do SurfaceHitTesting for the event type.
- bool ShouldRouteEvent(const ui::Event* event) const;
-
// Called when the parent window bounds change.
void HandleParentBoundsChanged();
@@ -524,16 +501,9 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
// Helper function to create a selection controller.
void CreateSelectionController();
- // Performs gesture handling needed for touch text selection. Sets event as
- // handled if it should not be further processed.
- void HandleGestureForTouchSelection(ui::GestureEvent* event);
-
- // Forwards a mouse event to this view's parent window delegate.
- void ForwardMouseEventToParent(ui::MouseEvent* event);
-
- // Returns the RenderViewHostDelegateView instance for this view. Returns
- // NULL on failure.
- RenderViewHostDelegateView* GetRenderViewHostDelegateView();
+ // Used to set the |popup_child_host_view_| on the |popup_parent_host_view_|
+ // and to notify the |event_handler_|.
+ void SetPopupChildHostView(RenderWidgetHostViewAura* popup_child_host_view);
// The model object.
RenderWidgetHostImpl* const host_;
@@ -574,17 +544,9 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
// The cursor for the page. This is passed up from the renderer.
WebCursor current_cursor_;
- // Stores the current state of the active pointers targeting this
- // object.
- ui::MotionEventAura pointer_state_;
-
-
// Indicates if there is onging composition text.
bool has_composition_text_;
- // Whether return characters should be passed on to the RenderWidgetHostImpl.
- bool accept_return_character_;
-
// Current tooltip text.
base::string16 tooltip_;
@@ -593,25 +555,6 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
cc::BeginFrameArgs last_begin_frame_args_;
bool needs_begin_frames_;
- // Used to record the last position of the mouse.
- // While the mouse is locked, they store the last known position just as mouse
- // lock was entered.
- // Relative to the upper-left corner of the view.
- gfx::Point unlocked_mouse_position_;
- // Relative to the upper-left corner of the screen.
- gfx::Point unlocked_global_mouse_position_;
- // Last cursor position relative to screen. Used to compute movementX/Y.
- gfx::Point global_mouse_position_;
- // In mouse locked mode, we synthetically move the mouse cursor to the center
- // of the window when it reaches the window borders to avoid it going outside.
- // This flag is used to differentiate between these synthetic mouse move
- // events vs. normal mouse move events.
- bool synthetic_move_sent_;
-
- // Used to track the state of the window we're created from. Only used when
- // created fullscreen.
- std::unique_ptr<aura::WindowTracker> host_tracker_;
-
// Used to track the last cursor visibility update that was sent to the
// renderer via NotifyRendererOfCursorVisibilityState().
enum CursorVisibilityState {
@@ -663,28 +606,21 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
std::vector<ui::LatencyInfo> software_latency_info_;
- std::unique_ptr<aura::client::ScopedTooltipDisabler> tooltip_disabler_;
-
// True when this view acts as a platform view hack for a
// RenderWidgetHostViewGuest.
bool is_guest_view_hack_;
- // This flag when set ensures that we send over a notification to blink that
- // the current view has focus. Defaults to false.
- bool set_focus_on_mouse_down_or_key_event_;
-
float device_scale_factor_;
- // Allows tests to send gesture events for testing without first sending a
- // corresponding touch sequence, as would be required by
- // RenderWidgetHostInputEventRouter.
- bool disable_input_event_router_for_testing_;
-
// The routing and process IDs for the last RenderWidgetHost which had a
// TextInputState of non-NONE.
int32_t last_active_widget_process_id_;
int32_t last_active_widget_routing_id_;
+ // While this is an ui::EventHandler for targetting, |event_handler_| actually
+ // provides an implementation, and directs events to |host_|.
+ std::unique_ptr<RenderWidgetHostViewEventHandler> event_handler_;
+
base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura);

Powered by Google App Engine
This is Rietveld 408576698