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

Unified Diff: webkit/tools/test_shell/mac/test_webview_delegate.mm

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 | « webkit/glue/webworker_impl.cc ('k') | webkit/tools/test_shell/test_webview_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/tools/test_shell/mac/test_webview_delegate.mm
===================================================================
--- webkit/tools/test_shell/mac/test_webview_delegate.mm (revision 20609)
+++ webkit/tools/test_shell/mac/test_webview_delegate.mm (working copy)
@@ -8,7 +8,6 @@
#include "base/string_util.h"
#include "base/sys_string_conversions.h"
#include "webkit/api/public/WebCursorInfo.h"
-#include "webkit/api/public/WebRect.h"
#include "webkit/glue/webcursor.h"
#include "webkit/glue/webview.h"
#include "webkit/glue/plugins/plugin_list.h"
@@ -17,6 +16,7 @@
#include "webkit/tools/test_shell/test_shell.h"
using WebKit::WebCursorInfo;
+using WebKit::WebPopupMenuInfo;
using WebKit::WebRect;
// WebViewDelegate -----------------------------------------------------------
@@ -24,6 +24,14 @@
TestWebViewDelegate::~TestWebViewDelegate() {
}
+WebWidget* TestWebViewDelegate::CreatePopupWidgetWithInfo(
+ WebView* webview,
+ const WebPopupMenuInfo& info) {
+ WebWidget* webwidget = shell_->CreatePopupWidget(webview);
+ popup_menu_info_.reset(new WebPopupMenuInfo(info));
+ return webwidget;
+}
+
WebPluginDelegate* TestWebViewDelegate::CreatePluginDelegate(
WebView* webview,
const GURL& url,
@@ -62,17 +70,24 @@
// WebWidgetDelegate ---------------------------------------------------------
-void TestWebViewDelegate::Show(WebWidget* webview,
+void TestWebViewDelegate::Show(WebWidget* webwidget,
WindowOpenDisposition disposition) {
-}
+ if (!popup_menu_info_.get())
+ return;
+ if (webwidget != shell_->popup())
+ return;
+ // Display a HTML select menu.
-// Display a HTML select menu.
-void TestWebViewDelegate::ShowAsPopupWithItems(
- WebWidget* webview,
- const WebRect& bounds,
- int item_height,
- int selected_index,
- const std::vector<WebMenuItem>& items) {
+ std::vector<WebMenuItem> items;
+ for (size_t i = 0; i < popup_menu_info_->items.size(); ++i)
+ items.push_back(popup_menu_info_->items[i]);
+
+ int item_height = popup_menu_info_->itemHeight;
+ int selected_index = popup_menu_info_->selectedIndex;
+ popup_menu_info_.reset(); // No longer needed.
+
+ const WebRect& bounds = popup_bounds_;
+
// Set up the menu position.
NSView* web_view = shell_->webViewWnd();
NSRect view_rect = [web_view bounds];
@@ -146,8 +161,7 @@
if (webwidget == shell_->webView()) {
// ignored
} else if (webwidget == shell_->popup()) {
- // MoveWindow(shell_->popupWnd(),
- // rect.x(), rect.y(), rect.width(), rect.height(), FALSE);
+ popup_bounds_ = rect; // The initial position of the popup.
}
}
« no previous file with comments | « webkit/glue/webworker_impl.cc ('k') | webkit/tools/test_shell/test_webview_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698