| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_GUEST_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_GUEST_H_ |
| 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_GUEST_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_GUEST_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // functionality in a diffent place and isn't platform specific. | 32 // functionality in a diffent place and isn't platform specific. |
| 33 // The BrowserPlugin is currently a special case for out-of-process rendered | 33 // The BrowserPlugin is currently a special case for out-of-process rendered |
| 34 // content and therefore inherits from RenderWidgetHostViewChildFrame. | 34 // content and therefore inherits from RenderWidgetHostViewChildFrame. |
| 35 // Eventually all RenderWidgetHostViewGuest code will be subsumed by | 35 // Eventually all RenderWidgetHostViewGuest code will be subsumed by |
| 36 // RenderWidgetHostViewChildFrame and this class will be removed. | 36 // RenderWidgetHostViewChildFrame and this class will be removed. |
| 37 // | 37 // |
| 38 // Some elements that are platform specific will be deal with by delegating | 38 // Some elements that are platform specific will be deal with by delegating |
| 39 // the relevant calls to the platform view. | 39 // the relevant calls to the platform view. |
| 40 class CONTENT_EXPORT RenderWidgetHostViewGuest | 40 class CONTENT_EXPORT RenderWidgetHostViewGuest |
| 41 : public RenderWidgetHostViewChildFrame, | 41 : public RenderWidgetHostViewChildFrame, |
| 42 public ui::GestureConsumer, | 42 public ui::GestureConsumer { |
| 43 public ui::GestureEventHelper { | |
| 44 public: | 43 public: |
| 45 RenderWidgetHostViewGuest( | 44 RenderWidgetHostViewGuest( |
| 46 RenderWidgetHost* widget, | 45 RenderWidgetHost* widget, |
| 47 BrowserPluginGuest* guest, | 46 BrowserPluginGuest* guest, |
| 48 base::WeakPtr<RenderWidgetHostViewBase> platform_view); | 47 base::WeakPtr<RenderWidgetHostViewBase> platform_view); |
| 49 ~RenderWidgetHostViewGuest() override; | 48 ~RenderWidgetHostViewGuest() override; |
| 50 | 49 |
| 51 bool OnMessageReceivedFromEmbedder(const IPC::Message& message, | 50 bool OnMessageReceivedFromEmbedder(const IPC::Message& message, |
| 52 RenderWidgetHostImpl* embedder); | 51 RenderWidgetHostImpl* embedder); |
| 53 | 52 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 size_t offset, | 89 size_t offset, |
| 91 const gfx::Range& range) override; | 90 const gfx::Range& range) override; |
| 92 void SelectionBoundsChanged( | 91 void SelectionBoundsChanged( |
| 93 const ViewHostMsg_SelectionBounds_Params& params) override; | 92 const ViewHostMsg_SelectionBounds_Params& params) override; |
| 94 void OnSwapCompositorFrame(uint32 output_surface_id, | 93 void OnSwapCompositorFrame(uint32 output_surface_id, |
| 95 scoped_ptr<cc::CompositorFrame> frame) override; | 94 scoped_ptr<cc::CompositorFrame> frame) override; |
| 96 #if defined(USE_AURA) | 95 #if defined(USE_AURA) |
| 97 void ProcessAckedTouchEvent(const TouchEventWithLatencyInfo& touch, | 96 void ProcessAckedTouchEvent(const TouchEventWithLatencyInfo& touch, |
| 98 InputEventAckState ack_result) override; | 97 InputEventAckState ack_result) override; |
| 99 #endif | 98 #endif |
| 99 void ProcessTouchEvent(const blink::WebTouchEvent& event, |
| 100 const ui::LatencyInfo& latency) override; |
| 101 void RegisterSurfaceNamespaceId(); |
| 102 void UnregisterSurfaceNamespaceId(); |
| 103 |
| 100 bool LockMouse() override; | 104 bool LockMouse() override; |
| 101 void UnlockMouse() override; | 105 void UnlockMouse() override; |
| 102 void GetScreenInfo(blink::WebScreenInfo* results) override; | 106 void GetScreenInfo(blink::WebScreenInfo* results) override; |
| 103 bool GetScreenColorProfile(std::vector<char>* color_profile) override; | 107 bool GetScreenColorProfile(std::vector<char>* color_profile) override; |
| 104 | 108 |
| 105 #if defined(OS_MACOSX) | 109 #if defined(OS_MACOSX) |
| 106 // RenderWidgetHostView implementation. | 110 // RenderWidgetHostView implementation. |
| 107 void SetActive(bool active) override; | 111 void SetActive(bool active) override; |
| 108 void SetWindowVisibility(bool visible) override; | 112 void SetWindowVisibility(bool visible) override; |
| 109 void WindowFrameChanged() override; | 113 void WindowFrameChanged() override; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 132 gfx::NativeViewAccessible accessible_parent) override; | 136 gfx::NativeViewAccessible accessible_parent) override; |
| 133 gfx::NativeViewId GetParentForWindowlessPlugin() const override; | 137 gfx::NativeViewId GetParentForWindowlessPlugin() const override; |
| 134 #endif | 138 #endif |
| 135 | 139 |
| 136 void WheelEventAck(const blink::WebMouseWheelEvent& event, | 140 void WheelEventAck(const blink::WebMouseWheelEvent& event, |
| 137 InputEventAckState ack_result) override; | 141 InputEventAckState ack_result) override; |
| 138 | 142 |
| 139 void GestureEventAck(const blink::WebGestureEvent& event, | 143 void GestureEventAck(const blink::WebGestureEvent& event, |
| 140 InputEventAckState ack_result) override; | 144 InputEventAckState ack_result) override; |
| 141 | 145 |
| 142 // Overridden from ui::GestureEventHelper. | |
| 143 bool CanDispatchToConsumer(ui::GestureConsumer* consumer) override; | |
| 144 void DispatchGestureEvent(ui::GestureEvent* event) override; | |
| 145 void DispatchCancelTouchEvent(ui::TouchEvent* event) override; | |
| 146 | |
| 147 protected: | 146 protected: |
| 148 friend class RenderWidgetHostView; | 147 friend class RenderWidgetHostView; |
| 149 | 148 |
| 150 private: | 149 private: |
| 151 // Destroys this view without calling |Destroy| on |platform_view_|. | 150 // Destroys this view without calling |Destroy| on |platform_view_|. |
| 152 void DestroyGuestView(); | 151 void DestroyGuestView(); |
| 153 | 152 |
| 154 // Builds and forwards a WebKitGestureEvent to the renderer. | 153 // Builds and forwards a WebKitGestureEvent to the renderer. |
| 155 bool ForwardGestureEventToRenderer(ui::GestureEvent* gesture); | 154 bool ForwardGestureEventToRenderer(ui::GestureEvent* gesture); |
| 156 | 155 |
| 157 // Process all of the given gestures (passes them on to renderer) | 156 // Process all of the given gestures (passes them on to renderer) |
| 158 void ProcessGestures(ui::GestureRecognizer::Gestures* gestures); | 157 void ProcessGestures(ui::GestureRecognizer::Gestures* gestures); |
| 159 | 158 |
| 160 RenderWidgetHostViewBase* GetOwnerRenderWidgetHostView() const; | 159 RenderWidgetHostViewBase* GetOwnerRenderWidgetHostView() const; |
| 161 | 160 |
| 162 void OnHandleInputEvent(RenderWidgetHostImpl* embedder, | 161 void OnHandleInputEvent(RenderWidgetHostImpl* embedder, |
| 163 int browser_plugin_instance_id, | 162 int browser_plugin_instance_id, |
| 164 const gfx::Rect& guest_window_rect, | 163 const gfx::Rect& guest_window_rect, |
| 165 const blink::WebInputEvent* event); | 164 const blink::WebInputEvent* event); |
| 166 | 165 |
| 167 // BrowserPluginGuest and RenderWidgetHostViewGuest's lifetimes are not tied | 166 // BrowserPluginGuest and RenderWidgetHostViewGuest's lifetimes are not tied |
| 168 // to one another, therefore we access |guest_| through WeakPtr. | 167 // to one another, therefore we access |guest_| through WeakPtr. |
| 169 base::WeakPtr<BrowserPluginGuest> guest_; | 168 base::WeakPtr<BrowserPluginGuest> guest_; |
| 170 gfx::Size size_; | 169 gfx::Size size_; |
| 171 // The platform view for this RenderWidgetHostView. | 170 // The platform view for this RenderWidgetHostView. |
| 172 // RenderWidgetHostViewGuest mostly only cares about stuff related to | 171 // RenderWidgetHostViewGuest mostly only cares about stuff related to |
| 173 // compositing, the rest are directly forwared to this |platform_view_|. | 172 // compositing, the rest are directly forwared to this |platform_view_|. |
| 174 base::WeakPtr<RenderWidgetHostViewBase> platform_view_; | 173 base::WeakPtr<RenderWidgetHostViewBase> platform_view_; |
| 175 #if defined(USE_AURA) | |
| 176 scoped_ptr<ui::GestureRecognizer> gesture_recognizer_; | |
| 177 #endif | |
| 178 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewGuest); | 174 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewGuest); |
| 179 }; | 175 }; |
| 180 | 176 |
| 181 } // namespace content | 177 } // namespace content |
| 182 | 178 |
| 183 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_GUEST_H_ | 179 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_GUEST_H_ |
| OLD | NEW |