| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 size_t offset, | 90 size_t offset, |
| 92 const gfx::Range& range) override; | 91 const gfx::Range& range) override; |
| 93 void SelectionBoundsChanged( | 92 void SelectionBoundsChanged( |
| 94 const ViewHostMsg_SelectionBounds_Params& params) override; | 93 const ViewHostMsg_SelectionBounds_Params& params) override; |
| 95 void OnSwapCompositorFrame(uint32 output_surface_id, | 94 void OnSwapCompositorFrame(uint32 output_surface_id, |
| 96 scoped_ptr<cc::CompositorFrame> frame) override; | 95 scoped_ptr<cc::CompositorFrame> frame) override; |
| 97 #if defined(USE_AURA) | 96 #if defined(USE_AURA) |
| 98 void ProcessAckedTouchEvent(const TouchEventWithLatencyInfo& touch, | 97 void ProcessAckedTouchEvent(const TouchEventWithLatencyInfo& touch, |
| 99 InputEventAckState ack_result) override; | 98 InputEventAckState ack_result) override; |
| 100 #endif | 99 #endif |
| 100 void ProcessTouchEvent(const blink::WebTouchEvent& event, |
| 101 const ui::LatencyInfo& latency) override; |
| 101 bool LockMouse() override; | 102 bool LockMouse() override; |
| 102 void UnlockMouse() override; | 103 void UnlockMouse() override; |
| 103 void GetScreenInfo(blink::WebScreenInfo* results) override; | 104 void GetScreenInfo(blink::WebScreenInfo* results) override; |
| 104 bool GetScreenColorProfile(std::vector<char>* color_profile) override; | 105 bool GetScreenColorProfile(std::vector<char>* color_profile) override; |
| 105 | 106 |
| 106 #if defined(OS_MACOSX) | 107 #if defined(OS_MACOSX) |
| 107 // RenderWidgetHostView implementation. | 108 // RenderWidgetHostView implementation. |
| 108 void SetActive(bool active) override; | 109 void SetActive(bool active) override; |
| 109 void SetWindowVisibility(bool visible) override; | 110 void SetWindowVisibility(bool visible) override; |
| 110 void WindowFrameChanged() override; | 111 void WindowFrameChanged() override; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 133 gfx::NativeViewAccessible accessible_parent) override; | 134 gfx::NativeViewAccessible accessible_parent) override; |
| 134 gfx::NativeViewId GetParentForWindowlessPlugin() const override; | 135 gfx::NativeViewId GetParentForWindowlessPlugin() const override; |
| 135 #endif | 136 #endif |
| 136 | 137 |
| 137 void WheelEventAck(const blink::WebMouseWheelEvent& event, | 138 void WheelEventAck(const blink::WebMouseWheelEvent& event, |
| 138 InputEventAckState ack_result) override; | 139 InputEventAckState ack_result) override; |
| 139 | 140 |
| 140 void GestureEventAck(const blink::WebGestureEvent& event, | 141 void GestureEventAck(const blink::WebGestureEvent& event, |
| 141 InputEventAckState ack_result) override; | 142 InputEventAckState ack_result) override; |
| 142 | 143 |
| 143 // Overridden from ui::GestureEventHelper. | |
| 144 bool CanDispatchToConsumer(ui::GestureConsumer* consumer) override; | |
| 145 void DispatchGestureEvent(ui::GestureEvent* event) override; | |
| 146 void DispatchCancelTouchEvent(ui::TouchEvent* event) override; | |
| 147 | |
| 148 protected: | 144 protected: |
| 149 friend class RenderWidgetHostView; | 145 friend class RenderWidgetHostView; |
| 150 | 146 |
| 151 private: | 147 private: |
| 152 // Destroys this view without calling |Destroy| on |platform_view_|. | 148 // Destroys this view without calling |Destroy| on |platform_view_|. |
| 153 void DestroyGuestView(); | 149 void DestroyGuestView(); |
| 154 | 150 |
| 155 // Builds and forwards a WebKitGestureEvent to the renderer. | 151 // Builds and forwards a WebKitGestureEvent to the renderer. |
| 156 bool ForwardGestureEventToRenderer(ui::GestureEvent* gesture); | 152 bool ForwardGestureEventToRenderer(ui::GestureEvent* gesture); |
| 157 | 153 |
| 158 // Process all of the given gestures (passes them on to renderer) | 154 // Process all of the given gestures (passes them on to renderer) |
| 159 void ProcessGestures(ui::GestureRecognizer::Gestures* gestures); | 155 void ProcessGestures(ui::GestureRecognizer::Gestures* gestures); |
| 160 | 156 |
| 161 RenderWidgetHostViewBase* GetOwnerRenderWidgetHostView() const; | 157 RenderWidgetHostViewBase* GetOwnerRenderWidgetHostView() const; |
| 162 | 158 |
| 163 void OnHandleInputEvent(RenderWidgetHostImpl* embedder, | 159 void OnHandleInputEvent(RenderWidgetHostImpl* embedder, |
| 164 int browser_plugin_instance_id, | 160 int browser_plugin_instance_id, |
| 165 const gfx::Rect& guest_window_rect, | 161 const gfx::Rect& guest_window_rect, |
| 166 const blink::WebInputEvent* event); | 162 const blink::WebInputEvent* event); |
| 167 | 163 |
| 164 bool has_started_rendering_; |
| 165 |
| 168 // BrowserPluginGuest and RenderWidgetHostViewGuest's lifetimes are not tied | 166 // BrowserPluginGuest and RenderWidgetHostViewGuest's lifetimes are not tied |
| 169 // to one another, therefore we access |guest_| through WeakPtr. | 167 // to one another, therefore we access |guest_| through WeakPtr. |
| 170 base::WeakPtr<BrowserPluginGuest> guest_; | 168 base::WeakPtr<BrowserPluginGuest> guest_; |
| 171 gfx::Size size_; | 169 gfx::Size size_; |
| 172 // The platform view for this RenderWidgetHostView. | 170 // The platform view for this RenderWidgetHostView. |
| 173 // RenderWidgetHostViewGuest mostly only cares about stuff related to | 171 // RenderWidgetHostViewGuest mostly only cares about stuff related to |
| 174 // compositing, the rest are directly forwared to this |platform_view_|. | 172 // compositing, the rest are directly forwared to this |platform_view_|. |
| 175 base::WeakPtr<RenderWidgetHostViewBase> platform_view_; | 173 base::WeakPtr<RenderWidgetHostViewBase> platform_view_; |
| 176 #if defined(USE_AURA) | |
| 177 scoped_ptr<ui::GestureRecognizer> gesture_recognizer_; | |
| 178 #endif | |
| 179 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewGuest); | 174 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewGuest); |
| 180 }; | 175 }; |
| 181 | 176 |
| 182 } // namespace content | 177 } // namespace content |
| 183 | 178 |
| 184 #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 |