[email protected] | 05d47875 | 2009-04-08 23:38:16 | [diff] [blame] | 1 | // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
license.bot | bf09a50 | 2008-08-24 00:55:55 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 4 | |
[email protected] | 05d47875 | 2009-04-08 23:38:16 | [diff] [blame] | 5 | #ifndef CHROME_RENDERER_RENDER_WIDGET_H_ |
| 6 | #define CHROME_RENDERER_RENDER_WIDGET_H_ |
[email protected] | 32b76ef | 2010-07-26 23:08:24 | [diff] [blame] | 7 | #pragma once |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 8 | |
| 9 | #include <vector> |
[email protected] | 010ea08a | 2009-10-11 20:21:32 | [diff] [blame] | 10 | |
[email protected] | d65adb1 | 2010-04-28 17:26:49 | [diff] [blame] | 11 | #include "app/surface/transport_dib.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 12 | #include "base/basictypes.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 13 | #include "base/ref_counted.h" |
[email protected] | 552e600 | 2009-11-19 05:24:57 | [diff] [blame] | 14 | #include "chrome/renderer/paint_aggregator.h" |
[email protected] | e68e62fa | 2009-02-20 02:00:04 | [diff] [blame] | 15 | #include "chrome/renderer/render_process.h" |
[email protected] | 5c7293a | 2010-03-17 06:40:57 | [diff] [blame] | 16 | #include "gfx/native_widget_types.h" |
[email protected] | e0fc2f1 | 2010-03-14 23:30:59 | [diff] [blame] | 17 | #include "gfx/rect.h" |
| 18 | #include "gfx/size.h" |
[email protected] | 946d1b2 | 2009-07-22 23:57:21 | [diff] [blame] | 19 | #include "ipc/ipc_channel.h" |
[email protected] | fa7b1dc | 2010-06-23 17:53:04 | [diff] [blame] | 20 | #include "third_party/WebKit/WebKit/chromium/public/WebCompositionUnderline.h" |
[email protected] | 3e2b375b | 2010-04-07 17:03:12 | [diff] [blame] | 21 | #include "third_party/WebKit/WebKit/chromium/public/WebPopupType.h" |
[email protected] | 418ed5ab | 2009-11-12 01:14:49 | [diff] [blame] | 22 | #include "third_party/WebKit/WebKit/chromium/public/WebRect.h" |
| 23 | #include "third_party/WebKit/WebKit/chromium/public/WebTextDirection.h" |
[email protected] | fa7b1dc | 2010-06-23 17:53:04 | [diff] [blame] | 24 | #include "third_party/WebKit/WebKit/chromium/public/WebTextInputType.h" |
[email protected] | 418ed5ab | 2009-11-12 01:14:49 | [diff] [blame] | 25 | #include "third_party/WebKit/WebKit/chromium/public/WebWidgetClient.h" |
[email protected] | d65adb1 | 2010-04-28 17:26:49 | [diff] [blame] | 26 | #include "third_party/skia/include/core/SkBitmap.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 27 | #include "webkit/glue/webcursor.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 28 | |
[email protected] | 8085dbc8 | 2008-09-26 22:53:44 | [diff] [blame] | 29 | class RenderThreadBase; |
[email protected] | 8085dbc8 | 2008-09-26 22:53:44 | [diff] [blame] | 30 | |
[email protected] | 46f36a49 | 2010-07-28 19:36:41 | [diff] [blame] | 31 | namespace gfx { |
| 32 | class Point; |
| 33 | } |
| 34 | |
[email protected] | 48495594 | 2010-08-19 16:13:18 | [diff] [blame] | 35 | namespace IPC { |
| 36 | class SyncMessage; |
| 37 | } |
| 38 | |
[email protected] | 46f36a49 | 2010-07-28 19:36:41 | [diff] [blame] | 39 | namespace skia { |
| 40 | class PlatformCanvas; |
| 41 | } |
| 42 | |
[email protected] | 88efb7ec | 2009-07-14 16:32:59 | [diff] [blame] | 43 | namespace WebKit { |
[email protected] | 6a8ddba5 | 2010-09-05 04:38:06 | [diff] [blame] | 44 | class WebMouseEvent; |
[email protected] | 48495594 | 2010-08-19 16:13:18 | [diff] [blame] | 45 | class WebWidget; |
[email protected] | 88efb7ec | 2009-07-14 16:32:59 | [diff] [blame] | 46 | struct WebPopupMenuInfo; |
| 47 | } |
| 48 | |
[email protected] | f103ab7 | 2009-09-02 17:10:59 | [diff] [blame] | 49 | namespace webkit_glue { |
| 50 | struct WebPluginGeometry; |
| 51 | } |
| 52 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 53 | // RenderWidget provides a communication bridge between a WebWidget and |
| 54 | // a RenderWidgetHost, the latter of which lives in a different process. |
| 55 | class RenderWidget : public IPC::Channel::Listener, |
| 56 | public IPC::Message::Sender, |
[email protected] | 4873c7d | 2009-07-16 06:36:28 | [diff] [blame] | 57 | virtual public WebKit::WebWidgetClient, |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 58 | public base::RefCounted<RenderWidget> { |
| 59 | public: |
| 60 | // Creates a new RenderWidget. The opener_id is the routing ID of the |
[email protected] | 8085dbc8 | 2008-09-26 22:53:44 | [diff] [blame] | 61 | // RenderView that this widget lives inside. The render_thread is any |
[email protected] | 8930d47 | 2009-02-21 08:05:28 | [diff] [blame] | 62 | // RenderThreadBase implementation, mostly commonly RenderThread::current(). |
[email protected] | 0ebf387 | 2008-11-07 21:35:03 | [diff] [blame] | 63 | static RenderWidget* Create(int32 opener_id, |
| 64 | RenderThreadBase* render_thread, |
[email protected] | 3e2b375b | 2010-04-07 17:03:12 | [diff] [blame] | 65 | WebKit::WebPopupType popup_type); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 66 | |
[email protected] | 48495594 | 2010-08-19 16:13:18 | [diff] [blame] | 67 | // Creates a WebWidget based on the popup type. |
| 68 | static WebKit::WebWidget* CreateWebWidget(RenderWidget* render_widget); |
| 69 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 70 | // The routing ID assigned by the RenderProcess. Will be MSG_ROUTING_NONE if |
| 71 | // not yet assigned a view ID, in which case, the process MUST NOT send |
| 72 | // messages with this ID to the parent. |
| 73 | int32 routing_id() const { |
| 74 | return routing_id_; |
| 75 | } |
| 76 | |
| 77 | // May return NULL when the window is closing. |
[email protected] | 4873c7d | 2009-07-16 06:36:28 | [diff] [blame] | 78 | WebKit::WebWidget* webwidget() const { |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 79 | return webwidget_; |
| 80 | } |
| 81 | |
[email protected] | c1f50aa | 2010-02-18 03:46:57 | [diff] [blame] | 82 | gfx::NativeViewId host_window() const { |
| 83 | return host_window_; |
| 84 | } |
| 85 | |
[email protected] | 589621b | 2010-09-23 22:01:07 | [diff] [blame] | 86 | bool has_focus() const { return has_focus_; } |
| 87 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 88 | // IPC::Channel::Listener |
| 89 | virtual void OnMessageReceived(const IPC::Message& msg); |
| 90 | |
| 91 | // IPC::Message::Sender |
| 92 | virtual bool Send(IPC::Message* msg); |
| 93 | |
[email protected] | 4873c7d | 2009-07-16 06:36:28 | [diff] [blame] | 94 | // WebKit::WebWidgetClient |
| 95 | virtual void didInvalidateRect(const WebKit::WebRect&); |
| 96 | virtual void didScrollRect(int dx, int dy, const WebKit::WebRect& clipRect); |
[email protected] | a79d8a63 | 2010-11-18 22:35:56 | [diff] [blame^] | 97 | virtual void didActivateAcceleratedCompositing(bool active); |
[email protected] | f98d7e3c | 2010-09-13 22:30:46 | [diff] [blame] | 98 | virtual void scheduleComposite(); |
[email protected] | 4873c7d | 2009-07-16 06:36:28 | [diff] [blame] | 99 | virtual void didFocus(); |
| 100 | virtual void didBlur(); |
| 101 | virtual void didChangeCursor(const WebKit::WebCursorInfo&); |
| 102 | virtual void closeWidgetSoon(); |
| 103 | virtual void show(WebKit::WebNavigationPolicy); |
| 104 | virtual void runModal() {} |
| 105 | virtual WebKit::WebRect windowRect(); |
| 106 | virtual void setWindowRect(const WebKit::WebRect&); |
| 107 | virtual WebKit::WebRect windowResizerRect(); |
| 108 | virtual WebKit::WebRect rootWindowRect(); |
| 109 | virtual WebKit::WebScreenInfo screenInfo(); |
[email protected] | fa7b1dc | 2010-06-23 17:53:04 | [diff] [blame] | 110 | virtual void resetInputMethod(); |
[email protected] | 4873c7d | 2009-07-16 06:36:28 | [diff] [blame] | 111 | |
| 112 | // Called when a plugin is moved. These events are queued up and sent with |
| 113 | // the next paint or scroll message to the host. |
[email protected] | f103ab7 | 2009-09-02 17:10:59 | [diff] [blame] | 114 | void SchedulePluginMove(const webkit_glue::WebPluginGeometry& move); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 115 | |
[email protected] | 26865477 | 2009-08-06 23:02:04 | [diff] [blame] | 116 | // Called when a plugin window has been destroyed, to make sure the currently |
| 117 | // pending moves don't try to reference it. |
| 118 | void CleanupWindowInPluginMoves(gfx::PluginWindowHandle window); |
| 119 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 120 | // Close the underlying WebWidget. |
[email protected] | 60c42a8c7 | 2009-10-09 04:08:59 | [diff] [blame] | 121 | virtual void Close(); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 122 | |
| 123 | protected: |
[email protected] | 8085dbc8 | 2008-09-26 22:53:44 | [diff] [blame] | 124 | // Friend RefCounted so that the dtor can be non-public. Using this class |
| 125 | // without ref-counting is an error. |
| 126 | friend class base::RefCounted<RenderWidget>; |
[email protected] | 7339cd2 | 2010-10-27 00:11:20 | [diff] [blame] | 127 | // For unit tests. |
| 128 | friend class RenderWidgetTest; |
[email protected] | 8085dbc8 | 2008-09-26 22:53:44 | [diff] [blame] | 129 | |
[email protected] | 3e2b375b | 2010-04-07 17:03:12 | [diff] [blame] | 130 | RenderWidget(RenderThreadBase* render_thread, |
| 131 | WebKit::WebPopupType popup_type); |
[email protected] | 8085dbc8 | 2008-09-26 22:53:44 | [diff] [blame] | 132 | virtual ~RenderWidget(); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 133 | |
| 134 | // Initializes this view with the given opener. CompleteInit must be called |
| 135 | // later. |
| 136 | void Init(int32 opener_id); |
| 137 | |
[email protected] | 48495594 | 2010-08-19 16:13:18 | [diff] [blame] | 138 | // Called by Init and subclasses to perform initialization. |
| 139 | void DoInit(int32 opener_id, |
| 140 | WebKit::WebWidget* web_widget, |
| 141 | IPC::SyncMessage* create_widget_message); |
| 142 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 143 | // Finishes creation of a pending view started with Init. |
[email protected] | 18bcc3c | 2009-01-27 21:39:15 | [diff] [blame] | 144 | void CompleteInit(gfx::NativeViewId parent); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 145 | |
[email protected] | 661eb9d | 2009-02-03 02:11:48 | [diff] [blame] | 146 | // Paints the given rectangular region of the WebWidget into canvas (a |
| 147 | // shared memory segment returned by AllocPaintBuf on Windows). The caller |
| 148 | // must ensure that the given rect fits within the bounds of the WebWidget. |
[email protected] | 4fb6684 | 2009-12-04 21:41:00 | [diff] [blame] | 149 | void PaintRect(const gfx::Rect& rect, const gfx::Point& canvas_origin, |
| 150 | skia::PlatformCanvas* canvas); |
| 151 | |
| 152 | // Paints a border at the given rect for debugging purposes. |
| 153 | void PaintDebugBorder(const gfx::Rect& rect, skia::PlatformCanvas* canvas); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 154 | |
[email protected] | 552e600 | 2009-11-19 05:24:57 | [diff] [blame] | 155 | void CallDoDeferredUpdate(); |
| 156 | void DoDeferredUpdate(); |
[email protected] | 2533ce1 | 2009-05-09 00:02:24 | [diff] [blame] | 157 | void DoDeferredClose(); |
| 158 | void DoDeferredSetWindowRect(const WebKit::WebRect& pos); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 159 | |
[email protected] | 699ab0d | 2009-04-23 23:19:14 | [diff] [blame] | 160 | // Set the background of the render widget to a bitmap. The bitmap will be |
| 161 | // tiled in both directions if it isn't big enough to fill the area. This is |
| 162 | // mainly intended to be used in conjuction with WebView::SetIsTransparent(). |
| 163 | virtual void SetBackground(const SkBitmap& bitmap); |
| 164 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 165 | // RenderWidget IPC message handlers |
| 166 | void OnClose(); |
[email protected] | 18bcc3c | 2009-01-27 21:39:15 | [diff] [blame] | 167 | void OnCreatingNewAck(gfx::NativeViewId parent); |
[email protected] | 30f75e6 | 2009-02-25 22:01:00 | [diff] [blame] | 168 | virtual void OnResize(const gfx::Size& new_size, |
| 169 | const gfx::Rect& resizer_rect); |
[email protected] | 941e455 | 2010-02-01 21:23:43 | [diff] [blame] | 170 | virtual void OnWasHidden(); |
| 171 | virtual void OnWasRestored(bool needs_repainting); |
[email protected] | 53d3f30 | 2009-12-21 04:42:05 | [diff] [blame] | 172 | void OnUpdateRectAck(); |
[email protected] | 8400e03 | 2010-02-26 18:50:11 | [diff] [blame] | 173 | void OnCreateVideoAck(int32 video_id); |
| 174 | void OnUpdateVideoAck(int32 video_id); |
[email protected] | 2533ce1 | 2009-05-09 00:02:24 | [diff] [blame] | 175 | void OnRequestMoveAck(); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 176 | void OnHandleInputEvent(const IPC::Message& message); |
| 177 | void OnMouseCaptureLost(); |
[email protected] | 1e6e3c99 | 2010-02-08 15:52:13 | [diff] [blame] | 178 | virtual void OnSetFocus(bool enable); |
[email protected] | fa7b1dc | 2010-06-23 17:53:04 | [diff] [blame] | 179 | void OnSetInputMethodActive(bool is_active); |
| 180 | void OnImeSetComposition( |
| 181 | const string16& text, |
| 182 | const std::vector<WebKit::WebCompositionUnderline>& underlines, |
| 183 | int selection_start, |
| 184 | int selection_end); |
| 185 | void OnImeConfirmComposition(); |
[email protected] | d65adb1 | 2010-04-28 17:26:49 | [diff] [blame] | 186 | void OnMsgPaintAtSize(const TransportDIB::Handle& dib_id, |
[email protected] | c88c944 | 2010-07-19 18:55:09 | [diff] [blame] | 187 | int tag, |
[email protected] | 948f7ab7 | 2010-05-28 23:48:08 | [diff] [blame] | 188 | const gfx::Size& page_size, |
[email protected] | d65adb1 | 2010-04-28 17:26:49 | [diff] [blame] | 189 | const gfx::Size& desired_size); |
[email protected] | ec7dc11 | 2008-08-06 05:30:12 | [diff] [blame] | 190 | void OnMsgRepaint(const gfx::Size& size_to_paint); |
[email protected] | 4873c7d | 2009-07-16 06:36:28 | [diff] [blame] | 191 | void OnSetTextDirection(WebKit::WebTextDirection direction); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 192 | |
[email protected] | 00c3961 | 2010-03-06 02:53:28 | [diff] [blame] | 193 | // Override point to notify derived classes that a paint has happened. |
| 194 | // DidInitiatePaint happens when we've generated a new bitmap and sent it to |
| 195 | // the browser. DidFlushPaint happens once we've received the ACK that the |
| 196 | // screen has actually been updated. |
| 197 | virtual void DidInitiatePaint() {} |
| 198 | virtual void DidFlushPaint() {} |
[email protected] | a2f6bc11 | 2009-06-27 16:27:25 | [diff] [blame] | 199 | |
[email protected] | ca4847f | 2010-09-24 05:39:15 | [diff] [blame] | 200 | // Detects if a suitable opaque plugin covers the given paint bounds with no |
| 201 | // compositing necessary. |
| 202 | // |
| 203 | // Returns true if the paint can be handled by just blitting the plugin |
| 204 | // bitmap. In this case, the location, clipping, and ID of the backing store |
| 205 | // will be filled into the given output parameters. |
| 206 | // |
| 207 | // A return value of false means optimized painting can not be used and we |
| 208 | // should continue with the normal painting code path. |
| 209 | virtual bool GetBitmapForOptimizedPluginPaint( |
| 210 | const gfx::Rect& paint_bounds, |
| 211 | TransportDIB** dib, |
| 212 | gfx::Rect* location, |
| 213 | gfx::Rect* clip); |
| 214 | |
[email protected] | bee16aab | 2009-08-26 15:55:03 | [diff] [blame] | 215 | // Sets the "hidden" state of this widget. All accesses to is_hidden_ should |
| 216 | // use this method so that we can properly inform the RenderThread of our |
| 217 | // state. |
| 218 | void SetHidden(bool hidden); |
| 219 | |
[email protected] | 882daa9 | 2009-11-05 16:31:31 | [diff] [blame] | 220 | bool is_hidden() const { return is_hidden_; } |
| 221 | |
[email protected] | 53d3f30 | 2009-12-21 04:42:05 | [diff] [blame] | 222 | // True if an UpdateRect_ACK message is pending. |
| 223 | bool update_reply_pending() const { |
| 224 | return update_reply_pending_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 225 | } |
| 226 | |
[email protected] | 67474193 | 2009-02-04 23:44:46 | [diff] [blame] | 227 | bool next_paint_is_resize_ack() const; |
| 228 | bool next_paint_is_restore_ack() const; |
| 229 | void set_next_paint_is_resize_ack(); |
| 230 | void set_next_paint_is_restore_ack(); |
| 231 | void set_next_paint_is_repaint_ack(); |
[email protected] | ec7dc11 | 2008-08-06 05:30:12 | [diff] [blame] | 232 | |
[email protected] | fa7b1dc | 2010-06-23 17:53:04 | [diff] [blame] | 233 | // Checks if the input method state and caret position have been changed. |
| 234 | // If they are changed, the new value will be sent to the browser process. |
| 235 | void UpdateInputMethod(); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 236 | |
| 237 | // Tells the renderer it does not have focus. Used to prevent us from getting |
| 238 | // the focus on our own when the browser did not focus us. |
| 239 | void ClearFocus(); |
| 240 | |
[email protected] | 2533ce1 | 2009-05-09 00:02:24 | [diff] [blame] | 241 | // Set the pending window rect. |
| 242 | // Because the real render_widget is hosted in another process, there is |
| 243 | // a time period where we may have set a new window rect which has not yet |
| 244 | // been processed by the browser. So we maintain a pending window rect |
| 245 | // size. If JS code sets the WindowRect, and then immediately calls |
| 246 | // GetWindowRect() we'll use this pending window rect as the size. |
| 247 | void SetPendingWindowRect(const WebKit::WebRect& r); |
| 248 | |
[email protected] | 44670587 | 2009-09-10 07:22:48 | [diff] [blame] | 249 | // Called by OnHandleInputEvent() to notify subclasses that a key event was |
| 250 | // just handled. |
| 251 | virtual void DidHandleKeyEvent() {} |
| 252 | |
[email protected] | 6a8ddba5 | 2010-09-05 04:38:06 | [diff] [blame] | 253 | // Called by OnHandleInputEvent() to notify subclasses that a mouse event was |
| 254 | // just handled. |
| 255 | virtual void DidHandleMouseEvent(const WebKit::WebMouseEvent& event) {} |
| 256 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 257 | // Routing ID that allows us to communicate to the parent browser process |
| 258 | // RenderWidgetHost. When MSG_ROUTING_NONE, no messages may be sent. |
| 259 | int32 routing_id_; |
| 260 | |
[email protected] | c5b3b5e | 2009-02-13 06:41:11 | [diff] [blame] | 261 | // We are responsible for destroying this object via its Close method. |
[email protected] | 4873c7d | 2009-07-16 06:36:28 | [diff] [blame] | 262 | WebKit::WebWidget* webwidget_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 263 | |
| 264 | // Set to the ID of the view that initiated creating this view, if any. When |
| 265 | // the view was initiated by the browser (the common case), this will be |
| 266 | // MSG_ROUTING_NONE. This is used in determining ownership when opening |
| 267 | // child tabs. See RenderWidget::createWebViewWithRequest. |
| 268 | // |
| 269 | // This ID may refer to an invalid view if that view is closed before this |
| 270 | // view is. |
| 271 | int32 opener_id_; |
| 272 | |
[email protected] | 8085dbc8 | 2008-09-26 22:53:44 | [diff] [blame] | 273 | // The thread that does our IPC. |
| 274 | RenderThreadBase* render_thread_; |
| 275 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 276 | // The position where this view should be initially shown. |
| 277 | gfx::Rect initial_pos_; |
| 278 | |
| 279 | // The window we are embedded within. TODO(darin): kill this. |
[email protected] | 18bcc3c | 2009-01-27 21:39:15 | [diff] [blame] | 280 | gfx::NativeViewId host_window_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 281 | |
| 282 | // We store the current cursor object so we can avoid spamming SetCursor |
| 283 | // messages. |
| 284 | WebCursor current_cursor_; |
[email protected] | 88efb7ec | 2009-07-14 16:32:59 | [diff] [blame] | 285 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 286 | // The size of the RenderWidget. |
| 287 | gfx::Size size_; |
| 288 | |
[email protected] | b4d0845 | 2010-10-05 17:34:35 | [diff] [blame] | 289 | // The TransportDIB that is being used to transfer an image to the browser. |
| 290 | TransportDIB* current_paint_buf_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 291 | |
[email protected] | 552e600 | 2009-11-19 05:24:57 | [diff] [blame] | 292 | PaintAggregator paint_aggregator_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 293 | |
[email protected] | f21c613a | 2009-02-12 14:46:17 | [diff] [blame] | 294 | // The area that must be reserved for drawing the resize corner. |
| 295 | gfx::Rect resizer_rect_; |
| 296 | |
[email protected] | 53d3f30 | 2009-12-21 04:42:05 | [diff] [blame] | 297 | // Flags for the next ViewHostMsg_UpdateRect message. |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 298 | int next_paint_flags_; |
| 299 | |
[email protected] | 53d3f30 | 2009-12-21 04:42:05 | [diff] [blame] | 300 | // True if we are expecting an UpdateRect_ACK message (i.e., that a |
| 301 | // UpdateRect message has been sent). |
| 302 | bool update_reply_pending_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 303 | |
| 304 | // Set to true if we should ignore RenderWidget::Show calls. |
| 305 | bool did_show_; |
| 306 | |
| 307 | // Indicates that we shouldn't bother generated paint events. |
| 308 | bool is_hidden_; |
| 309 | |
| 310 | // Indicates that we should be repainted when restored. This flag is set to |
| 311 | // true if we receive an invalidation / scroll event from webkit while our |
| 312 | // is_hidden_ flag is set to true. This is used to force a repaint once we |
| 313 | // restore to account for the fact that our host would not know about the |
| 314 | // invalidation / scroll event(s) from webkit while we are hidden. |
| 315 | bool needs_repainting_on_restore_; |
| 316 | |
| 317 | // Indicates whether we have been focused/unfocused by the browser. |
| 318 | bool has_focus_; |
| 319 | |
[email protected] | 5dd76821 | 2009-08-13 23:34:49 | [diff] [blame] | 320 | // Are we currently handling an input event? |
| 321 | bool handling_input_event_; |
| 322 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 323 | // True if we have requested this widget be closed. No more messages will |
| 324 | // be sent, except for a Close. |
| 325 | bool closing_; |
| 326 | |
[email protected] | fa7b1dc | 2010-06-23 17:53:04 | [diff] [blame] | 327 | // Indicates if an input method is active in the browser process. |
| 328 | bool input_method_is_active_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 329 | |
[email protected] | fa7b1dc | 2010-06-23 17:53:04 | [diff] [blame] | 330 | // Stores the current text input type of |webwidget_|. |
| 331 | WebKit::WebTextInputType text_input_type_; |
| 332 | |
| 333 | // Stores the current caret bounds of input focus. |
| 334 | WebKit::WebRect caret_bounds_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 335 | |
[email protected] | 3e2b375b | 2010-04-07 17:03:12 | [diff] [blame] | 336 | // The kind of popup this widget represents, NONE if not a popup. |
| 337 | WebKit::WebPopupType popup_type_; |
[email protected] | 0ebf387 | 2008-11-07 21:35:03 | [diff] [blame] | 338 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 339 | // Holds all the needed plugin window moves for a scroll. |
[email protected] | f103ab7 | 2009-09-02 17:10:59 | [diff] [blame] | 340 | typedef std::vector<webkit_glue::WebPluginGeometry> WebPluginGeometryVector; |
[email protected] | 26865477 | 2009-08-06 23:02:04 | [diff] [blame] | 341 | WebPluginGeometryVector plugin_window_moves_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 342 | |
[email protected] | 699ab0d | 2009-04-23 23:19:14 | [diff] [blame] | 343 | // A custom background for the widget. |
| 344 | SkBitmap background_; |
| 345 | |
[email protected] | 2533ce1 | 2009-05-09 00:02:24 | [diff] [blame] | 346 | // While we are waiting for the browser to update window sizes, |
| 347 | // we track the pending size temporarily. |
| 348 | int pending_window_rect_count_; |
| 349 | WebKit::WebRect pending_window_rect_; |
| 350 | |
[email protected] | 12fbad81 | 2009-09-01 18:21:24 | [diff] [blame] | 351 | scoped_ptr<IPC::Message> pending_input_event_ack_; |
| 352 | |
[email protected] | 867125a0 | 2009-12-10 06:01:48 | [diff] [blame] | 353 | // Indicates if the next sequence of Char events should be suppressed or not. |
| 354 | bool suppress_next_char_events_; |
| 355 | |
[email protected] | a79d8a63 | 2010-11-18 22:35:56 | [diff] [blame^] | 356 | // Set to true if painting to the window is handled by the accelerated |
| 357 | // compositor. |
| 358 | bool is_accelerated_compositing_active_; |
[email protected] | edbcde93 | 2010-05-07 17:10:46 | [diff] [blame] | 359 | |
[email protected] | 05d47875 | 2009-04-08 23:38:16 | [diff] [blame] | 360 | DISALLOW_COPY_AND_ASSIGN(RenderWidget); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 361 | }; |
| 362 | |
[email protected] | 05d47875 | 2009-04-08 23:38:16 | [diff] [blame] | 363 | #endif // CHROME_RENDERER_RENDER_WIDGET_H_ |