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

Unified Diff: chrome/browser/jsmessage_box_handler_win.cc

Issue 39163: Make JavaScript alerts reflect the URL of the frame they came from, not the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 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 | « chrome/browser/jsmessage_box_handler_win.h ('k') | chrome/browser/renderer_host/render_view_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/jsmessage_box_handler_win.cc
===================================================================
--- chrome/browser/jsmessage_box_handler_win.cc (revision 10892)
+++ chrome/browser/jsmessage_box_handler_win.cc (working copy)
@@ -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 @@
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 @@
}
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 @@
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.
« no previous file with comments | « chrome/browser/jsmessage_box_handler_win.h ('k') | chrome/browser/renderer_host/render_view_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698