diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-14 16:32:59 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-14 16:32:59 +0000 |
commit | 88efb7ec99239eeecaa17d21f8635be1bce29cca (patch) | |
tree | b1a988fbca10748e584f78abb755036e63ff335f /chrome/renderer/render_widget.cc | |
parent | c9d6a1df8ef5fd2c3f134dcb544663ce8bd21c7b (diff) | |
download | chromium_src-88efb7ec99239eeecaa17d21f8635be1bce29cca.zip chromium_src-88efb7ec99239eeecaa17d21f8635be1bce29cca.tar.gz chromium_src-88efb7ec99239eeecaa17d21f8635be1bce29cca.tar.bz2 |
Replace ShowAsPopupWithItems to CreatePopupWidgetWithInfo. Also,
make use of WebPopupMenuInfo from the WebKit API. WebMenuItem
remains in webkit/glue for convenience with IPC marshalling and
related usage in Chrome.
This work is precursor to switching over to using WebWidget from
the WebKit API.
BUG=16234
TEST=html select drop downs should still work on the mac. try
switching languages on news.google.com.
R=paul
Review URL: http://codereview.chromium.org/155378
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20624 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, 17 insertions, 16 deletions
diff --git a/chrome/renderer/render_widget.cc b/chrome/renderer/render_widget.cc index cf2e1da..7ff612f 100644 --- a/chrome/renderer/render_widget.cc +++ b/chrome/renderer/render_widget.cc @@ -16,6 +16,7 @@ #include "skia/ext/platform_canvas.h" #include "third_party/skia/include/core/SkShader.h" #include "webkit/api/public/WebCursorInfo.h" +#include "webkit/api/public/WebPopupMenuInfo.h" #include "webkit/api/public/WebRect.h" #include "webkit/api/public/WebScreenInfo.h" #include "webkit/api/public/WebSize.h" @@ -30,6 +31,7 @@ using WebKit::WebCursorInfo; using WebKit::WebInputEvent; +using WebKit::WebPopupMenuInfo; using WebKit::WebRect; using WebKit::WebScreenInfo; using WebKit::WebSize; @@ -86,6 +88,14 @@ RenderWidget* RenderWidget::Create(int32 opener_id, return widget; } +void RenderWidget::ConfigureAsExternalPopupMenu(const WebPopupMenuInfo& info) { + popup_params_.reset(new ViewHostMsg_ShowPopup_Params); + popup_params_->item_height = info.itemHeight; + popup_params_->selected_item = info.selectedIndex; + for (size_t i = 0; i < info.items.size(); ++i) + popup_params_->popup_items.push_back(WebMenuItem(info.items[i])); +} + void RenderWidget::Init(int32 opener_id) { DCHECK(!webwidget_); @@ -589,26 +599,17 @@ void RenderWidget::Show(WebWidget* webwidget, // NOTE: initial_pos_ may still have its default values at this point, but // that's okay. It'll be ignored if as_popup is false, or the browser // process will impose a default position otherwise. - render_thread_->Send(new ViewHostMsg_ShowWidget( - opener_id_, routing_id_, initial_pos_)); + if (popup_params_.get()) { + popup_params_->bounds = initial_pos_; + Send(new ViewHostMsg_ShowPopup(routing_id_, *popup_params_)); + popup_params_.reset(); + } else { + Send(new ViewHostMsg_ShowWidget(opener_id_, routing_id_, initial_pos_)); + } SetPendingWindowRect(initial_pos_); } } -void RenderWidget::ShowAsPopupWithItems(WebWidget* webwidget, - const WebRect& bounds, - int item_height, - int selected_index, - const std::vector<WebMenuItem>& items) { - ViewHostMsg_ShowPopup_Params params; - params.bounds = bounds; - params.item_height = item_height; - params.selected_item = selected_index; - params.popup_items = items; - - Send(new ViewHostMsg_ShowPopup(routing_id_, params)); -} - void RenderWidget::Focus(WebWidget* webwidget) { // Prevent the widget from stealing the focus if it does not have focus // already. We do this by explicitely setting the focus to false again. |