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

Unified Diff: chrome/renderer/render_widget.cc

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/render_widget.h ('k') | webkit/api/public/WebPopupMenuInfo.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/render_widget.cc
===================================================================
--- chrome/renderer/render_widget.cc (revision 20609)
+++ chrome/renderer/render_widget.cc (working copy)
@@ -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 @@
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 @@
// 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.
« no previous file with comments | « chrome/renderer/render_widget.h ('k') | webkit/api/public/WebPopupMenuInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698