summaryrefslogtreecommitdiffstats
path: root/webkit/glue/chrome_client_impl.cc
diff options
context:
space:
mode:
authorpaulg@google.com <paulg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-10 03:03:09 +0000
committerpaulg@google.com <paulg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-10 03:03:09 +0000
commit3f64e5af06d2506e1e9886fc834775f2169f21be (patch)
tree6a23effda23684362a666dc02efa3a337fd40f3c /webkit/glue/chrome_client_impl.cc
parent1f73c7ff048b6735e5cf2c36d77ac0cd175d5fb8 (diff)
downloadchromium_src-3f64e5af06d2506e1e9886fc834775f2169f21be.zip
chromium_src-3f64e5af06d2506e1e9886fc834775f2169f21be.tar.gz
chromium_src-3f64e5af06d2506e1e9886fc834775f2169f21be.tar.bz2
Chrome side of the WebKit popup changes.
Implements HTML select popups on Mac OS X as native Cocoa controls. BUG=5095 (http://crbug.com/5095) Review URL: http://codereview.chromium.org/67018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13495 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/chrome_client_impl.cc')
-rw-r--r--webkit/glue/chrome_client_impl.cc53
1 files changed, 27 insertions, 26 deletions
diff --git a/webkit/glue/chrome_client_impl.cc b/webkit/glue/chrome_client_impl.cc
index aebc29b..f3addc5 100644
--- a/webkit/glue/chrome_client_impl.cc
+++ b/webkit/glue/chrome_client_impl.cc
@@ -506,29 +506,30 @@ void ChromeClientImpl::runOpenPanel(WebCore::Frame* frame,
std::wstring(), chooser);
}
-void ChromeClientImpl::popupOpened(WebCore::FramelessScrollView* popup_view,
+void ChromeClientImpl::popupOpened(WebCore::PopupContainer* popup_container,
const WebCore::IntRect& bounds,
- bool activatable) {
+ bool activatable,
+ bool handle_external) {
+ if (handle_external) {
+ // We're going to handle the popup with native controls by the external
+ // embedder.
+ popupOpenedInternal(popup_container, bounds, activatable);
+ return;
+ }
+
WebViewDelegate* delegate = webview_->delegate();
if (delegate) {
WebWidgetImpl* webwidget =
static_cast<WebWidgetImpl*>(delegate->CreatePopupWidget(webview_,
activatable));
- webwidget->Init(popup_view, webkit_glue::IntRectToWebRect(bounds));
+ webwidget->Init(popup_container, webkit_glue::IntRectToWebRect(bounds));
}
}
-void ChromeClientImpl::popupOpenedWithItems(
- WebCore::FramelessScrollView* popup_view,
+void ChromeClientImpl::popupOpenedInternal(
+ WebCore::PopupContainer* popup_container,
const WebCore::IntRect& bounds,
- bool activatable,
- int item_height,
- int selected_index,
- const WTF::Vector<WebCore::PopupListData*>& items) {
- /*
- Uncomment this section once the changes to
- WebKit/WebCore/platform/chromium/PopupMenuChromium* have landed in our tree.
-
+ bool activatable) {
WebViewDelegate* delegate = webview_->delegate();
if (!delegate)
return;
@@ -537,20 +538,21 @@ void ChromeClientImpl::popupOpenedWithItems(
static_cast<WebWidgetImpl*>(delegate->CreatePopupWidget(webview_,
activatable));
// Convert WebKit types for Chromium.
- std::vector<MenuItem> popup_items;
- for (int i = 0; i < items.size(); ++i) {
- MenuItem menu_item;
+ std::vector<WebMenuItem> popup_items;
+ const WTF::Vector<WebCore::PopupItem*>& items = popup_container->popupData();
+ for (int i = 0; i < static_cast<int>(items.size()); ++i) {
+ WebMenuItem menu_item;
menu_item.label = webkit_glue::StringToString16(items[i]->label);
menu_item.enabled = items[i]->enabled;
switch (items[i]->type) {
- case WebCore::PopupListData::TypeOption:
- menu_item.type = MenuItem::OPTION;
+ case WebCore::PopupItem::TypeOption:
+ menu_item.type = WebMenuItem::OPTION;
break;
- case WebCore::PopupListData::TypeGroup:
- menu_item.type = MenuItem::GROUP;
+ case WebCore::PopupItem::TypeGroup:
+ menu_item.type = WebMenuItem::GROUP;
break;
- case WebCore::PopupListData::TypeSeparator:
- menu_item.type = MenuItem::SEPARATOR;
+ case WebCore::PopupItem::TypeSeparator:
+ menu_item.type = WebMenuItem::SEPARATOR;
break;
default:
NOTIMPLEMENTED();
@@ -558,12 +560,11 @@ void ChromeClientImpl::popupOpenedWithItems(
popup_items.push_back(menu_item);
}
- webwidget->InitWithItems(popup_view,
+ webwidget->InitWithItems(popup_container,
webkit_glue::IntRectToWebRect(bounds),
- item_height,
- selected_index,
+ popup_container->menuItemHeight(),
+ popup_container->selectedIndex(),
popup_items);
- */
}
void ChromeClientImpl::SetCursor(const WebCursor& cursor) {