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

Side by Side Diff: chrome/browser/js_before_unload_handler_win.cc

Issue 56026: Move message flags into a separate header that can be used (Closed)
Patch Set: ctor Created 11 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 unified diff | Download patch
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/controls/message_box_view.h" 9 #include "chrome/common/message_box_flags.h"
10 #include "grit/generated_resources.h" 10 #include "grit/generated_resources.h"
11 11
12 void RunBeforeUnloadDialog(WebContents* web_contents, 12 void RunBeforeUnloadDialog(WebContents* web_contents,
13 const GURL& frame_url, 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, frame_url, full_message, 20 new JavascriptBeforeUnloadHandler(web_contents, frame_url, full_message,
21 reply_msg); 21 reply_msg);
22 AppModalDialogQueue::AddDialog(handler); 22 AppModalDialogQueue::AddDialog(handler);
23 } 23 }
24 24
25 // JavascriptBeforeUnloadHandler ----------------------------------------------- 25 // JavascriptBeforeUnloadHandler -----------------------------------------------
26 26
27 JavascriptBeforeUnloadHandler::JavascriptBeforeUnloadHandler( 27 JavascriptBeforeUnloadHandler::JavascriptBeforeUnloadHandler(
28 WebContents* web_contents, 28 WebContents* web_contents,
29 const GURL& frame_url, 29 const GURL& frame_url,
30 const std::wstring& message_text, 30 const std::wstring& message_text,
31 IPC::Message* reply_msg) 31 IPC::Message* reply_msg)
32 : JavascriptMessageBoxHandler(web_contents, 32 : JavascriptMessageBoxHandler(web_contents,
33 frame_url, 33 frame_url,
34 MessageBoxView::kIsJavascriptConfirm, 34 MessageBox::kIsJavascriptConfirm,
35 message_text, 35 message_text,
36 std::wstring(), 36 std::wstring(),
37 false, 37 false,
38 reply_msg) { 38 reply_msg) {
39 } 39 }
40 40
41 std::wstring JavascriptBeforeUnloadHandler::GetWindowTitle() const { 41 std::wstring JavascriptBeforeUnloadHandler::GetWindowTitle() const {
42 return l10n_util::GetString(IDS_BEFOREUNLOAD_MESSAGEBOX_TITLE); 42 return l10n_util::GetString(IDS_BEFOREUNLOAD_MESSAGEBOX_TITLE);
43 } 43 }
44 44
45 std::wstring JavascriptBeforeUnloadHandler::GetDialogButtonLabel( 45 std::wstring JavascriptBeforeUnloadHandler::GetDialogButtonLabel(
46 DialogButton button) const { 46 DialogButton button) const {
47 if (button == DialogDelegate::DIALOGBUTTON_OK) { 47 if (button == DialogDelegate::DIALOGBUTTON_OK) {
48 return l10n_util::GetString(IDS_BEFOREUNLOAD_MESSAGEBOX_OK_BUTTON_LABEL); 48 return l10n_util::GetString(IDS_BEFOREUNLOAD_MESSAGEBOX_OK_BUTTON_LABEL);
49 } else if (button == DialogDelegate::DIALOGBUTTON_CANCEL) { 49 } else if (button == DialogDelegate::DIALOGBUTTON_CANCEL) {
50 return l10n_util::GetString( 50 return l10n_util::GetString(
51 IDS_BEFOREUNLOAD_MESSAGEBOX_CANCEL_BUTTON_LABEL); 51 IDS_BEFOREUNLOAD_MESSAGEBOX_CANCEL_BUTTON_LABEL);
52 } 52 }
53 return L""; 53 return L"";
54 } 54 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_request_dialog_delegate_win.cc ('k') | chrome/browser/jsmessage_box_handler_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698