Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(324)

Side by Side Diff: chrome/renderer/render_widget.h

Issue 155378: Replace ShowAsPopupWithItems to CreatePopupWidgetWithInfo. Also,... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/render_view.cc ('k') | chrome/renderer/render_widget.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 CHROME_RENDERER_RENDER_WIDGET_H_ 5 #ifndef CHROME_RENDERER_RENDER_WIDGET_H_
6 #define CHROME_RENDERER_RENDER_WIDGET_H_ 6 #define CHROME_RENDERER_RENDER_WIDGET_H_
7 7
8 #include <vector> 8 #include <vector>
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/gfx/native_widget_types.h" 10 #include "base/gfx/native_widget_types.h"
11 #include "base/gfx/point.h" 11 #include "base/gfx/point.h"
12 #include "base/gfx/rect.h" 12 #include "base/gfx/rect.h"
13 #include "base/gfx/size.h" 13 #include "base/gfx/size.h"
14 #include "base/ref_counted.h" 14 #include "base/ref_counted.h"
15 #include "base/shared_memory.h" 15 #include "base/shared_memory.h"
16 #include "chrome/common/ipc_channel.h" 16 #include "chrome/common/ipc_channel.h"
17 #include "chrome/renderer/render_process.h" 17 #include "chrome/renderer/render_process.h"
18 #include "skia/ext/platform_canvas.h" 18 #include "skia/ext/platform_canvas.h"
19 #include "third_party/skia/include/core/SkBitmap.h" 19 #include "third_party/skia/include/core/SkBitmap.h"
20 20
21 #include "webkit/api/public/WebRect.h" 21 #include "webkit/api/public/WebRect.h"
22 #include "webkit/glue/webwidget_delegate.h" 22 #include "webkit/glue/webwidget_delegate.h"
23 #include "webkit/glue/webcursor.h" 23 #include "webkit/glue/webcursor.h"
24 24
25 class RenderThreadBase; 25 class RenderThreadBase;
26 struct ViewHostMsg_ShowPopup_Params;
26 struct WebPluginGeometry; 27 struct WebPluginGeometry;
27 28
29 namespace WebKit {
30 struct WebPopupMenuInfo;
31 }
32
28 // RenderWidget provides a communication bridge between a WebWidget and 33 // RenderWidget provides a communication bridge between a WebWidget and
29 // a RenderWidgetHost, the latter of which lives in a different process. 34 // a RenderWidgetHost, the latter of which lives in a different process.
30 class RenderWidget : public IPC::Channel::Listener, 35 class RenderWidget : public IPC::Channel::Listener,
31 public IPC::Message::Sender, 36 public IPC::Message::Sender,
32 virtual public WebWidgetDelegate, 37 virtual public WebWidgetDelegate,
33 public base::RefCounted<RenderWidget> { 38 public base::RefCounted<RenderWidget> {
34 public: 39 public:
35 // Creates a new RenderWidget. The opener_id is the routing ID of the 40 // Creates a new RenderWidget. The opener_id is the routing ID of the
36 // RenderView that this widget lives inside. The render_thread is any 41 // RenderView that this widget lives inside. The render_thread is any
37 // RenderThreadBase implementation, mostly commonly RenderThread::current(). 42 // RenderThreadBase implementation, mostly commonly RenderThread::current().
38 static RenderWidget* Create(int32 opener_id, 43 static RenderWidget* Create(int32 opener_id,
39 RenderThreadBase* render_thread, 44 RenderThreadBase* render_thread,
40 bool activatable); 45 bool activatable);
41 46
47 // Called after Create to configure a RenderWidget to be rendered by the host
48 // as a popup menu with the given data.
49 void ConfigureAsExternalPopupMenu(const WebKit::WebPopupMenuInfo& info);
50
42 // The routing ID assigned by the RenderProcess. Will be MSG_ROUTING_NONE if 51 // The routing ID assigned by the RenderProcess. Will be MSG_ROUTING_NONE if
43 // not yet assigned a view ID, in which case, the process MUST NOT send 52 // not yet assigned a view ID, in which case, the process MUST NOT send
44 // messages with this ID to the parent. 53 // messages with this ID to the parent.
45 int32 routing_id() const { 54 int32 routing_id() const {
46 return routing_id_; 55 return routing_id_;
47 } 56 }
48 57
49 // May return NULL when the window is closing. 58 // May return NULL when the window is closing.
50 WebWidget* webwidget() const { 59 WebWidget* webwidget() const {
51 return webwidget_; 60 return webwidget_;
52 } 61 }
53 62
54 // IPC::Channel::Listener 63 // IPC::Channel::Listener
55 virtual void OnMessageReceived(const IPC::Message& msg); 64 virtual void OnMessageReceived(const IPC::Message& msg);
56 65
57 // IPC::Message::Sender 66 // IPC::Message::Sender
58 virtual bool Send(IPC::Message* msg); 67 virtual bool Send(IPC::Message* msg);
59 68
60 // WebWidgetDelegate 69 // WebWidgetDelegate
61 virtual void DidInvalidateRect(WebWidget* webwidget, 70 virtual void DidInvalidateRect(WebWidget* webwidget,
62 const WebKit::WebRect& rect); 71 const WebKit::WebRect& rect);
63 virtual void DidScrollRect(WebWidget* webwidget, int dx, int dy, 72 virtual void DidScrollRect(WebWidget* webwidget, int dx, int dy,
64 const WebKit::WebRect& clip_rect); 73 const WebKit::WebRect& clip_rect);
65 virtual void Show(WebWidget* webwidget, WindowOpenDisposition disposition); 74 virtual void Show(WebWidget* webwidget, WindowOpenDisposition disposition);
66 virtual void ShowAsPopupWithItems(WebWidget* webwidget,
67 const WebKit::WebRect& bounds,
68 int item_height,
69 int selected_index,
70 const std::vector<WebMenuItem>& items);
71 virtual void CloseWidgetSoon(WebWidget* webwidget); 75 virtual void CloseWidgetSoon(WebWidget* webwidget);
72 virtual void Focus(WebWidget* webwidget); 76 virtual void Focus(WebWidget* webwidget);
73 virtual void Blur(WebWidget* webwidget); 77 virtual void Blur(WebWidget* webwidget);
74 virtual void SetCursor(WebWidget* webwidget, 78 virtual void SetCursor(WebWidget* webwidget,
75 const WebKit::WebCursorInfo& cursor); 79 const WebKit::WebCursorInfo& cursor);
76 virtual void GetWindowRect(WebWidget* webwidget, WebKit::WebRect* rect); 80 virtual void GetWindowRect(WebWidget* webwidget, WebKit::WebRect* rect);
77 virtual void SetWindowRect(WebWidget* webwidget, 81 virtual void SetWindowRect(WebWidget* webwidget,
78 const WebKit::WebRect& rect); 82 const WebKit::WebRect& rect);
79 virtual void GetRootWindowRect(WebWidget* webwidget, WebKit::WebRect* rect); 83 virtual void GetRootWindowRect(WebWidget* webwidget, WebKit::WebRect* rect);
80 virtual void GetRootWindowResizerRect(WebWidget* webwidget, 84 virtual void GetRootWindowResizerRect(WebWidget* webwidget,
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 204
201 // The position where this view should be initially shown. 205 // The position where this view should be initially shown.
202 gfx::Rect initial_pos_; 206 gfx::Rect initial_pos_;
203 207
204 // The window we are embedded within. TODO(darin): kill this. 208 // The window we are embedded within. TODO(darin): kill this.
205 gfx::NativeViewId host_window_; 209 gfx::NativeViewId host_window_;
206 210
207 // We store the current cursor object so we can avoid spamming SetCursor 211 // We store the current cursor object so we can avoid spamming SetCursor
208 // messages. 212 // messages.
209 WebCursor current_cursor_; 213 WebCursor current_cursor_;
214
210 // The size of the RenderWidget. 215 // The size of the RenderWidget.
211 gfx::Size size_; 216 gfx::Size size_;
212 217
213 // Transport DIBs that are currently in use to transfer an image to the 218 // Transport DIBs that are currently in use to transfer an image to the
214 // browser. 219 // browser.
215 TransportDIB* current_paint_buf_; 220 TransportDIB* current_paint_buf_;
216 TransportDIB* current_scroll_buf_; 221 TransportDIB* current_scroll_buf_;
217 222
218 // The smallest bounding rectangle that needs to be re-painted. This is non- 223 // The smallest bounding rectangle that needs to be re-painted. This is non-
219 // empty if a paint event is pending. 224 // empty if a paint event is pending.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 std::vector<WebPluginGeometry> plugin_window_moves_; 287 std::vector<WebPluginGeometry> plugin_window_moves_;
283 288
284 // A custom background for the widget. 289 // A custom background for the widget.
285 SkBitmap background_; 290 SkBitmap background_;
286 291
287 // While we are waiting for the browser to update window sizes, 292 // While we are waiting for the browser to update window sizes,
288 // we track the pending size temporarily. 293 // we track the pending size temporarily.
289 int pending_window_rect_count_; 294 int pending_window_rect_count_;
290 WebKit::WebRect pending_window_rect_; 295 WebKit::WebRect pending_window_rect_;
291 296
297 scoped_ptr<ViewHostMsg_ShowPopup_Params> popup_params_;
298
292 DISALLOW_COPY_AND_ASSIGN(RenderWidget); 299 DISALLOW_COPY_AND_ASSIGN(RenderWidget);
293 }; 300 };
294 301
295 #endif // CHROME_RENDERER_RENDER_WIDGET_H_ 302 #endif // CHROME_RENDERER_RENDER_WIDGET_H_
OLDNEW
« no previous file with comments | « chrome/renderer/render_view.cc ('k') | chrome/renderer/render_widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698