diff options
author | boliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-19 16:13:18 +0000 |
---|---|---|
committer | boliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-19 16:13:18 +0000 |
commit | 48495594c601e34b8caef655395bddaacc0cd967 (patch) | |
tree | bc6778bc953eb812f34c2bde3c44ab4449c16034 /chrome/renderer/render_widget.cc | |
parent | 3deb16cc9c3938cbe4e496930ff428389f8b35d1 (diff) | |
download | chromium_src-48495594c601e34b8caef655395bddaacc0cd967.zip chromium_src-48495594c601e34b8caef655395bddaacc0cd967.tar.gz chromium_src-48495594c601e34b8caef655395bddaacc0cd967.tar.bz2 |
Use RenderWidget(Host) for full screen
Add RenderWidgetFullscreen(Host) subclasses, InitAsFullscreen method
to RenderWidgetHostView, and add two new ipc messages for creating
and showing full screen.
Add createFullscreenWindow to RenderView that creates RenderWidgetFullscreen
and sends message to browser which eventually creates RenderWidgetFullscreenHost.
The show method on RenderWidgetFullscreen sends message to parent
RenderViewHost in browser, which calls InitAsFullscreen on the view.
BUG=16735
TEST=RenderViewHostTest.CreateFullscreenWidget
Review URL: http://codereview.chromium.org/3055009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56690 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/render_widget.cc')
-rw-r--r-- | chrome/renderer/render_widget.cc | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/chrome/renderer/render_widget.cc b/chrome/renderer/render_widget.cc index e91efe1..7b14ccd 100644 --- a/chrome/renderer/render_widget.cc +++ b/chrome/renderer/render_widget.cc @@ -17,6 +17,7 @@ #include "chrome/renderer/render_thread.h" #include "gfx/point.h" #include "gfx/size.h" +#include "ipc/ipc_sync_message.h" #include "skia/ext/platform_canvas.h" #include "third_party/skia/include/core/SkShader.h" #include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" @@ -42,12 +43,14 @@ using WebKit::WebInputEvent; using WebKit::WebNavigationPolicy; using WebKit::WebPopupMenu; using WebKit::WebPopupMenuInfo; +using WebKit::WebPopupType; using WebKit::WebRect; using WebKit::WebScreenInfo; using WebKit::WebSize; using WebKit::WebTextDirection; using WebKit::WebTextInputType; using WebKit::WebVector; +using WebKit::WebWidget; RenderWidget::RenderWidget(RenderThreadBase* render_thread, WebKit::WebPopupType popup_type) @@ -84,7 +87,7 @@ RenderWidget::~RenderWidget() { RenderProcess::current()->ReleaseProcess(); } -/*static*/ +// static RenderWidget* RenderWidget::Create(int32 opener_id, RenderThreadBase* render_thread, WebKit::WebPopupType popup_type) { @@ -95,6 +98,20 @@ RenderWidget* RenderWidget::Create(int32 opener_id, return widget; } +// static +WebWidget* RenderWidget::CreateWebWidget(RenderWidget* render_widget) { + switch (render_widget->popup_type_) { + case WebKit::WebPopupTypeNone: // Nothing to create. + break; + case WebKit::WebPopupTypeSelect: + case WebKit::WebPopupTypeSuggestion: + return WebPopupMenu::create(render_widget); + default: + NOTREACHED(); + } + return NULL; +} + void RenderWidget::ConfigureAsExternalPopupMenu(const WebPopupMenuInfo& info) { popup_params_.reset(new ViewHostMsg_ShowPopup_Params); popup_params_->item_height = info.itemHeight; @@ -106,15 +123,23 @@ void RenderWidget::ConfigureAsExternalPopupMenu(const WebPopupMenuInfo& info) { } void RenderWidget::Init(int32 opener_id) { + DoInit(opener_id, + RenderWidget::CreateWebWidget(this), + new ViewHostMsg_CreateWidget(opener_id, popup_type_, &routing_id_)); +} + + +void RenderWidget::DoInit(int32 opener_id, + WebKit::WebWidget* web_widget, + IPC::SyncMessage* create_widget_message) { DCHECK(!webwidget_); if (opener_id != MSG_ROUTING_NONE) opener_id_ = opener_id; - webwidget_ = WebPopupMenu::create(this); + webwidget_ = web_widget; - bool result = render_thread_->Send( - new ViewHostMsg_CreateWidget(opener_id, popup_type_, &routing_id_)); + bool result = render_thread_->Send(create_widget_message); if (result) { render_thread_->AddRoute(routing_id_, this); // Take a reference on behalf of the RenderThread. This will be balanced |