| 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 "AccessibilityObject.h" | 7 #include "AccessibilityObject.h" |
| 8 #include "AXObjectCache.h" | 8 #include "AXObjectCache.h" |
| 9 #include "CharacterNames.h" | 9 #include "CharacterNames.h" |
| 10 #include "Console.h" | 10 #include "Console.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "Page.h" | 22 #include "Page.h" |
| 23 #include "PopupMenuChromium.h" | 23 #include "PopupMenuChromium.h" |
| 24 #include "ScriptController.h" | 24 #include "ScriptController.h" |
| 25 #include "WindowFeatures.h" | 25 #include "WindowFeatures.h" |
| 26 #if USE(V8) | 26 #if USE(V8) |
| 27 #include "V8Proxy.h" | 27 #include "V8Proxy.h" |
| 28 #endif | 28 #endif |
| 29 #undef LOG | 29 #undef LOG |
| 30 | 30 |
| 31 #include "googleurl/src/gurl.h" | 31 #include "googleurl/src/gurl.h" |
| 32 #include "webkit/api/public/WebConsoleMessage.h" |
| 32 #include "webkit/api/public/WebCursorInfo.h" | 33 #include "webkit/api/public/WebCursorInfo.h" |
| 33 #include "webkit/api/public/WebFrameClient.h" | 34 #include "webkit/api/public/WebFrameClient.h" |
| 34 #include "webkit/api/public/WebInputEvent.h" | 35 #include "webkit/api/public/WebInputEvent.h" |
| 35 #include "webkit/api/public/WebKit.h" | 36 #include "webkit/api/public/WebKit.h" |
| 36 #include "webkit/api/public/WebPopupMenuInfo.h" | 37 #include "webkit/api/public/WebPopupMenuInfo.h" |
| 37 #include "webkit/api/public/WebRect.h" | 38 #include "webkit/api/public/WebRect.h" |
| 38 #include "webkit/api/public/WebTextDirection.h" | 39 #include "webkit/api/public/WebTextDirection.h" |
| 39 #include "webkit/api/public/WebURLRequest.h" | 40 #include "webkit/api/public/WebURLRequest.h" |
| 40 #include "webkit/api/src/NotificationPresenterImpl.h" | 41 #include "webkit/api/src/NotificationPresenterImpl.h" |
| 41 #include "webkit/api/src/WrappedResourceRequest.h" | 42 #include "webkit/api/src/WrappedResourceRequest.h" |
| 42 #include "webkit/glue/chrome_client_impl.h" | 43 #include "webkit/glue/chrome_client_impl.h" |
| 43 #include "webkit/glue/glue_util.h" | 44 #include "webkit/glue/glue_util.h" |
| 44 #include "webkit/glue/webframe_impl.h" | 45 #include "webkit/glue/webframe_impl.h" |
| 45 #include "webkit/glue/webkit_glue.h" | 46 #include "webkit/glue/webkit_glue.h" |
| 46 #include "webkit/glue/webpopupmenu_impl.h" | 47 #include "webkit/glue/webpopupmenu_impl.h" |
| 47 #include "webkit/glue/webview_delegate.h" | 48 #include "webkit/glue/webview_delegate.h" |
| 48 #include "webkit/glue/webview_impl.h" | 49 #include "webkit/glue/webview_impl.h" |
| 49 | 50 |
| 50 using WebCore::PopupContainer; | 51 using WebCore::PopupContainer; |
| 51 using WebCore::PopupItem; | 52 using WebCore::PopupItem; |
| 52 | 53 |
| 54 using WebKit::WebConsoleMessage; |
| 53 using WebKit::WebCursorInfo; | 55 using WebKit::WebCursorInfo; |
| 54 using WebKit::WebInputEvent; | 56 using WebKit::WebInputEvent; |
| 55 using WebKit::WebMouseEvent; | 57 using WebKit::WebMouseEvent; |
| 56 using WebKit::WebNavigationPolicy; | 58 using WebKit::WebNavigationPolicy; |
| 57 using WebKit::WebPopupMenuInfo; | 59 using WebKit::WebPopupMenuInfo; |
| 58 using WebKit::WebRect; | 60 using WebKit::WebRect; |
| 61 using WebKit::WebString; |
| 59 using WebKit::WebTextDirection; | 62 using WebKit::WebTextDirection; |
| 63 using WebKit::WebURL; |
| 60 using WebKit::WebURLRequest; | 64 using WebKit::WebURLRequest; |
| 61 using WebKit::WebVector; | 65 using WebKit::WebVector; |
| 62 using WebKit::WebWidget; | 66 using WebKit::WebWidget; |
| 63 using WebKit::WrappedResourceRequest; | 67 using WebKit::WrappedResourceRequest; |
| 64 | 68 |
| 65 // Callback class that's given to the WebViewDelegate during a file choose | 69 // Callback class that's given to the WebViewDelegate during a file choose |
| 66 // operation. | 70 // operation. |
| 67 class WebFileChooserCallbackImpl : public WebFileChooserCallback { | 71 class WebFileChooserCallbackImpl : public WebFileChooserCallback { |
| 68 public: | 72 public: |
| 69 WebFileChooserCallbackImpl(PassRefPtr<WebCore::FileChooser> file_chooser) | 73 WebFileChooserCallbackImpl(PassRefPtr<WebCore::FileChooser> file_chooser) |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 delegate->didBlur(); | 189 delegate->didBlur(); |
| 186 } | 190 } |
| 187 | 191 |
| 188 bool ChromeClientImpl::canTakeFocus(WebCore::FocusDirection) { | 192 bool ChromeClientImpl::canTakeFocus(WebCore::FocusDirection) { |
| 189 // For now the browser can always take focus if we're not running layout | 193 // For now the browser can always take focus if we're not running layout |
| 190 // tests. | 194 // tests. |
| 191 return !WebKit::layoutTestMode(); | 195 return !WebKit::layoutTestMode(); |
| 192 } | 196 } |
| 193 | 197 |
| 194 void ChromeClientImpl::takeFocus(WebCore::FocusDirection direction) { | 198 void ChromeClientImpl::takeFocus(WebCore::FocusDirection direction) { |
| 195 WebViewDelegate* delegate = webview_->delegate(); | 199 if (!webview_->client()) |
| 196 if (delegate) { | 200 return; |
| 197 delegate->TakeFocus(webview_, | 201 if (direction == WebCore::FocusDirectionBackward) { |
| 198 direction == WebCore::FocusDirectionBackward); | 202 webview_->client()->focusPrevious(); |
| 203 } else { |
| 204 webview_->client()->focusNext(); |
| 199 } | 205 } |
| 200 } | 206 } |
| 201 | 207 |
| 202 WebCore::Page* ChromeClientImpl::createWindow( | 208 WebCore::Page* ChromeClientImpl::createWindow( |
| 203 WebCore::Frame* frame, const WebCore::FrameLoadRequest& r, | 209 WebCore::Frame* frame, const WebCore::FrameLoadRequest& r, |
| 204 const WebCore::WindowFeatures& features) { | 210 const WebCore::WindowFeatures& features) { |
| 205 WebViewDelegate* delegate = webview_->delegate(); | 211 if (!webview_->client()) |
| 206 if (!delegate) | |
| 207 return NULL; | 212 return NULL; |
| 208 | 213 |
| 209 bool user_gesture = frame->script()->processingUserGesture(); | |
| 210 | |
| 211 const std::string security_origin(webkit_glue::StringToStdString( | |
| 212 frame->document()->securityOrigin()->toString())); | |
| 213 GURL creator_url(security_origin); | |
| 214 WebViewImpl* new_view = static_cast<WebViewImpl*>( | 214 WebViewImpl* new_view = static_cast<WebViewImpl*>( |
| 215 delegate->CreateWebView(webview_, user_gesture, | 215 webview_->client()->createView(WebFrameImpl::FromFrame(frame))); |
| 216 (creator_url.is_valid() && creator_url.IsStandard()) ? | |
| 217 creator_url : GURL())); | |
| 218 if (!new_view) | 216 if (!new_view) |
| 219 return NULL; | 217 return NULL; |
| 220 | 218 |
| 221 // The request is empty when we are just being asked to open a blank window. | 219 // The request is empty when we are just being asked to open a blank window. |
| 222 // This corresponds to window.open(""), for example. | 220 // This corresponds to window.open(""), for example. |
| 223 if (!r.resourceRequest().isEmpty()) { | 221 if (!r.resourceRequest().isEmpty()) { |
| 224 WrappedResourceRequest request(r.resourceRequest()); | 222 WrappedResourceRequest request(r.resourceRequest()); |
| 225 new_view->main_frame()->loadRequest(request); | 223 new_view->main_frame()->loadRequest(request); |
| 226 } | 224 } |
| 227 | 225 |
| 228 WebViewImpl* new_view_impl = static_cast<WebViewImpl*>(new_view); | 226 return new_view->page(); |
| 229 return new_view_impl->page(); | |
| 230 } | 227 } |
| 231 | 228 |
| 232 static inline bool CurrentEventShouldCauseBackgroundTab( | 229 static inline bool CurrentEventShouldCauseBackgroundTab( |
| 233 const WebInputEvent* input_event) { | 230 const WebInputEvent* input_event) { |
| 234 if (!input_event) | 231 if (!input_event) |
| 235 return false; | 232 return false; |
| 236 | 233 |
| 237 if (input_event->type != WebInputEvent::MouseUp) | 234 if (input_event->type != WebInputEvent::MouseUp) |
| 238 return false; | 235 return false; |
| 239 | 236 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 void ChromeClientImpl::setResizable(bool value) { | 313 void ChromeClientImpl::setResizable(bool value) { |
| 317 resizable_ = value; | 314 resizable_ = value; |
| 318 } | 315 } |
| 319 | 316 |
| 320 void ChromeClientImpl::addMessageToConsole(WebCore::MessageSource source, | 317 void ChromeClientImpl::addMessageToConsole(WebCore::MessageSource source, |
| 321 WebCore::MessageType type, | 318 WebCore::MessageType type, |
| 322 WebCore::MessageLevel level, | 319 WebCore::MessageLevel level, |
| 323 const WebCore::String& message, | 320 const WebCore::String& message, |
| 324 unsigned int line_no, | 321 unsigned int line_no, |
| 325 const WebCore::String& source_id) { | 322 const WebCore::String& source_id) { |
| 326 WebViewDelegate* delegate = webview_->delegate(); | 323 if (webview_->client()) { |
| 327 if (delegate) { | 324 webview_->client()->didAddMessageToConsole( |
| 328 std::wstring wstr_message = webkit_glue::StringToStdWString(message); | 325 WebConsoleMessage(static_cast<WebConsoleMessage::Level>(level), |
| 329 std::wstring wstr_source_id = webkit_glue::StringToStdWString(source_id); | 326 webkit_glue::StringToWebString(message)), |
| 330 delegate->AddMessageToConsole(webview_, wstr_message, | 327 webkit_glue::StringToWebString(source_id), |
| 331 line_no, wstr_source_id); | 328 line_no); |
| 332 } | 329 } |
| 333 } | 330 } |
| 334 | 331 |
| 335 bool ChromeClientImpl::canRunBeforeUnloadConfirmPanel() { | 332 bool ChromeClientImpl::canRunBeforeUnloadConfirmPanel() { |
| 336 return webview_->delegate() != NULL; | 333 return webview_->delegate() != NULL; |
| 337 } | 334 } |
| 338 | 335 |
| 339 bool ChromeClientImpl::runBeforeUnloadConfirmPanel( | 336 bool ChromeClientImpl::runBeforeUnloadConfirmPanel( |
| 340 const WebCore::String& message, | 337 const WebCore::String& message, |
| 341 WebCore::Frame* frame) { | 338 WebCore::Frame* frame) { |
| 342 WebViewDelegate* delegate = webview_->delegate(); | 339 if (webview_->client()) { |
| 343 if (delegate) { | 340 return webview_->client()->runModalBeforeUnloadDialog( |
| 344 std::wstring wstr = webkit_glue::StringToStdWString(message); | 341 WebFrameImpl::FromFrame(frame), |
| 345 return delegate->RunBeforeUnloadConfirm(WebFrameImpl::FromFrame(frame), | 342 webkit_glue::StringToWebString(message)); |
| 346 wstr); | |
| 347 } | 343 } |
| 348 return false; | 344 return false; |
| 349 } | 345 } |
| 350 | 346 |
| 351 void ChromeClientImpl::closeWindowSoon() { | 347 void ChromeClientImpl::closeWindowSoon() { |
| 352 // Make sure this Page can no longer be found by JS. | 348 // Make sure this Page can no longer be found by JS. |
| 353 webview_->page()->setGroupName(WebCore::String()); | 349 webview_->page()->setGroupName(WebCore::String()); |
| 354 | 350 |
| 355 // Make sure that all loading is stopped. Ensures that JS stops executing! | 351 // Make sure that all loading is stopped. Ensures that JS stops executing! |
| 356 webview_->StopLoading(); | 352 webview_->StopLoading(); |
| 357 | 353 |
| 358 WebViewDelegate* delegate = webview_->delegate(); | 354 if (webview_->client()) |
| 359 if (delegate) | 355 webview_->client()->closeWidgetSoon(); |
| 360 delegate->closeWidgetSoon(); | |
| 361 } | 356 } |
| 362 | 357 |
| 363 // Although a WebCore::Frame is passed in, we don't actually use it, since we | 358 // Although a WebCore::Frame is passed in, we don't actually use it, since we |
| 364 // already know our own webview_. | 359 // already know our own webview_. |
| 365 void ChromeClientImpl::runJavaScriptAlert(WebCore::Frame* frame, | 360 void ChromeClientImpl::runJavaScriptAlert(WebCore::Frame* frame, |
| 366 const WebCore::String& message) { | 361 const WebCore::String& message) { |
| 367 // Pass the request on to the WebView delegate, for more control. | 362 if (webview_->client()) { |
| 368 WebViewDelegate* delegate = webview_->delegate(); | |
| 369 if (delegate) { | |
| 370 #if USE(V8) | 363 #if USE(V8) |
| 371 // Before showing the JavaScript dialog, we give the proxy implementation | 364 // Before showing the JavaScript dialog, we give the proxy implementation |
| 372 // a chance to process any pending console messages. | 365 // a chance to process any pending console messages. |
| 373 WebCore::V8Proxy::processConsoleMessages(); | 366 WebCore::V8Proxy::processConsoleMessages(); |
| 374 #endif | 367 #endif |
| 375 | 368 webview_->client()->runModalAlertDialog( |
| 376 std::wstring wstr = webkit_glue::StringToStdWString(message); | 369 WebFrameImpl::FromFrame(frame), |
| 377 delegate->RunJavaScriptAlert(WebFrameImpl::FromFrame(frame), wstr); | 370 webkit_glue::StringToWebString(message)); |
| 378 } | 371 } |
| 379 } | 372 } |
| 380 | 373 |
| 381 // See comments for runJavaScriptAlert(). | 374 // See comments for runJavaScriptAlert(). |
| 382 bool ChromeClientImpl::runJavaScriptConfirm(WebCore::Frame* frame, | 375 bool ChromeClientImpl::runJavaScriptConfirm(WebCore::Frame* frame, |
| 383 const WebCore::String& message) { | 376 const WebCore::String& message) { |
| 384 WebViewDelegate* delegate = webview_->delegate(); | 377 if (webview_->client()) { |
| 385 if (delegate) { | 378 return webview_->client()->runModalConfirmDialog( |
| 386 std::wstring wstr = webkit_glue::StringToStdWString(message); | 379 WebFrameImpl::FromFrame(frame), |
| 387 return delegate->RunJavaScriptConfirm(WebFrameImpl::FromFrame(frame), wstr); | 380 webkit_glue::StringToWebString(message)); |
| 388 } | 381 } |
| 389 return false; | 382 return false; |
| 390 } | 383 } |
| 391 | 384 |
| 392 // See comments for runJavaScriptAlert(). | 385 // See comments for runJavaScriptAlert(). |
| 393 bool ChromeClientImpl::runJavaScriptPrompt(WebCore::Frame* frame, | 386 bool ChromeClientImpl::runJavaScriptPrompt(WebCore::Frame* frame, |
| 394 const WebCore::String& message, | 387 const WebCore::String& message, |
| 395 const WebCore::String& defaultValue, | 388 const WebCore::String& default_value, |
| 396 WebCore::String& result) { | 389 WebCore::String& result) { |
| 397 WebViewDelegate* delegate = webview_->delegate(); | 390 if (webview_->client()) { |
| 398 if (delegate) { | 391 WebString actual_value; |
| 399 std::wstring wstr_message = webkit_glue::StringToStdWString(message); | 392 bool ok = webview_->client()->runModalPromptDialog( |
| 400 std::wstring wstr_default = webkit_glue::StringToStdWString(defaultValue); | 393 WebFrameImpl::FromFrame(frame), |
| 401 std::wstring wstr_result; | 394 webkit_glue::StringToWebString(message), |
| 402 bool ok = delegate->RunJavaScriptPrompt(WebFrameImpl::FromFrame(frame), | 395 webkit_glue::StringToWebString(default_value), |
| 403 wstr_message, | 396 &actual_value); |
| 404 wstr_default, | |
| 405 &wstr_result); | |
| 406 if (ok) | 397 if (ok) |
| 407 result = webkit_glue::StdWStringToString(wstr_result); | 398 result = webkit_glue::WebStringToString(actual_value); |
| 408 return ok; | 399 return ok; |
| 409 } | 400 } |
| 410 return false; | 401 return false; |
| 411 } | 402 } |
| 412 | 403 |
| 413 void ChromeClientImpl::setStatusbarText(const WebCore::String& message) { | 404 void ChromeClientImpl::setStatusbarText(const WebCore::String& message) { |
| 414 WebViewDelegate* delegate = webview_->delegate(); | 405 if (webview_->client()) { |
| 415 if (delegate) { | 406 webview_->client()->setStatusText( |
| 416 std::wstring wstr = webkit_glue::StringToStdWString(message); | 407 webkit_glue::StringToWebString(message)); |
| 417 delegate->SetStatusbarText(webview_, wstr); | |
| 418 } | 408 } |
| 419 } | 409 } |
| 420 | 410 |
| 421 bool ChromeClientImpl::shouldInterruptJavaScript() { | 411 bool ChromeClientImpl::shouldInterruptJavaScript() { |
| 422 // TODO(mbelshe): implement me | 412 // TODO(mbelshe): implement me |
| 423 return false; | 413 return false; |
| 424 } | 414 } |
| 425 | 415 |
| 426 bool ChromeClientImpl::tabsToLinks() const { | 416 bool ChromeClientImpl::tabsToLinks() const { |
| 427 // TODO(pamg): Consider controlling this with a user preference, when we have | 417 // TODO(pamg): Consider controlling this with a user preference, when we have |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 if (webframe->client()) { | 482 if (webframe->client()) { |
| 493 webframe->client()->didChangeContentsSize( | 483 webframe->client()->didChangeContentsSize( |
| 494 webframe, webkit_glue::IntSizeToWebSize(size)); | 484 webframe, webkit_glue::IntSizeToWebSize(size)); |
| 495 } | 485 } |
| 496 } | 486 } |
| 497 | 487 |
| 498 void ChromeClientImpl::scrollbarsModeDidChange() const { | 488 void ChromeClientImpl::scrollbarsModeDidChange() const { |
| 499 } | 489 } |
| 500 | 490 |
| 501 void ChromeClientImpl::mouseDidMoveOverElement( | 491 void ChromeClientImpl::mouseDidMoveOverElement( |
| 502 const WebCore::HitTestResult& result, unsigned modifierFlags) { | 492 const WebCore::HitTestResult& result, unsigned modifier_flags) { |
| 503 // Find out if the mouse is over a link, and if so, let our UI know... somehow | 493 if (!webview_->client()) |
| 504 WebViewDelegate* delegate = webview_->delegate(); | 494 return; |
| 505 if (delegate) { | 495 // Find out if the mouse is over a link, and if so, let our UI know... |
| 506 if (result.isLiveLink() && !result.absoluteLinkURL().string().isEmpty()) { | 496 if (result.isLiveLink() && !result.absoluteLinkURL().string().isEmpty()) { |
| 507 delegate->UpdateTargetURL( | 497 webview_->client()->setMouseOverURL( |
| 508 webview_, webkit_glue::KURLToGURL(result.absoluteLinkURL())); | 498 webkit_glue::KURLToWebURL(result.absoluteLinkURL())); |
| 509 } else { | 499 } else { |
| 510 delegate->UpdateTargetURL(webview_, GURL()); | 500 webview_->client()->setMouseOverURL(WebURL()); |
| 511 } | |
| 512 } | 501 } |
| 513 } | 502 } |
| 514 | 503 |
| 515 void ChromeClientImpl::setToolTip(const WebCore::String& tooltip_text, | 504 void ChromeClientImpl::setToolTip(const WebCore::String& tooltip_text, |
| 516 WebCore::TextDirection dir) { | 505 WebCore::TextDirection dir) { |
| 517 if (webview_->delegate()) { | 506 if (!webview_->client()) |
| 518 std::wstring tooltip_text_as_wstring = | 507 return; |
| 519 webkit_glue::StringToStdWString(tooltip_text); | 508 WebTextDirection text_direction = (dir == WebCore::RTL) ? |
| 520 WebTextDirection text_direction = (dir == WebCore::RTL) ? | 509 WebKit::WebTextDirectionRightToLeft : |
| 521 WebKit::WebTextDirectionRightToLeft : | 510 WebKit::WebTextDirectionLeftToRight; |
| 522 WebKit::WebTextDirectionLeftToRight; | 511 webview_->client()->setToolTipText( |
| 523 webview_->delegate()->SetTooltipText(webview_, tooltip_text_as_wstring, | 512 webkit_glue::StringToWebString(tooltip_text), text_direction); |
| 524 text_direction); | |
| 525 } | |
| 526 } | 513 } |
| 527 | 514 |
| 528 void ChromeClientImpl::print(WebCore::Frame* frame) { | 515 void ChromeClientImpl::print(WebCore::Frame* frame) { |
| 529 WebViewDelegate* delegate = webview_->delegate(); | 516 if (webview_->client()) |
| 530 if (delegate) { | 517 webview_->client()->printPage(WebFrameImpl::FromFrame(frame)); |
| 531 delegate->ScriptedPrint(WebFrameImpl::FromFrame(frame)); | |
| 532 } | |
| 533 } | 518 } |
| 534 | 519 |
| 535 void ChromeClientImpl::exceededDatabaseQuota(WebCore::Frame* frame, | 520 void ChromeClientImpl::exceededDatabaseQuota(WebCore::Frame* frame, |
| 536 const WebCore::String& databaseName) { | 521 const WebCore::String& databaseName) { |
| 537 // set a reasonable quota for now -- 5Mb should be enough for anybody | 522 // set a reasonable quota for now -- 5Mb should be enough for anybody |
| 538 // TODO(dglazkov): this should be configurable | 523 // TODO(dglazkov): this should be configurable |
| 539 WebCore::SecurityOrigin* origin = frame->document()->securityOrigin(); | 524 WebCore::SecurityOrigin* origin = frame->document()->securityOrigin(); |
| 540 WebCore::DatabaseTracker::tracker().setQuota(origin, 1024 * 1024 * 5); | 525 WebCore::DatabaseTracker::tracker().setQuota(origin, 1024 * 1024 * 5); |
| 541 } | 526 } |
| 542 | 527 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 555 | 540 |
| 556 WebFileChooserCallbackImpl* chooser = | 541 WebFileChooserCallbackImpl* chooser = |
| 557 new WebFileChooserCallbackImpl(fileChooser); | 542 new WebFileChooserCallbackImpl(fileChooser); |
| 558 delegate->RunFileChooser(multiple_files, string16(), suggestion, chooser); | 543 delegate->RunFileChooser(multiple_files, string16(), suggestion, chooser); |
| 559 } | 544 } |
| 560 | 545 |
| 561 void ChromeClientImpl::popupOpened(PopupContainer* popup_container, | 546 void ChromeClientImpl::popupOpened(PopupContainer* popup_container, |
| 562 const WebCore::IntRect& bounds, | 547 const WebCore::IntRect& bounds, |
| 563 bool activatable, | 548 bool activatable, |
| 564 bool handle_externally) { | 549 bool handle_externally) { |
| 565 WebViewDelegate* delegate = webview_->delegate(); | 550 if (!webview_->client()) |
| 566 if (!delegate) | |
| 567 return; | 551 return; |
| 568 | 552 |
| 569 WebWidget* webwidget; | 553 WebWidget* webwidget; |
| 570 if (handle_externally) { | 554 if (handle_externally) { |
| 571 WebPopupMenuInfo popup_info; | 555 WebPopupMenuInfo popup_info; |
| 572 GetPopupMenuInfo(popup_container, &popup_info); | 556 GetPopupMenuInfo(popup_container, &popup_info); |
| 573 webwidget = delegate->CreatePopupWidgetWithInfo(webview_, popup_info); | 557 webwidget = webview_->client()->createPopupMenu(popup_info); |
| 574 } else { | 558 } else { |
| 575 webwidget = delegate->CreatePopupWidget(webview_, activatable); | 559 webwidget = webview_->client()->createPopupMenu(activatable); |
| 576 } | 560 } |
| 577 | 561 |
| 578 static_cast<WebPopupMenuImpl*>(webwidget)->Init( | 562 static_cast<WebPopupMenuImpl*>(webwidget)->Init( |
| 579 popup_container, webkit_glue::IntRectToWebRect(bounds)); | 563 popup_container, webkit_glue::IntRectToWebRect(bounds)); |
| 580 } | 564 } |
| 581 | 565 |
| 582 void ChromeClientImpl::SetCursor(const WebCursorInfo& cursor) { | 566 void ChromeClientImpl::SetCursor(const WebCursorInfo& cursor) { |
| 583 if (ignore_next_set_cursor_) { | 567 if (ignore_next_set_cursor_) { |
| 584 ignore_next_set_cursor_ = false; | 568 ignore_next_set_cursor_ = false; |
| 585 return; | 569 return; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 info->itemHeight = popup_container->menuItemHeight(); | 621 info->itemHeight = popup_container->menuItemHeight(); |
| 638 info->selectedIndex = popup_container->selectedIndex(); | 622 info->selectedIndex = popup_container->selectedIndex(); |
| 639 info->items.swap(output_items); | 623 info->items.swap(output_items); |
| 640 } | 624 } |
| 641 | 625 |
| 642 #if ENABLE(NOTIFICATIONS) | 626 #if ENABLE(NOTIFICATIONS) |
| 643 WebCore::NotificationPresenter* ChromeClientImpl::notificationPresenter() const
{ | 627 WebCore::NotificationPresenter* ChromeClientImpl::notificationPresenter() const
{ |
| 644 return webview_->GetNotificationPresenter(); | 628 return webview_->GetNotificationPresenter(); |
| 645 } | 629 } |
| 646 #endif | 630 #endif |
| OLD | NEW |