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

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

Issue 63033: Refactor AppModalDialogQueue and move JS Alert boxes into a MVC. (Closed)
Patch Set: whitespace 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
« 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/js_before_unload_handler_win.h"
6
7 #include "chrome/browser/app_modal_dialog_queue.h"
8 #include "chrome/common/l10n_util.h"
9 #include "chrome/common/message_box_flags.h"
10 #include "grit/generated_resources.h"
11
12 void RunBeforeUnloadDialog(WebContents* web_contents,
13 const GURL& frame_url,
14 const std::wstring& message_text,
15 IPC::Message* reply_msg) {
16 std::wstring full_message =
17 message_text + L"\n\n" +
18 l10n_util::GetString(IDS_BEFOREUNLOAD_MESSAGEBOX_FOOTER);
19 JavascriptBeforeUnloadHandler* handler =
20 new JavascriptBeforeUnloadHandler(web_contents, frame_url, full_message,
21 reply_msg);
22 AppModalDialogQueue::AddDialog(handler);
23 }
24
25 // JavascriptBeforeUnloadHandler -----------------------------------------------
26
27 JavascriptBeforeUnloadHandler::JavascriptBeforeUnloadHandler(
28 WebContents* web_contents,
29 const GURL& frame_url,
30 const std::wstring& message_text,
31 IPC::Message* reply_msg)
32 : JavascriptMessageBoxHandler(web_contents,
33 frame_url,
34 MessageBox::kIsJavascriptConfirm,
35 message_text,
36 std::wstring(),
37 false,
38 reply_msg) {
39 }
40
41 std::wstring JavascriptBeforeUnloadHandler::GetWindowTitle() const {
42 return l10n_util::GetString(IDS_BEFOREUNLOAD_MESSAGEBOX_TITLE);
43 }
44
45 std::wstring JavascriptBeforeUnloadHandler::GetDialogButtonLabel(
46 DialogButton button) const {
47 if (button == DialogDelegate::DIALOGBUTTON_OK) {
48 return l10n_util::GetString(IDS_BEFOREUNLOAD_MESSAGEBOX_OK_BUTTON_LABEL);
49 } else if (button == DialogDelegate::DIALOGBUTTON_CANCEL) {
50 return l10n_util::GetString(
51 IDS_BEFOREUNLOAD_MESSAGEBOX_CANCEL_BUTTON_LABEL);
52 }
53 return L"";
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