summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xchrome/browser/extensions/extension_view.cc1
-rwxr-xr-xchrome/browser/extensions/extension_view.h1
-rwxr-xr-xchrome/browser/extensions/extension_view_unittest.cc1
-rw-r--r--chrome/browser/js_before_unload_handler.h1
-rw-r--r--chrome/browser/js_before_unload_handler_win.cc19
-rw-r--r--chrome/browser/js_before_unload_handler_win.h1
-rw-r--r--chrome/browser/jsmessage_box_handler.h2
-rw-r--r--chrome/browser/jsmessage_box_handler_win.cc27
-rw-r--r--chrome/browser/jsmessage_box_handler_win.h6
-rw-r--r--chrome/browser/renderer_host/render_view_host.cc9
-rw-r--r--chrome/browser/renderer_host/render_view_host.h4
-rw-r--r--chrome/browser/renderer_host/render_view_host_delegate.h4
-rw-r--r--chrome/browser/tab_contents/web_contents.cc10
-rw-r--r--chrome/browser/tab_contents/web_contents.h4
-rw-r--r--chrome/common/render_messages_internal.h6
-rw-r--r--chrome/common/temp_scaffolding_stubs.cc2
-rw-r--r--chrome/renderer/render_view.cc16
-rw-r--r--chrome/renderer/render_view.h9
-rw-r--r--webkit/glue/chrome_client_impl.cc13
-rw-r--r--webkit/glue/webframe.h4
-rw-r--r--webkit/glue/webview_delegate.h11
21 files changed, 94 insertions, 57 deletions
diff --git a/chrome/browser/extensions/extension_view.cc b/chrome/browser/extensions/extension_view.cc
index 1647ecb..883ac3a 100755
--- a/chrome/browser/extensions/extension_view.cc
+++ b/chrome/browser/extensions/extension_view.cc
@@ -22,6 +22,7 @@ WebPreferences ExtensionView::GetWebkitPrefs() {
void ExtensionView::RunJavaScriptMessage(
const std::wstring& message,
const std::wstring& default_prompt,
+ const GURL& frame_url,
const int flags,
IPC::Message* reply_msg,
bool* did_suppress_message) {
diff --git a/chrome/browser/extensions/extension_view.h b/chrome/browser/extensions/extension_view.h
index 5eb869c..d95b745 100755
--- a/chrome/browser/extensions/extension_view.h
+++ b/chrome/browser/extensions/extension_view.h
@@ -35,6 +35,7 @@ class ExtensionView : public HWNDHtmlView,
virtual void RunJavaScriptMessage(
const std::wstring& message,
const std::wstring& default_prompt,
+ const GURL& frame_url,
const int flags,
IPC::Message* reply_msg,
bool* did_suppress_message);
diff --git a/chrome/browser/extensions/extension_view_unittest.cc b/chrome/browser/extensions/extension_view_unittest.cc
index 61cd8de..43341ce 100755
--- a/chrome/browser/extensions/extension_view_unittest.cc
+++ b/chrome/browser/extensions/extension_view_unittest.cc
@@ -43,6 +43,7 @@ class MockExtensionView : public ExtensionView {
virtual void RunJavaScriptMessage(
const std::wstring& message,
const std::wstring& default_prompt,
+ const GURL& frame_url,
const int flags,
IPC::Message* reply_msg,
bool* did_suppress_message) {
diff --git a/chrome/browser/js_before_unload_handler.h b/chrome/browser/js_before_unload_handler.h
index 3d85a3c..0babdf0 100644
--- a/chrome/browser/js_before_unload_handler.h
+++ b/chrome/browser/js_before_unload_handler.h
@@ -10,6 +10,7 @@
// |message_text| between the header and footer. The users response is
// returned to the renderer using |reply_msg|.
void RunBeforeUnloadDialog(WebContents* web_contents,
+ const GURL& frame_url,
const std::wstring& message_text,
IPC::Message* reply_msg);
diff --git a/chrome/browser/js_before_unload_handler_win.cc b/chrome/browser/js_before_unload_handler_win.cc
index ac31b70..88a3eec 100644
--- a/chrome/browser/js_before_unload_handler_win.cc
+++ b/chrome/browser/js_before_unload_handler_win.cc
@@ -9,15 +9,16 @@
#include "chrome/views/message_box_view.h"
#include "grit/generated_resources.h"
-void RunBeforeUnloadDialog(
- WebContents* web_contents,
- const std::wstring& message_text,
- IPC::Message* reply_msg) {
+void RunBeforeUnloadDialog(WebContents* web_contents,
+ const GURL& frame_url,
+ const std::wstring& message_text,
+ IPC::Message* reply_msg) {
std::wstring full_message =
- message_text + L"\n\n" +
- l10n_util::GetString(IDS_BEFOREUNLOAD_MESSAGEBOX_FOOTER);
+ message_text + L"\n\n" +
+ l10n_util::GetString(IDS_BEFOREUNLOAD_MESSAGEBOX_FOOTER);
JavascriptBeforeUnloadHandler* handler =
- new JavascriptBeforeUnloadHandler(web_contents, full_message, reply_msg);
+ new JavascriptBeforeUnloadHandler(web_contents, frame_url, full_message,
+ reply_msg);
AppModalDialogQueue::AddDialog(handler);
}
@@ -25,12 +26,14 @@ void RunBeforeUnloadDialog(
JavascriptBeforeUnloadHandler::JavascriptBeforeUnloadHandler(
WebContents* web_contents,
+ const GURL& frame_url,
const std::wstring& message_text,
IPC::Message* reply_msg)
: JavascriptMessageBoxHandler(web_contents,
+ frame_url,
MessageBoxView::kIsJavascriptConfirm,
message_text,
- L"",
+ std::wstring(),
false,
reply_msg) {
}
diff --git a/chrome/browser/js_before_unload_handler_win.h b/chrome/browser/js_before_unload_handler_win.h
index 4cd6067..7b3d9d8 100644
--- a/chrome/browser/js_before_unload_handler_win.h
+++ b/chrome/browser/js_before_unload_handler_win.h
@@ -13,6 +13,7 @@ class JavascriptBeforeUnloadHandler : public JavascriptMessageBoxHandler {
public:
// Cross-platform code should use RunBeforeUnloadDialog.
JavascriptBeforeUnloadHandler(WebContents* web_contents,
+ const GURL& frame_url,
const std::wstring& message_text,
IPC::Message* reply_msg);
virtual ~JavascriptBeforeUnloadHandler() {}
diff --git a/chrome/browser/jsmessage_box_handler.h b/chrome/browser/jsmessage_box_handler.h
index 0e33681..149bfd7 100644
--- a/chrome/browser/jsmessage_box_handler.h
+++ b/chrome/browser/jsmessage_box_handler.h
@@ -9,6 +9,7 @@
#include "chrome/common/ipc_message.h"
+class GURL;
class WebContents;
// Creates and runs a Javascript Message Box dialog.
@@ -18,6 +19,7 @@ class WebContents;
// |default_prompt_text|. The result of the operation is returned using
// |reply_msg|.
void RunJavascriptMessageBox(WebContents* web_contents,
+ const GURL& frame_url,
int dialog_flags,
const std::wstring& message_text,
const std::wstring& default_prompt_text,
diff --git a/chrome/browser/jsmessage_box_handler_win.cc b/chrome/browser/jsmessage_box_handler_win.cc
index 5026e8e..35eb683 100644
--- a/chrome/browser/jsmessage_box_handler_win.cc
+++ b/chrome/browser/jsmessage_box_handler_win.cc
@@ -20,13 +20,14 @@
#include "grit/generated_resources.h"
void RunJavascriptMessageBox(WebContents* web_contents,
+ const GURL& frame_url,
int dialog_flags,
const std::wstring& message_text,
const std::wstring& default_prompt_text,
bool display_suppress_checkbox,
IPC::Message* reply_msg) {
JavascriptMessageBoxHandler* handler =
- new JavascriptMessageBoxHandler(web_contents, dialog_flags,
+ new JavascriptMessageBoxHandler(web_contents, frame_url, dialog_flags,
message_text, default_prompt_text,
display_suppress_checkbox, reply_msg);
AppModalDialogQueue::AddDialog(handler);
@@ -34,18 +35,20 @@ void RunJavascriptMessageBox(WebContents* web_contents,
JavascriptMessageBoxHandler::JavascriptMessageBoxHandler(
WebContents* web_contents,
+ const GURL& frame_url,
int dialog_flags,
const std::wstring& message_text,
const std::wstring& default_prompt_text,
bool display_suppress_checkbox,
IPC::Message* reply_msg)
- : web_contents_(web_contents),
- reply_msg_(reply_msg),
- dialog_flags_(dialog_flags),
- dialog_(NULL),
- message_box_view_(new MessageBoxView(
- dialog_flags | MessageBoxView::kAutoDetectAlignment,
- message_text, default_prompt_text)) {
+ : web_contents_(web_contents),
+ frame_url_(frame_url),
+ reply_msg_(reply_msg),
+ dialog_flags_(dialog_flags),
+ dialog_(NULL),
+ message_box_view_(new MessageBoxView(
+ dialog_flags | MessageBoxView::kAutoDetectAlignment,
+ message_text, default_prompt_text)) {
DCHECK(message_box_view_);
DCHECK(reply_msg_);
@@ -80,11 +83,7 @@ int JavascriptMessageBoxHandler::GetDialogButtons() const {
}
std::wstring JavascriptMessageBoxHandler::GetWindowTitle() const {
- if (!web_contents_)
- return std::wstring();
-
- GURL url = web_contents_->GetURL();
- if (!url.has_host())
+ if (!frame_url_.has_host())
return l10n_util::GetString(IDS_JAVASCRIPT_MESSAGEBOX_DEFAULT_TITLE);
// We really only want the scheme, hostname, and port.
@@ -94,7 +93,7 @@ std::wstring JavascriptMessageBoxHandler::GetWindowTitle() const {
replacements.ClearPath();
replacements.ClearQuery();
replacements.ClearRef();
- GURL clean_url = url.ReplaceComponents(replacements);
+ GURL clean_url = frame_url_.ReplaceComponents(replacements);
// TODO(brettw) it should be easier than this to do the correct language
// handling without getting the accept language from the profile.
diff --git a/chrome/browser/jsmessage_box_handler_win.h b/chrome/browser/jsmessage_box_handler_win.h
index bac80dd..e8049d9 100644
--- a/chrome/browser/jsmessage_box_handler_win.h
+++ b/chrome/browser/jsmessage_box_handler_win.h
@@ -10,6 +10,7 @@
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
#include "chrome/views/app_modal_dialog_delegate.h"
+#include "googleurl/src/gurl.h"
class MessageBoxView;
class WebContents;
@@ -23,6 +24,7 @@ class JavascriptMessageBoxHandler
public:
// Cross-platform code should use RunJavaScriptMessageBox.
JavascriptMessageBoxHandler(WebContents* web_contents,
+ const GURL& frame_url,
int dialog_flags,
const std::wstring& message_text,
const std::wstring& default_prompt_text,
@@ -64,6 +66,10 @@ class JavascriptMessageBoxHandler
// The associated WebContents. Used to send IPC messages to the renderer.
WebContents* web_contents_;
+ // The URL of the frame originating the dialog. It is important we display
+ // this so the user doesn't blame the enclosing site if a subframe alert()s.
+ GURL frame_url_;
+
// Stores flags defined in message_box_view.h which describe the dialog box.
int dialog_flags_;
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index 9f174fa..629a908 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -1088,21 +1088,24 @@ void RenderViewHost::OnMsgRunFileChooser(bool multiple_files,
void RenderViewHost::OnMsgRunJavaScriptMessage(
const std::wstring& message,
const std::wstring& default_prompt,
+ const GURL& frame_url,
const int flags,
IPC::Message* reply_msg) {
StopHangMonitorTimeout();
if (modal_dialog_count_++ == 0)
modal_dialog_event_->Signal();
- delegate_->RunJavaScriptMessage(message, default_prompt, flags, reply_msg,
+ delegate_->RunJavaScriptMessage(message, default_prompt, frame_url, flags,
+ reply_msg,
&are_javascript_messages_suppressed_);
}
-void RenderViewHost::OnMsgRunBeforeUnloadConfirm(const std::wstring& message,
+void RenderViewHost::OnMsgRunBeforeUnloadConfirm(const GURL& frame_url,
+ const std::wstring& message,
IPC::Message* reply_msg) {
StopHangMonitorTimeout();
if (modal_dialog_count_++ == 0)
modal_dialog_event_->Signal();
- delegate_->RunBeforeUnloadConfirm(message, reply_msg);
+ delegate_->RunBeforeUnloadConfirm(frame_url, message, reply_msg);
}
void RenderViewHost::OnMsgShowModalHTMLDialog(
diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h
index 7120a22..29ed8e4 100644
--- a/chrome/browser/renderer_host/render_view_host.h
+++ b/chrome/browser/renderer_host/render_view_host.h
@@ -498,9 +498,11 @@ class RenderViewHost : public RenderWidgetHost {
const std::wstring& filter);
void OnMsgRunJavaScriptMessage(const std::wstring& message,
const std::wstring& default_prompt,
+ const GURL& frame_url,
const int flags,
IPC::Message* reply_msg);
- void OnMsgRunBeforeUnloadConfirm(const std::wstring& message,
+ void OnMsgRunBeforeUnloadConfirm(const GURL& frame_url,
+ const std::wstring& message,
IPC::Message* reply_msg);
void OnMsgShowModalHTMLDialog(const GURL& url, int width, int height,
const std::string& json_arguments,
diff --git a/chrome/browser/renderer_host/render_view_host_delegate.h b/chrome/browser/renderer_host/render_view_host_delegate.h
index cf78cf4..30870af 100644
--- a/chrome/browser/renderer_host/render_view_host_delegate.h
+++ b/chrome/browser/renderer_host/render_view_host_delegate.h
@@ -278,11 +278,13 @@ class RenderViewHostDelegate {
// A javascript message, confirmation or prompt should be shown.
virtual void RunJavaScriptMessage(const std::wstring& message,
const std::wstring& default_prompt,
+ const GURL& frame_url,
const int flags,
IPC::Message* reply_msg,
bool* did_suppress_message) { }
- virtual void RunBeforeUnloadConfirm(const std::wstring& message,
+ virtual void RunBeforeUnloadConfirm(const GURL& frame_url,
+ const std::wstring& message,
IPC::Message* reply_msg) { }
// Display this RenderViewHost in a modal fashion.
diff --git a/chrome/browser/tab_contents/web_contents.cc b/chrome/browser/tab_contents/web_contents.cc
index 6ca0726..55c3180 100644
--- a/chrome/browser/tab_contents/web_contents.cc
+++ b/chrome/browser/tab_contents/web_contents.cc
@@ -1047,6 +1047,7 @@ void WebContents::RunFileChooser(bool multiple_files,
void WebContents::RunJavaScriptMessage(
const std::wstring& message,
const std::wstring& default_prompt,
+ const GURL& frame_url,
const int flags,
IPC::Message* reply_msg,
bool* did_suppress_message) {
@@ -1070,18 +1071,19 @@ void WebContents::RunJavaScriptMessage(
TimeDelta::FromMilliseconds(kJavascriptMessageExpectedDelay))
show_suppress_checkbox = true;
- RunJavascriptMessageBox(this, flags, message, default_prompt,
+ RunJavascriptMessageBox(this, frame_url, flags, message, default_prompt,
show_suppress_checkbox, reply_msg);
} else {
// If we are suppressing messages, just reply as is if the user immediately
// pressed "Cancel".
- OnJavaScriptMessageBoxClosed(reply_msg, false, L"");
+ OnJavaScriptMessageBoxClosed(reply_msg, false, std::wstring());
}
}
-void WebContents::RunBeforeUnloadConfirm(const std::wstring& message,
+void WebContents::RunBeforeUnloadConfirm(const GURL& frame_url,
+ const std::wstring& message,
IPC::Message* reply_msg) {
- RunBeforeUnloadDialog(this, message, reply_msg);
+ RunBeforeUnloadDialog(this, frame_url, message, reply_msg);
}
void WebContents::ShowModalHTMLDialog(const GURL& url, int width, int height,
diff --git a/chrome/browser/tab_contents/web_contents.h b/chrome/browser/tab_contents/web_contents.h
index 110e923..e1d21de 100644
--- a/chrome/browser/tab_contents/web_contents.h
+++ b/chrome/browser/tab_contents/web_contents.h
@@ -344,10 +344,12 @@ class WebContents : public TabContents,
const std::wstring& filter);
virtual void RunJavaScriptMessage(const std::wstring& message,
const std::wstring& default_prompt,
+ const GURL& frame_url,
const int flags,
IPC::Message* reply_msg,
bool* did_suppress_message);
- virtual void RunBeforeUnloadConfirm(const std::wstring& message,
+ virtual void RunBeforeUnloadConfirm(const GURL& frame_url,
+ const std::wstring& message,
IPC::Message* reply_msg);
virtual void ShowModalHTMLDialog(const GURL& url, int width, int height,
const std::string& json_arguments,
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index 963afae..db71aa2 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -755,9 +755,10 @@ IPC_BEGIN_MESSAGES(ViewHost)
IPC_MESSAGE_ROUTED1(ViewHostMsg_GoToEntryAtOffset,
int /* offset (from current) of history item to get */)
- IPC_SYNC_MESSAGE_ROUTED3_2(ViewHostMsg_RunJavaScriptMessage,
+ IPC_SYNC_MESSAGE_ROUTED4_2(ViewHostMsg_RunJavaScriptMessage,
std::wstring /* in - alert message */,
std::wstring /* in - default prompt */,
+ GURL /* in - originating page URL */,
int /* in - dialog flags */,
bool /* out - success */,
std::wstring /* out - prompt field */)
@@ -1032,7 +1033,8 @@ IPC_BEGIN_MESSAGES(ViewHost)
// Displays a box to confirm that the user wants to navigate away from the
// page. Replies true if yes, false otherwise, the reply string is ignored,
// but is included so that we can use OnJavaScriptMessageBoxClosed.
- IPC_SYNC_MESSAGE_ROUTED1_2(ViewHostMsg_RunBeforeUnloadConfirm,
+ IPC_SYNC_MESSAGE_ROUTED2_2(ViewHostMsg_RunBeforeUnloadConfirm,
+ GURL, /* in - originating frame URL */
std::wstring /* in - alert message */,
bool /* out - success */,
std::wstring /* out - This is ignored.*/)
diff --git a/chrome/common/temp_scaffolding_stubs.cc b/chrome/common/temp_scaffolding_stubs.cc
index a1727c8..d9b2477 100644
--- a/chrome/common/temp_scaffolding_stubs.cc
+++ b/chrome/common/temp_scaffolding_stubs.cc
@@ -427,6 +427,7 @@ bool IsPluginProcess() {
//--------------------------------------------------------------------------
void RunJavascriptMessageBox(WebContents* web_contents,
+ const GURL& url,
int dialog_flags,
const std::wstring& message_text,
const std::wstring& default_prompt_text,
@@ -436,6 +437,7 @@ void RunJavascriptMessageBox(WebContents* web_contents,
}
void RunBeforeUnloadDialog(WebContents* web_contents,
+ const GURL& url,
const std::wstring& message_text,
IPC::Message* reply_msg) {
NOTIMPLEMENTED();
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index debff4dc..ac29d7e 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -1660,42 +1660,46 @@ class MessageBoxView {
};
#endif
-void RenderView::RunJavaScriptAlert(WebView* webview,
+void RenderView::RunJavaScriptAlert(WebFrame* webframe,
const std::wstring& message) {
RunJavaScriptMessage(MessageBoxView::kIsJavascriptAlert,
message,
std::wstring(),
+ webframe->GetURL(),
NULL);
}
-bool RenderView::RunJavaScriptConfirm(WebView* webview,
+bool RenderView::RunJavaScriptConfirm(WebFrame* webframe,
const std::wstring& message) {
return RunJavaScriptMessage(MessageBoxView::kIsJavascriptConfirm,
message,
std::wstring(),
+ webframe->GetURL(),
NULL);
}
-bool RenderView::RunJavaScriptPrompt(WebView* webview,
+bool RenderView::RunJavaScriptPrompt(WebFrame* webframe,
const std::wstring& message,
const std::wstring& default_value,
std::wstring* result) {
return RunJavaScriptMessage(MessageBoxView::kIsJavascriptPrompt,
message,
default_value,
+ webframe->GetURL(),
result);
}
bool RenderView::RunJavaScriptMessage(int type,
const std::wstring& message,
const std::wstring& default_value,
+ const GURL& frame_url,
std::wstring* result) {
bool success = false;
std::wstring result_temp;
if (!result)
result = &result_temp;
IPC::SyncMessage* msg = new ViewHostMsg_RunJavaScriptMessage(
- routing_id_, message, default_value, type, &success, result);
+ routing_id_, message, default_value, frame_url, type, &success, result);
msg->set_pump_messages_event(modal_dialog_event_.get());
Send(msg);
@@ -1709,14 +1713,14 @@ void RenderView::AddGURLSearchProvider(const GURL& osd_url, bool autodetected) {
autodetected));
}
-bool RenderView::RunBeforeUnloadConfirm(WebView* webview,
+bool RenderView::RunBeforeUnloadConfirm(WebFrame* webframe,
const std::wstring& message) {
bool success = false;
// This is an ignored return value, but is included so we can accept the same
// response as RunJavaScriptMessage.
std::wstring ignored_result;
IPC::SyncMessage* msg = new ViewHostMsg_RunBeforeUnloadConfirm(
- routing_id_, message, &success, &ignored_result);
+ routing_id_, webframe->GetURL(), message, &success, &ignored_result);
msg->set_pump_messages_event(modal_dialog_event_.get());
Send(msg);
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h
index 1c0078c..700faa9 100644
--- a/chrome/renderer/render_view.h
+++ b/chrome/renderer/render_view.h
@@ -142,15 +142,15 @@ class RenderView : public RenderWidget,
virtual void ShowModalHTMLDialog(const GURL& url, int width, int height,
const std::string& json_arguments,
std::string* json_retval);
- virtual void RunJavaScriptAlert(WebView* webview,
+ virtual void RunJavaScriptAlert(WebFrame* webframe,
const std::wstring& message);
- virtual bool RunJavaScriptConfirm(WebView* webview,
+ virtual bool RunJavaScriptConfirm(WebFrame* webframe,
const std::wstring& message);
- virtual bool RunJavaScriptPrompt(WebView* webview,
+ virtual bool RunJavaScriptPrompt(WebFrame* webframe,
const std::wstring& message,
const std::wstring& default_value,
std::wstring* result);
- virtual bool RunBeforeUnloadConfirm(WebView* webview,
+ virtual bool RunBeforeUnloadConfirm(WebFrame* webframe,
const std::wstring& message);
virtual void EnableSuddenTermination();
virtual void DisableSuddenTermination();
@@ -430,6 +430,7 @@ class RenderView : public RenderWidget,
bool RunJavaScriptMessage(int type,
const std::wstring& message,
const std::wstring& default_value,
+ const GURL& frame_url,
std::wstring* result);
// Adds search provider from the given OpenSearch description URL as a
diff --git a/webkit/glue/chrome_client_impl.cc b/webkit/glue/chrome_client_impl.cc
index c9965dd..91af605 100644
--- a/webkit/glue/chrome_client_impl.cc
+++ b/webkit/glue/chrome_client_impl.cc
@@ -289,12 +289,13 @@ bool ChromeClientImpl::canRunBeforeUnloadConfirmPanel() {
return webview_->delegate() != NULL;
}
-bool ChromeClientImpl::runBeforeUnloadConfirmPanel(const WebCore::String& message,
- WebCore::Frame* frame) {
+bool ChromeClientImpl::runBeforeUnloadConfirmPanel(
+ const WebCore::String& message,
+ WebCore::Frame* frame) {
WebViewDelegate* d = webview_->delegate();
if (d) {
std::wstring wstr = webkit_glue::StringToStdWString(message);
- return d->RunBeforeUnloadConfirm(webview_, wstr);
+ return d->RunBeforeUnloadConfirm(WebFrameImpl::FromFrame(frame), wstr);
}
return false;
}
@@ -325,7 +326,7 @@ void ChromeClientImpl::runJavaScriptAlert(WebCore::Frame* frame,
#endif
std::wstring wstr = webkit_glue::StringToStdWString(message);
- d->RunJavaScriptAlert(webview_, wstr);
+ d->RunJavaScriptAlert(WebFrameImpl::FromFrame(frame), wstr);
}
}
@@ -335,7 +336,7 @@ bool ChromeClientImpl::runJavaScriptConfirm(WebCore::Frame* frame,
WebViewDelegate* d = webview_->delegate();
if (d) {
std::wstring wstr = webkit_glue::StringToStdWString(message);
- return d->RunJavaScriptConfirm(webview_, wstr);
+ return d->RunJavaScriptConfirm(WebFrameImpl::FromFrame(frame), wstr);
}
return false;
}
@@ -350,7 +351,7 @@ bool ChromeClientImpl::runJavaScriptPrompt(WebCore::Frame* frame,
std::wstring wstr_message = webkit_glue::StringToStdWString(message);
std::wstring wstr_default = webkit_glue::StringToStdWString(defaultValue);
std::wstring wstr_result;
- bool ok = d->RunJavaScriptPrompt(webview_,
+ bool ok = d->RunJavaScriptPrompt(WebFrameImpl::FromFrame(frame),
wstr_message,
wstr_default,
&wstr_result);
diff --git a/webkit/glue/webframe.h b/webkit/glue/webframe.h
index 37eea8a..4a0cf01 100644
--- a/webkit/glue/webframe.h
+++ b/webkit/glue/webframe.h
@@ -114,11 +114,11 @@ class WebFrame {
// lacks a history item. Otherwise, this will always be true.
virtual bool HasCurrentHistoryState() const = 0;
- // Returns the current URL of the frame, or the empty string if there is no
+ // Returns the current URL of the frame, or an empty GURL if there is no
// URL to retrieve (for example, the frame may never have had any content).
virtual GURL GetURL() const = 0;
- // Returns the URL to the favorite icon for the frame. An empty string is
+ // Returns the URL to the favorite icon for the frame. An empty GURL is
// returned if the frame has not finished loading, or the frame's URL
// protocol is not http or https.
virtual GURL GetFavIconURL() const = 0;
diff --git a/webkit/glue/webview_delegate.h b/webkit/glue/webview_delegate.h
index 59d4d95..a1a90d2 100644
--- a/webkit/glue/webview_delegate.h
+++ b/webkit/glue/webview_delegate.h
@@ -498,9 +498,10 @@ class WebViewDelegate : virtual public WebWidgetDelegate {
}
// Displays a JavaScript alert panel associated with the given view. Clients
- // should visually indicate that this panel comes from JavaScript. The panel
+ // should visually indicate that this panel comes from JavaScript and some
+ // information about the originating frame (at least the domain). The panel
// should have a single OK button.
- virtual void RunJavaScriptAlert(WebView* webview,
+ virtual void RunJavaScriptAlert(WebFrame* webframe,
const std::wstring& message) {
}
@@ -508,7 +509,7 @@ class WebViewDelegate : virtual public WebWidgetDelegate {
// Clients should visually indicate that this panel comes
// from JavaScript. The panel should have two buttons, e.g. "OK" and
// "Cancel". Returns true if the user hit OK, or false if the user hit Cancel.
- virtual bool RunJavaScriptConfirm(WebView* webview,
+ virtual bool RunJavaScriptConfirm(WebFrame* webframe,
const std::wstring& message) {
return false;
}
@@ -520,7 +521,7 @@ class WebViewDelegate : virtual public WebWidgetDelegate {
// panel when it is shown. If the user hit OK, returns true and fills result
// with the text in the box. The value of result is undefined if the user
// hit Cancel.
- virtual bool RunJavaScriptPrompt(WebView* webview,
+ virtual bool RunJavaScriptPrompt(WebFrame* webframe,
const std::wstring& message,
const std::wstring& default_value,
std::wstring* result) {
@@ -536,7 +537,7 @@ class WebViewDelegate : virtual public WebWidgetDelegate {
// that the navigation should continue, and Cancel means that the navigation
// should be cancelled, leaving the user on the current page. Returns true
// if the user hit OK, or false if the user hit Cancel.
- virtual bool RunBeforeUnloadConfirm(WebView* webview,
+ virtual bool RunBeforeUnloadConfirm(WebFrame* webframe,
const std::wstring& message) {
return true; // OK, continue to navigate away
}