| OLD | NEW |
| 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_ANDROID_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <queue> |
| 9 | 10 |
| 10 #include "base/callback.h" | 11 #include "base/callback.h" |
| 11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 12 #include "base/i18n/rtl.h" | 13 #include "base/i18n/rtl.h" |
| 13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/process.h" | 15 #include "base/process.h" |
| 16 #include "cc/layers/texture_layer_client.h" |
| 15 #include "content/browser/renderer_host/ime_adapter_android.h" | 17 #include "content/browser/renderer_host/ime_adapter_android.h" |
| 16 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 18 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 17 #include "gpu/command_buffer/common/mailbox.h" | 19 #include "gpu/command_buffer/common/mailbox.h" |
| 18 #include "third_party/skia/include/core/SkColor.h" | 20 #include "third_party/skia/include/core/SkColor.h" |
| 19 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" | 21 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" |
| 20 #include "ui/gfx/size.h" | 22 #include "ui/gfx/size.h" |
| 21 #include "ui/gfx/vector2d_f.h" | 23 #include "ui/gfx/vector2d_f.h" |
| 22 | 24 |
| 23 struct ViewHostMsg_TextInputState_Params; | 25 struct ViewHostMsg_TextInputState_Params; |
| 24 | 26 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 39 namespace content { | 41 namespace content { |
| 40 class ContentViewCoreImpl; | 42 class ContentViewCoreImpl; |
| 41 class RenderWidgetHost; | 43 class RenderWidgetHost; |
| 42 class RenderWidgetHostImpl; | 44 class RenderWidgetHostImpl; |
| 43 class SurfaceTextureTransportClient; | 45 class SurfaceTextureTransportClient; |
| 44 struct NativeWebKeyboardEvent; | 46 struct NativeWebKeyboardEvent; |
| 45 | 47 |
| 46 // ----------------------------------------------------------------------------- | 48 // ----------------------------------------------------------------------------- |
| 47 // See comments in render_widget_host_view.h about this class and its members. | 49 // See comments in render_widget_host_view.h about this class and its members. |
| 48 // ----------------------------------------------------------------------------- | 50 // ----------------------------------------------------------------------------- |
| 49 class RenderWidgetHostViewAndroid : public RenderWidgetHostViewBase { | 51 class RenderWidgetHostViewAndroid : public RenderWidgetHostViewBase, |
| 52 public cc::TextureLayerClient { |
| 50 public: | 53 public: |
| 51 RenderWidgetHostViewAndroid(RenderWidgetHostImpl* widget, | 54 RenderWidgetHostViewAndroid(RenderWidgetHostImpl* widget, |
| 52 ContentViewCoreImpl* content_view_core); | 55 ContentViewCoreImpl* content_view_core); |
| 53 virtual ~RenderWidgetHostViewAndroid(); | 56 virtual ~RenderWidgetHostViewAndroid(); |
| 54 | 57 |
| 55 // RenderWidgetHostView implementation. | 58 // RenderWidgetHostView implementation. |
| 56 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 59 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
| 57 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE; | 60 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE; |
| 58 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view, | 61 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view, |
| 59 const gfx::Rect& pos) OVERRIDE; | 62 const gfx::Rect& pos) OVERRIDE; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 const std::vector<AccessibilityHostMsg_NotificationParams>& | 143 const std::vector<AccessibilityHostMsg_NotificationParams>& |
| 141 params) OVERRIDE; | 144 params) OVERRIDE; |
| 142 virtual bool LockMouse() OVERRIDE; | 145 virtual bool LockMouse() OVERRIDE; |
| 143 virtual void UnlockMouse() OVERRIDE; | 146 virtual void UnlockMouse() OVERRIDE; |
| 144 virtual void HasTouchEventHandlers(bool need_touch_events) OVERRIDE; | 147 virtual void HasTouchEventHandlers(bool need_touch_events) OVERRIDE; |
| 145 virtual void OnSwapCompositorFrame( | 148 virtual void OnSwapCompositorFrame( |
| 146 scoped_ptr<cc::CompositorFrame> frame) OVERRIDE; | 149 scoped_ptr<cc::CompositorFrame> frame) OVERRIDE; |
| 147 virtual void ShowDisambiguationPopup(const gfx::Rect& target_rect, | 150 virtual void ShowDisambiguationPopup(const gfx::Rect& target_rect, |
| 148 const SkBitmap& zoomed_bitmap) OVERRIDE; | 151 const SkBitmap& zoomed_bitmap) OVERRIDE; |
| 149 | 152 |
| 153 // cc::TextureLayerClient implementation. |
| 154 virtual unsigned PrepareTexture(cc::ResourceUpdateQueue* queue) OVERRIDE; |
| 155 virtual WebKit::WebGraphicsContext3D* Context3d() OVERRIDE; |
| 156 virtual bool PrepareTextureMailbox(cc::TextureMailbox* mailbox) OVERRIDE { |
| 157 return false; |
| 158 } |
| 159 |
| 150 // Non-virtual methods | 160 // Non-virtual methods |
| 151 void SetContentViewCore(ContentViewCoreImpl* content_view_core); | 161 void SetContentViewCore(ContentViewCoreImpl* content_view_core); |
| 152 SkColor GetCachedBackgroundColor() const; | 162 SkColor GetCachedBackgroundColor() const; |
| 153 void SendKeyEvent(const NativeWebKeyboardEvent& event); | 163 void SendKeyEvent(const NativeWebKeyboardEvent& event); |
| 154 void SendTouchEvent(const WebKit::WebTouchEvent& event); | 164 void SendTouchEvent(const WebKit::WebTouchEvent& event); |
| 155 void SendMouseEvent(const WebKit::WebMouseEvent& event); | 165 void SendMouseEvent(const WebKit::WebMouseEvent& event); |
| 156 void SendMouseWheelEvent(const WebKit::WebMouseWheelEvent& event); | 166 void SendMouseWheelEvent(const WebKit::WebMouseWheelEvent& event); |
| 157 void SendGestureEvent(const WebKit::WebGestureEvent& event); | 167 void SendGestureEvent(const WebKit::WebGestureEvent& event); |
| 158 | 168 |
| 159 void OnProcessImeBatchStateAck(bool is_begin); | 169 void OnProcessImeBatchStateAck(bool is_begin); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 173 void SelectRange(const gfx::Point& start, const gfx::Point& end); | 183 void SelectRange(const gfx::Point& start, const gfx::Point& end); |
| 174 | 184 |
| 175 void MoveCaret(const gfx::Point& point); | 185 void MoveCaret(const gfx::Point& point); |
| 176 | 186 |
| 177 private: | 187 private: |
| 178 void BuffersSwapped(const gpu::Mailbox& mailbox, | 188 void BuffersSwapped(const gpu::Mailbox& mailbox, |
| 179 const gfx::Size texture_size, | 189 const gfx::Size texture_size, |
| 180 const gfx::SizeF content_size, | 190 const gfx::SizeF content_size, |
| 181 const base::Closure& ack_callback); | 191 const base::Closure& ack_callback); |
| 182 | 192 |
| 193 void RunAckCallbacks(); |
| 194 |
| 183 // The model object. | 195 // The model object. |
| 184 RenderWidgetHostImpl* host_; | 196 RenderWidgetHostImpl* host_; |
| 185 | 197 |
| 186 // Whether or not this widget is potentially attached to the view hierarchy. | 198 // Whether or not this widget is potentially attached to the view hierarchy. |
| 187 // This view may not actually be attached if this is true, but it should be | 199 // This view may not actually be attached if this is true, but it should be |
| 188 // treated as such, because as soon as a ContentViewCore is set the layer | 200 // treated as such, because as soon as a ContentViewCore is set the layer |
| 189 // will be attached automatically. | 201 // will be attached automatically. |
| 190 bool is_layer_attached_; | 202 bool is_layer_attached_; |
| 191 | 203 |
| 192 // ContentViewCoreImpl is our interface to the view system. | 204 // ContentViewCoreImpl is our interface to the view system. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 213 | 225 |
| 214 // Used for image transport when needing to share resources across threads. | 226 // Used for image transport when needing to share resources across threads. |
| 215 scoped_ptr<SurfaceTextureTransportClient> surface_texture_transport_; | 227 scoped_ptr<SurfaceTextureTransportClient> surface_texture_transport_; |
| 216 | 228 |
| 217 // The mailbox of the previously received frame. | 229 // The mailbox of the previously received frame. |
| 218 gpu::Mailbox current_mailbox_; | 230 gpu::Mailbox current_mailbox_; |
| 219 | 231 |
| 220 // The mailbox of the frame we last returned. | 232 // The mailbox of the frame we last returned. |
| 221 gpu::Mailbox last_mailbox_; | 233 gpu::Mailbox last_mailbox_; |
| 222 | 234 |
| 235 bool consumed_current_texture_; |
| 236 |
| 237 std::queue<base::Closure> ack_callbacks_; |
| 238 |
| 223 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); | 239 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); |
| 224 }; | 240 }; |
| 225 | 241 |
| 226 } // namespace content | 242 } // namespace content |
| 227 | 243 |
| 228 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ | 244 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ |
| OLD | NEW |