diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-05 18:29:56 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-05 18:29:56 +0000 |
commit | e1f34499ce79eca58e76e9ea1bdeef2402eb4607 (patch) | |
tree | 50c640a884a0a8e14e2dfcd9d99e71f66df9100c /chrome | |
parent | a023701ae0919ac47093e660bb400c6b87408460 (diff) | |
download | chromium_src-e1f34499ce79eca58e76e9ea1bdeef2402eb4607.zip chromium_src-e1f34499ce79eca58e76e9ea1bdeef2402eb4607.tar.gz chromium_src-e1f34499ce79eca58e76e9ea1bdeef2402eb4607.tar.bz2 |
Reverting 11002.
Review URL: http://codereview.chromium.org/39203
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11008 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rwxr-xr-x | chrome/browser/extensions/extension_view.cc | 1 | ||||
-rwxr-xr-x | chrome/browser/extensions/extension_view.h | 1 | ||||
-rwxr-xr-x | chrome/browser/extensions/extension_view_unittest.cc | 1 | ||||
-rw-r--r-- | chrome/browser/js_before_unload_handler.h | 1 | ||||
-rw-r--r-- | chrome/browser/js_before_unload_handler_win.cc | 19 | ||||
-rw-r--r-- | chrome/browser/js_before_unload_handler_win.h | 1 | ||||
-rw-r--r-- | chrome/browser/jsmessage_box_handler.h | 2 | ||||
-rw-r--r-- | chrome/browser/jsmessage_box_handler_win.cc | 27 | ||||
-rw-r--r-- | chrome/browser/jsmessage_box_handler_win.h | 6 | ||||
-rw-r--r-- | chrome/browser/renderer_host/render_view_host.cc | 9 | ||||
-rw-r--r-- | chrome/browser/renderer_host/render_view_host.h | 4 | ||||
-rw-r--r-- | chrome/browser/renderer_host/render_view_host_delegate.h | 4 | ||||
-rw-r--r-- | chrome/browser/tab_contents/web_contents.cc | 10 | ||||
-rw-r--r-- | chrome/browser/tab_contents/web_contents.h | 4 | ||||
-rw-r--r-- | chrome/common/render_messages_internal.h | 6 | ||||
-rw-r--r-- | chrome/common/temp_scaffolding_stubs.cc | 2 | ||||
-rw-r--r-- | chrome/renderer/render_view.cc | 16 | ||||
-rw-r--r-- | chrome/renderer/render_view.h | 9 |
18 files changed, 44 insertions, 79 deletions
diff --git a/chrome/browser/extensions/extension_view.cc b/chrome/browser/extensions/extension_view.cc index 883ac3a..1647ecb 100755 --- a/chrome/browser/extensions/extension_view.cc +++ b/chrome/browser/extensions/extension_view.cc @@ -22,7 +22,6 @@ 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 d95b745..5eb869c 100755 --- a/chrome/browser/extensions/extension_view.h +++ b/chrome/browser/extensions/extension_view.h @@ -35,7 +35,6 @@ 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 43341ce..61cd8de 100755 --- a/chrome/browser/extensions/extension_view_unittest.cc +++ b/chrome/browser/extensions/extension_view_unittest.cc @@ -43,7 +43,6 @@ 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 0babdf0..3d85a3c 100644 --- a/chrome/browser/js_before_unload_handler.h +++ b/chrome/browser/js_before_unload_handler.h @@ -10,7 +10,6 @@ // |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 88a3eec..ac31b70 100644 --- a/chrome/browser/js_before_unload_handler_win.cc +++ b/chrome/browser/js_before_unload_handler_win.cc @@ -9,16 +9,15 @@ #include "chrome/views/message_box_view.h" #include "grit/generated_resources.h" -void RunBeforeUnloadDialog(WebContents* web_contents, - const GURL& frame_url, - const std::wstring& message_text, - IPC::Message* reply_msg) { +void RunBeforeUnloadDialog( + WebContents* web_contents, + 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, frame_url, full_message, - reply_msg); + new JavascriptBeforeUnloadHandler(web_contents, full_message, reply_msg); AppModalDialogQueue::AddDialog(handler); } @@ -26,14 +25,12 @@ void RunBeforeUnloadDialog(WebContents* web_contents, 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, - std::wstring(), + L"", false, reply_msg) { } diff --git a/chrome/browser/js_before_unload_handler_win.h b/chrome/browser/js_before_unload_handler_win.h index 7b3d9d8..4cd6067 100644 --- a/chrome/browser/js_before_unload_handler_win.h +++ b/chrome/browser/js_before_unload_handler_win.h @@ -13,7 +13,6 @@ 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 149bfd7..0e33681 100644 --- a/chrome/browser/jsmessage_box_handler.h +++ b/chrome/browser/jsmessage_box_handler.h @@ -9,7 +9,6 @@ #include "chrome/common/ipc_message.h" -class GURL; class WebContents; // Creates and runs a Javascript Message Box dialog. @@ -19,7 +18,6 @@ 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 35eb683..5026e8e 100644 --- a/chrome/browser/jsmessage_box_handler_win.cc +++ b/chrome/browser/jsmessage_box_handler_win.cc @@ -20,14 +20,13 @@ #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, frame_url, dialog_flags, + new JavascriptMessageBoxHandler(web_contents, dialog_flags, message_text, default_prompt_text, display_suppress_checkbox, reply_msg); AppModalDialogQueue::AddDialog(handler); @@ -35,20 +34,18 @@ 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), - 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)) { + : 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)) { DCHECK(message_box_view_); DCHECK(reply_msg_); @@ -83,7 +80,11 @@ int JavascriptMessageBoxHandler::GetDialogButtons() const { } std::wstring JavascriptMessageBoxHandler::GetWindowTitle() const { - if (!frame_url_.has_host()) + if (!web_contents_) + return std::wstring(); + + GURL url = web_contents_->GetURL(); + if (!url.has_host()) return l10n_util::GetString(IDS_JAVASCRIPT_MESSAGEBOX_DEFAULT_TITLE); // We really only want the scheme, hostname, and port. @@ -93,7 +94,7 @@ std::wstring JavascriptMessageBoxHandler::GetWindowTitle() const { replacements.ClearPath(); replacements.ClearQuery(); replacements.ClearRef(); - GURL clean_url = frame_url_.ReplaceComponents(replacements); + GURL clean_url = 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 e8049d9..bac80dd 100644 --- a/chrome/browser/jsmessage_box_handler_win.h +++ b/chrome/browser/jsmessage_box_handler_win.h @@ -10,7 +10,6 @@ #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; @@ -24,7 +23,6 @@ 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, @@ -66,10 +64,6 @@ 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 629a908..9f174fa 100644 --- a/chrome/browser/renderer_host/render_view_host.cc +++ b/chrome/browser/renderer_host/render_view_host.cc @@ -1088,24 +1088,21 @@ 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, frame_url, flags, - reply_msg, + delegate_->RunJavaScriptMessage(message, default_prompt, flags, reply_msg, &are_javascript_messages_suppressed_); } -void RenderViewHost::OnMsgRunBeforeUnloadConfirm(const GURL& frame_url, - const std::wstring& message, +void RenderViewHost::OnMsgRunBeforeUnloadConfirm(const std::wstring& message, IPC::Message* reply_msg) { StopHangMonitorTimeout(); if (modal_dialog_count_++ == 0) modal_dialog_event_->Signal(); - delegate_->RunBeforeUnloadConfirm(frame_url, message, reply_msg); + delegate_->RunBeforeUnloadConfirm(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 29ed8e4..7120a22 100644 --- a/chrome/browser/renderer_host/render_view_host.h +++ b/chrome/browser/renderer_host/render_view_host.h @@ -498,11 +498,9 @@ 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 GURL& frame_url, - const std::wstring& message, + void OnMsgRunBeforeUnloadConfirm(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 30870af..cf78cf4 100644 --- a/chrome/browser/renderer_host/render_view_host_delegate.h +++ b/chrome/browser/renderer_host/render_view_host_delegate.h @@ -278,13 +278,11 @@ 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 GURL& frame_url, - const std::wstring& message, + virtual void RunBeforeUnloadConfirm(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 55c3180..6ca0726 100644 --- a/chrome/browser/tab_contents/web_contents.cc +++ b/chrome/browser/tab_contents/web_contents.cc @@ -1047,7 +1047,6 @@ 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) { @@ -1071,19 +1070,18 @@ void WebContents::RunJavaScriptMessage( TimeDelta::FromMilliseconds(kJavascriptMessageExpectedDelay)) show_suppress_checkbox = true; - RunJavascriptMessageBox(this, frame_url, flags, message, default_prompt, + RunJavascriptMessageBox(this, 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, std::wstring()); + OnJavaScriptMessageBoxClosed(reply_msg, false, L""); } } -void WebContents::RunBeforeUnloadConfirm(const GURL& frame_url, - const std::wstring& message, +void WebContents::RunBeforeUnloadConfirm(const std::wstring& message, IPC::Message* reply_msg) { - RunBeforeUnloadDialog(this, frame_url, message, reply_msg); + RunBeforeUnloadDialog(this, 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 e1d21de..110e923 100644 --- a/chrome/browser/tab_contents/web_contents.h +++ b/chrome/browser/tab_contents/web_contents.h @@ -344,12 +344,10 @@ 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 GURL& frame_url, - const std::wstring& message, + virtual void RunBeforeUnloadConfirm(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 db71aa2..963afae 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -755,10 +755,9 @@ IPC_BEGIN_MESSAGES(ViewHost) IPC_MESSAGE_ROUTED1(ViewHostMsg_GoToEntryAtOffset, int /* offset (from current) of history item to get */) - IPC_SYNC_MESSAGE_ROUTED4_2(ViewHostMsg_RunJavaScriptMessage, + IPC_SYNC_MESSAGE_ROUTED3_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 */) @@ -1033,8 +1032,7 @@ 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_ROUTED2_2(ViewHostMsg_RunBeforeUnloadConfirm, - GURL, /* in - originating frame URL */ + IPC_SYNC_MESSAGE_ROUTED1_2(ViewHostMsg_RunBeforeUnloadConfirm, 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 d9b2477..a1727c8 100644 --- a/chrome/common/temp_scaffolding_stubs.cc +++ b/chrome/common/temp_scaffolding_stubs.cc @@ -427,7 +427,6 @@ bool IsPluginProcess() { //-------------------------------------------------------------------------- void RunJavascriptMessageBox(WebContents* web_contents, - const GURL& url, int dialog_flags, const std::wstring& message_text, const std::wstring& default_prompt_text, @@ -437,7 +436,6 @@ 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 ac29d7e..debff4dc 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -1660,46 +1660,42 @@ class MessageBoxView { }; #endif -void RenderView::RunJavaScriptAlert(WebFrame* webframe, +void RenderView::RunJavaScriptAlert(WebView* webview, const std::wstring& message) { RunJavaScriptMessage(MessageBoxView::kIsJavascriptAlert, message, std::wstring(), - webframe->GetURL(), NULL); } -bool RenderView::RunJavaScriptConfirm(WebFrame* webframe, +bool RenderView::RunJavaScriptConfirm(WebView* webview, const std::wstring& message) { return RunJavaScriptMessage(MessageBoxView::kIsJavascriptConfirm, message, std::wstring(), - webframe->GetURL(), NULL); } -bool RenderView::RunJavaScriptPrompt(WebFrame* webframe, +bool RenderView::RunJavaScriptPrompt(WebView* webview, 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, frame_url, type, &success, result); + routing_id_, message, default_value, type, &success, result); msg->set_pump_messages_event(modal_dialog_event_.get()); Send(msg); @@ -1713,14 +1709,14 @@ void RenderView::AddGURLSearchProvider(const GURL& osd_url, bool autodetected) { autodetected)); } -bool RenderView::RunBeforeUnloadConfirm(WebFrame* webframe, +bool RenderView::RunBeforeUnloadConfirm(WebView* webview, 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_, webframe->GetURL(), message, &success, &ignored_result); + routing_id_, 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 700faa9..1c0078c 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(WebFrame* webframe, + virtual void RunJavaScriptAlert(WebView* webview, const std::wstring& message); - virtual bool RunJavaScriptConfirm(WebFrame* webframe, + virtual bool RunJavaScriptConfirm(WebView* webview, const std::wstring& message); - virtual bool RunJavaScriptPrompt(WebFrame* webframe, + virtual bool RunJavaScriptPrompt(WebView* webview, const std::wstring& message, const std::wstring& default_value, std::wstring* result); - virtual bool RunBeforeUnloadConfirm(WebFrame* webframe, + virtual bool RunBeforeUnloadConfirm(WebView* webview, const std::wstring& message); virtual void EnableSuddenTermination(); virtual void DisableSuddenTermination(); @@ -430,7 +430,6 @@ 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 |