| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_RENDERER_RENDER_WIDGET_H_ | 5 #ifndef CONTENT_RENDERER_RENDER_WIDGET_H_ |
| 6 #define CONTENT_RENDERER_RENDER_WIDGET_H_ | 6 #define CONTENT_RENDERER_RENDER_WIDGET_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 // the next paint or scroll message to the host. | 115 // the next paint or scroll message to the host. |
| 116 void SchedulePluginMove(const webkit::npapi::WebPluginGeometry& move); | 116 void SchedulePluginMove(const webkit::npapi::WebPluginGeometry& move); |
| 117 | 117 |
| 118 // Called when a plugin window has been destroyed, to make sure the currently | 118 // Called when a plugin window has been destroyed, to make sure the currently |
| 119 // pending moves don't try to reference it. | 119 // pending moves don't try to reference it. |
| 120 void CleanupWindowInPluginMoves(gfx::PluginWindowHandle window); | 120 void CleanupWindowInPluginMoves(gfx::PluginWindowHandle window); |
| 121 | 121 |
| 122 // Close the underlying WebWidget. | 122 // Close the underlying WebWidget. |
| 123 virtual void Close(); | 123 virtual void Close(); |
| 124 | 124 |
| 125 // TODO(backer): Where does this go? is it public? |
| 126 gfx::PluginWindowHandle compositing_surface() const { |
| 127 return compositing_surface_; |
| 128 } |
| 129 |
| 125 protected: | 130 protected: |
| 126 // Friend RefCounted so that the dtor can be non-public. Using this class | 131 // Friend RefCounted so that the dtor can be non-public. Using this class |
| 127 // without ref-counting is an error. | 132 // without ref-counting is an error. |
| 128 friend class base::RefCounted<RenderWidget>; | 133 friend class base::RefCounted<RenderWidget>; |
| 129 // For unit tests. | 134 // For unit tests. |
| 130 friend class RenderWidgetTest; | 135 friend class RenderWidgetTest; |
| 131 | 136 |
| 132 RenderWidget(RenderThreadBase* render_thread, | 137 RenderWidget(RenderThreadBase* render_thread, |
| 133 WebKit::WebPopupType popup_type); | 138 WebKit::WebPopupType popup_type); |
| 134 virtual ~RenderWidget(); | 139 virtual ~RenderWidget(); |
| 135 | 140 |
| 136 // Initializes this view with the given opener. CompleteInit must be called | 141 // Initializes this view with the given opener. CompleteInit must be called |
| 137 // later. | 142 // later. |
| 138 void Init(int32 opener_id); | 143 void Init(int32 opener_id); |
| 139 | 144 |
| 140 // Called by Init and subclasses to perform initialization. | 145 // Called by Init and subclasses to perform initialization. |
| 141 void DoInit(int32 opener_id, | 146 void DoInit(int32 opener_id, |
| 142 WebKit::WebWidget* web_widget, | 147 WebKit::WebWidget* web_widget, |
| 143 IPC::SyncMessage* create_widget_message); | 148 IPC::SyncMessage* create_widget_message); |
| 144 | 149 |
| 145 // Finishes creation of a pending view started with Init. | 150 // Finishes creation of a pending view started with Init. |
| 146 void CompleteInit(gfx::NativeViewId parent); | 151 void CompleteInit(gfx::NativeViewId parent, |
| 152 gfx::PluginWindowHandle compositing_surface); |
| 147 | 153 |
| 148 // Paints the given rectangular region of the WebWidget into canvas (a | 154 // Paints the given rectangular region of the WebWidget into canvas (a |
| 149 // shared memory segment returned by AllocPaintBuf on Windows). The caller | 155 // shared memory segment returned by AllocPaintBuf on Windows). The caller |
| 150 // must ensure that the given rect fits within the bounds of the WebWidget. | 156 // must ensure that the given rect fits within the bounds of the WebWidget. |
| 151 void PaintRect(const gfx::Rect& rect, const gfx::Point& canvas_origin, | 157 void PaintRect(const gfx::Rect& rect, const gfx::Point& canvas_origin, |
| 152 skia::PlatformCanvas* canvas); | 158 skia::PlatformCanvas* canvas); |
| 153 | 159 |
| 154 // Paints a border at the given rect for debugging purposes. | 160 // Paints a border at the given rect for debugging purposes. |
| 155 void PaintDebugBorder(const gfx::Rect& rect, skia::PlatformCanvas* canvas); | 161 void PaintDebugBorder(const gfx::Rect& rect, skia::PlatformCanvas* canvas); |
| 156 | 162 |
| 157 void AnimationCallback(); | 163 void AnimationCallback(); |
| 158 void AnimateIfNeeded(); | 164 void AnimateIfNeeded(); |
| 159 void CallDoDeferredUpdate(); | 165 void CallDoDeferredUpdate(); |
| 160 void DoDeferredUpdate(); | 166 void DoDeferredUpdate(); |
| 161 void DoDeferredClose(); | 167 void DoDeferredClose(); |
| 162 void DoDeferredSetWindowRect(const WebKit::WebRect& pos); | 168 void DoDeferredSetWindowRect(const WebKit::WebRect& pos); |
| 163 | 169 |
| 164 // Set the background of the render widget to a bitmap. The bitmap will be | 170 // Set the background of the render widget to a bitmap. The bitmap will be |
| 165 // tiled in both directions if it isn't big enough to fill the area. This is | 171 // tiled in both directions if it isn't big enough to fill the area. This is |
| 166 // mainly intended to be used in conjuction with WebView::SetIsTransparent(). | 172 // mainly intended to be used in conjuction with WebView::SetIsTransparent(). |
| 167 virtual void SetBackground(const SkBitmap& bitmap); | 173 virtual void SetBackground(const SkBitmap& bitmap); |
| 168 | 174 |
| 169 // RenderWidget IPC message handlers | 175 // RenderWidget IPC message handlers |
| 170 void OnClose(); | 176 void OnClose(); |
| 171 void OnCreatingNewAck(gfx::NativeViewId parent); | 177 void OnCreatingNewAck(gfx::NativeViewId parent, |
| 178 gfx::PluginWindowHandle compositing_surface); |
| 172 virtual void OnResize(const gfx::Size& new_size, | 179 virtual void OnResize(const gfx::Size& new_size, |
| 173 const gfx::Rect& resizer_rect); | 180 const gfx::Rect& resizer_rect); |
| 174 virtual void OnWasHidden(); | 181 virtual void OnWasHidden(); |
| 175 virtual void OnWasRestored(bool needs_repainting); | 182 virtual void OnWasRestored(bool needs_repainting); |
| 176 void OnUpdateRectAck(); | 183 void OnUpdateRectAck(); |
| 177 void OnCreateVideoAck(int32 video_id); | 184 void OnCreateVideoAck(int32 video_id); |
| 178 void OnUpdateVideoAck(int32 video_id); | 185 void OnUpdateVideoAck(int32 video_id); |
| 179 void OnRequestMoveAck(); | 186 void OnRequestMoveAck(); |
| 180 void OnHandleInputEvent(const IPC::Message& message); | 187 void OnHandleInputEvent(const IPC::Message& message); |
| 181 void OnMouseCaptureLost(); | 188 void OnMouseCaptureLost(); |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 | 366 |
| 360 scoped_ptr<IPC::Message> pending_input_event_ack_; | 367 scoped_ptr<IPC::Message> pending_input_event_ack_; |
| 361 | 368 |
| 362 // Indicates if the next sequence of Char events should be suppressed or not. | 369 // Indicates if the next sequence of Char events should be suppressed or not. |
| 363 bool suppress_next_char_events_; | 370 bool suppress_next_char_events_; |
| 364 | 371 |
| 365 // Set to true if painting to the window is handled by the accelerated | 372 // Set to true if painting to the window is handled by the accelerated |
| 366 // compositor. | 373 // compositor. |
| 367 bool is_accelerated_compositing_active_; | 374 bool is_accelerated_compositing_active_; |
| 368 | 375 |
| 376 // Handle to a surface that is drawn to when accelerated compositing is |
| 377 // active. |
| 378 gfx::PluginWindowHandle compositing_surface_; |
| 379 |
| 369 base::Time animation_floor_time_; | 380 base::Time animation_floor_time_; |
| 370 bool animation_update_pending_; | 381 bool animation_update_pending_; |
| 371 bool animation_task_posted_; | 382 bool animation_task_posted_; |
| 372 | 383 |
| 373 DISALLOW_COPY_AND_ASSIGN(RenderWidget); | 384 DISALLOW_COPY_AND_ASSIGN(RenderWidget); |
| 374 }; | 385 }; |
| 375 | 386 |
| 376 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ | 387 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ |
| OLD | NEW |