Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). | 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 314 if (policy == WebNavigationPolicyIgnore) | 314 if (policy == WebNavigationPolicyIgnore) |
| 315 policy = getNavigationPolicy(); | 315 policy = getNavigationPolicy(); |
| 316 m_webView->client()->show(policy); | 316 m_webView->client()->show(policy); |
| 317 } | 317 } |
| 318 | 318 |
| 319 bool ChromeClientImpl::canRunModal() | 319 bool ChromeClientImpl::canRunModal() |
| 320 { | 320 { |
| 321 return !!m_webView->client(); | 321 return !!m_webView->client(); |
| 322 } | 322 } |
| 323 | 323 |
| 324 void ChromeClientImpl::runModal() | 324 void ChromeClientImpl::runModal() |
|
darin (slow to review)
2013/09/03 23:21:45
I think you may need a similar thing here. This co
Charlie Reis
2013/09/04 00:01:10
Would we just assume it's the main frame?
| |
| 325 { | 325 { |
| 326 if (m_webView->client()) | 326 if (m_webView->client()) |
| 327 m_webView->client()->runModal(); | 327 m_webView->client()->runModal(); |
| 328 } | 328 } |
| 329 | 329 |
| 330 void ChromeClientImpl::setToolbarsVisible(bool value) | 330 void ChromeClientImpl::setToolbarsVisible(bool value) |
| 331 { | 331 { |
| 332 m_toolbarsVisible = value; | 332 m_toolbarsVisible = value; |
| 333 } | 333 } |
| 334 | 334 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 392 } | 392 } |
| 393 | 393 |
| 394 bool ChromeClientImpl::canRunBeforeUnloadConfirmPanel() | 394 bool ChromeClientImpl::canRunBeforeUnloadConfirmPanel() |
| 395 { | 395 { |
| 396 return !!m_webView->client(); | 396 return !!m_webView->client(); |
| 397 } | 397 } |
| 398 | 398 |
| 399 bool ChromeClientImpl::runBeforeUnloadConfirmPanel(const String& message, Frame* frame) | 399 bool ChromeClientImpl::runBeforeUnloadConfirmPanel(const String& message, Frame* frame) |
| 400 { | 400 { |
| 401 if (m_webView->client()) { | 401 if (m_webView->client()) { |
| 402 if (frame->loader()->stateMachine()->isDisplayingInitialEmptyDocument()) | |
| 403 frame->loader()->forceNotifyForInitialDocumentAccess(); | |
| 402 return m_webView->client()->runModalBeforeUnloadDialog( | 404 return m_webView->client()->runModalBeforeUnloadDialog( |
| 403 WebFrameImpl::fromFrame(frame), message); | 405 WebFrameImpl::fromFrame(frame), message); |
| 404 } | 406 } |
| 405 return false; | 407 return false; |
| 406 } | 408 } |
| 407 | 409 |
| 408 void ChromeClientImpl::closeWindowSoon() | 410 void ChromeClientImpl::closeWindowSoon() |
| 409 { | 411 { |
| 410 // Make sure this Page can no longer be found by JS. | 412 // Make sure this Page can no longer be found by JS. |
| 411 m_webView->page()->clearPageGroup(); | 413 m_webView->page()->clearPageGroup(); |
| 412 | 414 |
| 413 // Make sure that all loading is stopped. Ensures that JS stops executing! | 415 // Make sure that all loading is stopped. Ensures that JS stops executing! |
| 414 m_webView->mainFrame()->stopLoading(); | 416 m_webView->mainFrame()->stopLoading(); |
| 415 | 417 |
| 416 if (m_webView->client()) | 418 if (m_webView->client()) |
| 417 m_webView->client()->closeWidgetSoon(); | 419 m_webView->client()->closeWidgetSoon(); |
| 418 } | 420 } |
| 419 | 421 |
| 420 // Although a Frame is passed in, we don't actually use it, since we | 422 // Although a Frame is passed in, we don't actually use it, since we |
| 421 // already know our own m_webView. | 423 // already know our own m_webView. |
| 422 void ChromeClientImpl::runJavaScriptAlert(Frame* frame, const String& message) | 424 void ChromeClientImpl::runJavaScriptAlert(Frame* frame, const String& message) |
| 423 { | 425 { |
| 424 if (m_webView->client()) { | 426 if (m_webView->client()) { |
| 425 if (WebUserGestureIndicator::isProcessingUserGesture()) | 427 if (WebUserGestureIndicator::isProcessingUserGesture()) |
| 426 WebUserGestureIndicator::currentUserGestureToken().setJavascriptProm pt(); | 428 WebUserGestureIndicator::currentUserGestureToken().setJavascriptProm pt(); |
| 429 if (frame->loader()->stateMachine()->isDisplayingInitialEmptyDocument()) | |
| 430 frame->loader()->forceNotifyForInitialDocumentAccess(); | |
| 427 m_webView->client()->runModalAlertDialog( | 431 m_webView->client()->runModalAlertDialog( |
| 428 WebFrameImpl::fromFrame(frame), message); | 432 WebFrameImpl::fromFrame(frame), message); |
| 429 } | 433 } |
| 430 } | 434 } |
| 431 | 435 |
| 432 // See comments for runJavaScriptAlert(). | 436 // See comments for runJavaScriptAlert(). |
| 433 bool ChromeClientImpl::runJavaScriptConfirm(Frame* frame, const String& message) | 437 bool ChromeClientImpl::runJavaScriptConfirm(Frame* frame, const String& message) |
| 434 { | 438 { |
| 435 if (m_webView->client()) { | 439 if (m_webView->client()) { |
| 436 if (WebUserGestureIndicator::isProcessingUserGesture()) | 440 if (WebUserGestureIndicator::isProcessingUserGesture()) |
| 437 WebUserGestureIndicator::currentUserGestureToken().setJavascriptProm pt(); | 441 WebUserGestureIndicator::currentUserGestureToken().setJavascriptProm pt(); |
| 442 if (frame->loader()->stateMachine()->isDisplayingInitialEmptyDocument()) | |
| 443 frame->loader()->forceNotifyForInitialDocumentAccess(); | |
| 438 return m_webView->client()->runModalConfirmDialog( | 444 return m_webView->client()->runModalConfirmDialog( |
| 439 WebFrameImpl::fromFrame(frame), message); | 445 WebFrameImpl::fromFrame(frame), message); |
| 440 } | 446 } |
| 441 return false; | 447 return false; |
| 442 } | 448 } |
| 443 | 449 |
| 444 // See comments for runJavaScriptAlert(). | 450 // See comments for runJavaScriptAlert(). |
| 445 bool ChromeClientImpl::runJavaScriptPrompt(Frame* frame, | 451 bool ChromeClientImpl::runJavaScriptPrompt(Frame* frame, |
| 446 const String& message, | 452 const String& message, |
| 447 const String& defaultValue, | 453 const String& defaultValue, |
| 448 String& result) | 454 String& result) |
| 449 { | 455 { |
| 450 if (m_webView->client()) { | 456 if (m_webView->client()) { |
| 451 if (WebUserGestureIndicator::isProcessingUserGesture()) | 457 if (WebUserGestureIndicator::isProcessingUserGesture()) |
| 452 WebUserGestureIndicator::currentUserGestureToken().setJavascriptProm pt(); | 458 WebUserGestureIndicator::currentUserGestureToken().setJavascriptProm pt(); |
| 459 if (frame->loader()->stateMachine()->isDisplayingInitialEmptyDocument()) | |
|
darin (slow to review)
2013/09/03 23:21:45
It kind of sucks to repeat the stateMachine condit
Charlie Reis
2013/09/04 00:01:10
Fair point. I ended up putting it second in the i
| |
| 460 frame->loader()->forceNotifyForInitialDocumentAccess(); | |
| 453 WebString actualValue; | 461 WebString actualValue; |
| 454 bool ok = m_webView->client()->runModalPromptDialog( | 462 bool ok = m_webView->client()->runModalPromptDialog( |
| 455 WebFrameImpl::fromFrame(frame), | 463 WebFrameImpl::fromFrame(frame), |
| 456 message, | 464 message, |
| 457 defaultValue, | 465 defaultValue, |
| 458 &actualValue); | 466 &actualValue); |
| 459 if (ok) | 467 if (ok) |
| 460 result = actualValue; | 468 result = actualValue; |
| 461 return ok; | 469 return ok; |
| 462 } | 470 } |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1016 { | 1024 { |
| 1017 } | 1025 } |
| 1018 | 1026 |
| 1019 void NavigatorContentUtilsClientImpl::registerProtocolHandler(const String& sche me, const String& baseURL, const String& url, const String& title) | 1027 void NavigatorContentUtilsClientImpl::registerProtocolHandler(const String& sche me, const String& baseURL, const String& url, const String& title) |
| 1020 { | 1028 { |
| 1021 m_webView->client()->registerProtocolHandler(scheme, baseURL, url, title); | 1029 m_webView->client()->registerProtocolHandler(scheme, baseURL, url, title); |
| 1022 } | 1030 } |
| 1023 #endif | 1031 #endif |
| 1024 | 1032 |
| 1025 } // namespace WebKit | 1033 } // namespace WebKit |
| OLD | NEW |