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

Unified Diff: Source/web/ChromeClientImpl.cpp

Issue 226413004: Move modal dialogs from WebViewClient to WebFrameClient, part 2/3. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: remove redundancy Created 6 years, 8 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 | « no previous file | public/web/WebFrameClient.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/ChromeClientImpl.cpp
diff --git a/Source/web/ChromeClientImpl.cpp b/Source/web/ChromeClientImpl.cpp
index 51f4257d72bdefe9786b0ac35a425761e253369d..d0d912ceece865819d919ab650e45e2d0b8e903d 100644
--- a/Source/web/ChromeClientImpl.cpp
+++ b/Source/web/ChromeClientImpl.cpp
@@ -388,10 +388,15 @@ bool ChromeClientImpl::canRunBeforeUnloadConfirmPanel()
bool ChromeClientImpl::runBeforeUnloadConfirmPanel(const String& message, LocalFrame* frame)
{
- if (m_webView->client()) {
- return m_webView->client()->runModalBeforeUnloadDialog(
- WebFrameImpl::fromFrame(frame), message);
- }
+ WebFrameImpl* webframe = WebFrameImpl::fromFrame(frame);
+
+ bool isReload = false;
+ WebDataSource* ds = webframe->provisionalDataSource();
+ if (ds)
+ isReload = (ds->navigationType() == blink::WebNavigationTypeReload);
+
+ if (webframe->client())
+ return webframe->client()->runModalBeforeUnloadDialog(isReload, message);
return false;
}
@@ -411,22 +416,22 @@ void ChromeClientImpl::closeWindowSoon()
// already know our own m_webView.
void ChromeClientImpl::runJavaScriptAlert(LocalFrame* frame, const String& message)
{
- if (m_webView->client()) {
+ WebFrameImpl* webframe = WebFrameImpl::fromFrame(frame);
+ if (webframe->client()) {
if (WebUserGestureIndicator::isProcessingUserGesture())
WebUserGestureIndicator::currentUserGestureToken().setJavascriptPrompt();
- m_webView->client()->runModalAlertDialog(
- WebFrameImpl::fromFrame(frame), message);
+ webframe->client()->runModalAlertDialog(message);
}
}
// See comments for runJavaScriptAlert().
bool ChromeClientImpl::runJavaScriptConfirm(LocalFrame* frame, const String& message)
{
- if (m_webView->client()) {
+ WebFrameImpl* webframe = WebFrameImpl::fromFrame(frame);
+ if (webframe->client()) {
if (WebUserGestureIndicator::isProcessingUserGesture())
WebUserGestureIndicator::currentUserGestureToken().setJavascriptPrompt();
- return m_webView->client()->runModalConfirmDialog(
- WebFrameImpl::fromFrame(frame), message);
+ return webframe->client()->runModalConfirmDialog(message);
}
return false;
}
@@ -437,12 +442,12 @@ bool ChromeClientImpl::runJavaScriptPrompt(LocalFrame* frame,
const String& defaultValue,
String& result)
{
- if (m_webView->client()) {
+ WebFrameImpl* webframe = WebFrameImpl::fromFrame(frame);
+ if (webframe->client()) {
if (WebUserGestureIndicator::isProcessingUserGesture())
WebUserGestureIndicator::currentUserGestureToken().setJavascriptPrompt();
WebString actualValue;
- bool ok = m_webView->client()->runModalPromptDialog(
- WebFrameImpl::fromFrame(frame),
+ bool ok = webframe->client()->runModalPromptDialog(
message,
defaultValue,
&actualValue);
« no previous file with comments | « no previous file | public/web/WebFrameClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698