| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 | 8 |
| 9 MSVC_PUSH_WARNING_LEVEL(0); | 9 MSVC_PUSH_WARNING_LEVEL(0); |
| 10 #include "Cursor.h" | 10 #include "Cursor.h" |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 | 499 |
| 500 std::wstring suggestion; | 500 std::wstring suggestion; |
| 501 if (fileChooser->filenames().size() > 0) | 501 if (fileChooser->filenames().size() > 0) |
| 502 suggestion = webkit_glue::StringToStdWString(fileChooser->filenames()[0]); | 502 suggestion = webkit_glue::StringToStdWString(fileChooser->filenames()[0]); |
| 503 | 503 |
| 504 WebFileChooserCallbackImpl* chooser = new WebFileChooserCallbackImpl(fileChoos
er); | 504 WebFileChooserCallbackImpl* chooser = new WebFileChooserCallbackImpl(fileChoos
er); |
| 505 delegate->RunFileChooser(multiple_files, std::wstring(), suggestion, | 505 delegate->RunFileChooser(multiple_files, std::wstring(), suggestion, |
| 506 std::wstring(), chooser); | 506 std::wstring(), chooser); |
| 507 } | 507 } |
| 508 | 508 |
| 509 void ChromeClientImpl::popupOpened(WebCore::FramelessScrollView* popup_view, | 509 void ChromeClientImpl::popupOpened(WebCore::PopupContainer* popup_container, |
| 510 const WebCore::IntRect& bounds, | 510 const WebCore::IntRect& bounds, |
| 511 bool activatable) { | 511 bool activatable, |
| 512 bool handle_external) { |
| 513 if (handle_external) { |
| 514 // We're going to handle the popup with native controls by the external |
| 515 // embedder. |
| 516 popupOpenedInternal(popup_container, bounds, activatable); |
| 517 return; |
| 518 } |
| 519 |
| 512 WebViewDelegate* delegate = webview_->delegate(); | 520 WebViewDelegate* delegate = webview_->delegate(); |
| 513 if (delegate) { | 521 if (delegate) { |
| 514 WebWidgetImpl* webwidget = | 522 WebWidgetImpl* webwidget = |
| 515 static_cast<WebWidgetImpl*>(delegate->CreatePopupWidget(webview_, | 523 static_cast<WebWidgetImpl*>(delegate->CreatePopupWidget(webview_, |
| 516 activatable)); | 524 activatable)); |
| 517 webwidget->Init(popup_view, webkit_glue::IntRectToWebRect(bounds)); | 525 webwidget->Init(popup_container, webkit_glue::IntRectToWebRect(bounds)); |
| 518 } | 526 } |
| 519 } | 527 } |
| 520 | 528 |
| 521 void ChromeClientImpl::popupOpenedWithItems( | 529 void ChromeClientImpl::popupOpenedInternal( |
| 522 WebCore::FramelessScrollView* popup_view, | 530 WebCore::PopupContainer* popup_container, |
| 523 const WebCore::IntRect& bounds, | 531 const WebCore::IntRect& bounds, |
| 524 bool activatable, | 532 bool activatable) { |
| 525 int item_height, | |
| 526 int selected_index, | |
| 527 const WTF::Vector<WebCore::PopupListData*>& items) { | |
| 528 /* | |
| 529 Uncomment this section once the changes to | |
| 530 WebKit/WebCore/platform/chromium/PopupMenuChromium* have landed in our tree. | |
| 531 | |
| 532 WebViewDelegate* delegate = webview_->delegate(); | 533 WebViewDelegate* delegate = webview_->delegate(); |
| 533 if (!delegate) | 534 if (!delegate) |
| 534 return; | 535 return; |
| 535 | 536 |
| 536 WebWidgetImpl* webwidget = | 537 WebWidgetImpl* webwidget = |
| 537 static_cast<WebWidgetImpl*>(delegate->CreatePopupWidget(webview_, | 538 static_cast<WebWidgetImpl*>(delegate->CreatePopupWidget(webview_, |
| 538 activatable)); | 539 activatable)); |
| 539 // Convert WebKit types for Chromium. | 540 // Convert WebKit types for Chromium. |
| 540 std::vector<MenuItem> popup_items; | 541 std::vector<WebMenuItem> popup_items; |
| 541 for (int i = 0; i < items.size(); ++i) { | 542 const WTF::Vector<WebCore::PopupItem*>& items = popup_container->popupData(); |
| 542 MenuItem menu_item; | 543 for (int i = 0; i < static_cast<int>(items.size()); ++i) { |
| 544 WebMenuItem menu_item; |
| 543 menu_item.label = webkit_glue::StringToString16(items[i]->label); | 545 menu_item.label = webkit_glue::StringToString16(items[i]->label); |
| 544 menu_item.enabled = items[i]->enabled; | 546 menu_item.enabled = items[i]->enabled; |
| 545 switch (items[i]->type) { | 547 switch (items[i]->type) { |
| 546 case WebCore::PopupListData::TypeOption: | 548 case WebCore::PopupItem::TypeOption: |
| 547 menu_item.type = MenuItem::OPTION; | 549 menu_item.type = WebMenuItem::OPTION; |
| 548 break; | 550 break; |
| 549 case WebCore::PopupListData::TypeGroup: | 551 case WebCore::PopupItem::TypeGroup: |
| 550 menu_item.type = MenuItem::GROUP; | 552 menu_item.type = WebMenuItem::GROUP; |
| 551 break; | 553 break; |
| 552 case WebCore::PopupListData::TypeSeparator: | 554 case WebCore::PopupItem::TypeSeparator: |
| 553 menu_item.type = MenuItem::SEPARATOR; | 555 menu_item.type = WebMenuItem::SEPARATOR; |
| 554 break; | 556 break; |
| 555 default: | 557 default: |
| 556 NOTIMPLEMENTED(); | 558 NOTIMPLEMENTED(); |
| 557 } | 559 } |
| 558 popup_items.push_back(menu_item); | 560 popup_items.push_back(menu_item); |
| 559 } | 561 } |
| 560 | 562 |
| 561 webwidget->InitWithItems(popup_view, | 563 webwidget->InitWithItems(popup_container, |
| 562 webkit_glue::IntRectToWebRect(bounds), | 564 webkit_glue::IntRectToWebRect(bounds), |
| 563 item_height, | 565 popup_container->menuItemHeight(), |
| 564 selected_index, | 566 popup_container->selectedIndex(), |
| 565 popup_items); | 567 popup_items); |
| 566 */ | |
| 567 } | 568 } |
| 568 | 569 |
| 569 void ChromeClientImpl::SetCursor(const WebCursor& cursor) { | 570 void ChromeClientImpl::SetCursor(const WebCursor& cursor) { |
| 570 if (ignore_next_set_cursor_) { | 571 if (ignore_next_set_cursor_) { |
| 571 ignore_next_set_cursor_ = false; | 572 ignore_next_set_cursor_ = false; |
| 572 return; | 573 return; |
| 573 } | 574 } |
| 574 | 575 |
| 575 WebViewDelegate* delegate = webview_->delegate(); | 576 WebViewDelegate* delegate = webview_->delegate(); |
| 576 if (delegate) | 577 if (delegate) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 595 WebViewDelegate* delegate = webview_->delegate(); | 596 WebViewDelegate* delegate = webview_->delegate(); |
| 596 if (delegate) | 597 if (delegate) |
| 597 delegate->DisableSuddenTermination(); | 598 delegate->DisableSuddenTermination(); |
| 598 } | 599 } |
| 599 | 600 |
| 600 void ChromeClientImpl::formStateDidChange(const WebCore::Node*) { | 601 void ChromeClientImpl::formStateDidChange(const WebCore::Node*) { |
| 601 WebViewDelegate* delegate = webview_->delegate(); | 602 WebViewDelegate* delegate = webview_->delegate(); |
| 602 if (delegate) | 603 if (delegate) |
| 603 delegate->OnNavStateChanged(webview_); | 604 delegate->OnNavStateChanged(webview_); |
| 604 } | 605 } |
| OLD | NEW |