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

Side by Side Diff: chrome/browser/js_before_unload_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, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/js_before_unload_handler_win.h ('k') | chrome/browser/jsmessage_box_handler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/js_before_unload_handler_win.h" 5 #include "chrome/browser/js_before_unload_handler_win.h"
6 6
7 #include "chrome/browser/app_modal_dialog_queue.h" 7 #include "chrome/browser/app_modal_dialog_queue.h"
8 #include "chrome/common/l10n_util.h" 8 #include "chrome/common/l10n_util.h"
9 #include "chrome/views/message_box_view.h" 9 #include "chrome/views/message_box_view.h"
10 #include "grit/generated_resources.h" 10 #include "grit/generated_resources.h"
11 11
12 void RunBeforeUnloadDialog( 12 void RunBeforeUnloadDialog(WebContents* web_contents,
13 WebContents* web_contents, 13 const GURL& frame_url,
14 const std::wstring& message_text, 14 const std::wstring& message_text,
15 IPC::Message* reply_msg) { 15 IPC::Message* reply_msg) {
16 std::wstring full_message = 16 std::wstring full_message =
17 message_text + L"\n\n" + 17 message_text + L"\n\n" +
18 l10n_util::GetString(IDS_BEFOREUNLOAD_MESSAGEBOX_FOOTER); 18 l10n_util::GetString(IDS_BEFOREUNLOAD_MESSAGEBOX_FOOTER);
19 JavascriptBeforeUnloadHandler* handler = 19 JavascriptBeforeUnloadHandler* handler =
20 new JavascriptBeforeUnloadHandler(web_contents, full_message, reply_msg); 20 new JavascriptBeforeUnloadHandler(web_contents, frame_url, full_message,
21 reply_msg);
21 AppModalDialogQueue::AddDialog(handler); 22 AppModalDialogQueue::AddDialog(handler);
22 } 23 }
23 24
24 // JavascriptBeforeUnloadHandler ----------------------------------------------- 25 // JavascriptBeforeUnloadHandler -----------------------------------------------
25 26
26 JavascriptBeforeUnloadHandler::JavascriptBeforeUnloadHandler( 27 JavascriptBeforeUnloadHandler::JavascriptBeforeUnloadHandler(
27 WebContents* web_contents, 28 WebContents* web_contents,
29 const GURL& frame_url,
28 const std::wstring& message_text, 30 const std::wstring& message_text,
29 IPC::Message* reply_msg) 31 IPC::Message* reply_msg)
30 : JavascriptMessageBoxHandler(web_contents, 32 : JavascriptMessageBoxHandler(web_contents,
33 frame_url,
31 MessageBoxView::kIsJavascriptConfirm, 34 MessageBoxView::kIsJavascriptConfirm,
32 message_text, 35 message_text,
33 L"", 36 std::wstring(),
34 false, 37 false,
35 reply_msg) { 38 reply_msg) {
36 } 39 }
37 40
38 std::wstring JavascriptBeforeUnloadHandler::GetWindowTitle() const { 41 std::wstring JavascriptBeforeUnloadHandler::GetWindowTitle() const {
39 return l10n_util::GetString(IDS_BEFOREUNLOAD_MESSAGEBOX_TITLE); 42 return l10n_util::GetString(IDS_BEFOREUNLOAD_MESSAGEBOX_TITLE);
40 } 43 }
41 44
42 std::wstring JavascriptBeforeUnloadHandler::GetDialogButtonLabel( 45 std::wstring JavascriptBeforeUnloadHandler::GetDialogButtonLabel(
43 DialogButton button) const { 46 DialogButton button) const {
44 if (button == DialogDelegate::DIALOGBUTTON_OK) { 47 if (button == DialogDelegate::DIALOGBUTTON_OK) {
45 return l10n_util::GetString(IDS_BEFOREUNLOAD_MESSAGEBOX_OK_BUTTON_LABEL); 48 return l10n_util::GetString(IDS_BEFOREUNLOAD_MESSAGEBOX_OK_BUTTON_LABEL);
46 } else if (button == DialogDelegate::DIALOGBUTTON_CANCEL) { 49 } else if (button == DialogDelegate::DIALOGBUTTON_CANCEL) {
47 return l10n_util::GetString( 50 return l10n_util::GetString(
48 IDS_BEFOREUNLOAD_MESSAGEBOX_CANCEL_BUTTON_LABEL); 51 IDS_BEFOREUNLOAD_MESSAGEBOX_CANCEL_BUTTON_LABEL);
49 } 52 }
50 return L""; 53 return L"";
51 } 54 }
OLDNEW
« no previous file with comments | « chrome/browser/js_before_unload_handler_win.h ('k') | chrome/browser/jsmessage_box_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698