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

Side by Side Diff: chrome/browser/app_modal_dialog_mac.mm

Issue 181006: Make the default ok/cancel button come from the pak files.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 3 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 | « no previous file | no next file » | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/app_modal_dialog.h" 5 #include "chrome/browser/app_modal_dialog.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util_mac.h"
10 #include "app/message_box_flags.h" 10 #include "app/message_box_flags.h"
11 #include "base/sys_string_conversions.h" 11 #include "base/sys_string_conversions.h"
12 #include "grit/generated_resources.h" 12 #include "grit/generated_resources.h"
13 #include "grit/app_strings.h"
Mark Mentovai 2009/08/28 18:16:04 sortile
13 14
14 // Helper object that receives the notification that the dialog/sheet is 15 // Helper object that receives the notification that the dialog/sheet is
15 // going away. Is responsible for cleaning itself up. 16 // going away. Is responsible for cleaning itself up.
16 @interface AppModalDialogHelper : NSObject { 17 @interface AppModalDialogHelper : NSObject {
17 @private 18 @private
18 NSAlert* alert_; 19 NSAlert* alert_;
19 NSTextField* textField_; // WEAK; owned by alert_ 20 NSTextField* textField_; // WEAK; owned by alert_
20 } 21 }
21 22
22 - (NSAlert*)alert; 23 - (NSAlert*)alert;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 } 72 }
72 @end 73 @end
73 74
74 AppModalDialog::~AppModalDialog() { 75 AppModalDialog::~AppModalDialog() {
75 } 76 }
76 77
77 void AppModalDialog::CreateAndShowDialog() { 78 void AppModalDialog::CreateAndShowDialog() {
78 // Determine the names of the dialog buttons based on the flags. "Default" 79 // Determine the names of the dialog buttons based on the flags. "Default"
79 // is the OK button. "Other" is the cancel button. We don't use the 80 // is the OK button. "Other" is the cancel button. We don't use the
80 // "Alternate" button in NSRunAlertPanel. 81 // "Alternate" button in NSRunAlertPanel.
81 // TODO(pinkerton): Need to find the right localized strings for these. 82 NSString* default_button = l10n_util::GetNSStringWithFixup(IDS_APP_OK);
82 NSString* default_button = NSLocalizedString(@"OK", nil); 83 NSString* other_button = l10n_util::GetNSStringWithFixup(IDS_APP_CANCEL);
83 NSString* other_button = NSLocalizedString(@"Cancel", nil);
84 bool text_field = false; 84 bool text_field = false;
85 bool one_button = false; 85 bool one_button = false;
86 switch (dialog_flags_) { 86 switch (dialog_flags_) {
87 case MessageBoxFlags::kIsJavascriptAlert: 87 case MessageBoxFlags::kIsJavascriptAlert:
88 one_button = true; 88 one_button = true;
89 break; 89 break;
90 case MessageBoxFlags::kIsJavascriptConfirm: 90 case MessageBoxFlags::kIsJavascriptConfirm:
91 if (is_before_unload_dialog_) { 91 if (is_before_unload_dialog_) {
92 std::string button_text = l10n_util::GetStringUTF8( 92 default_button = l10n_util::GetNSStringWithFixup(
93 IDS_BEFOREUNLOAD_MESSAGEBOX_OK_BUTTON_LABEL); 93 IDS_BEFOREUNLOAD_MESSAGEBOX_OK_BUTTON_LABEL);
94 default_button = base::SysUTF8ToNSString(button_text); 94 other_button = l10n_util::GetNSStringWithFixup(
95 button_text = l10n_util::GetStringUTF8(
96 IDS_BEFOREUNLOAD_MESSAGEBOX_CANCEL_BUTTON_LABEL); 95 IDS_BEFOREUNLOAD_MESSAGEBOX_CANCEL_BUTTON_LABEL);
97 other_button = base::SysUTF8ToNSString(button_text);
98 } 96 }
99 break; 97 break;
100 case MessageBoxFlags::kIsJavascriptPrompt: 98 case MessageBoxFlags::kIsJavascriptPrompt:
101 text_field = true; 99 text_field = true;
102 break; 100 break;
103 101
104 default: 102 default:
105 NOTREACHED(); 103 NOTREACHED();
106 } 104 }
107 105
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 return 0; 144 return 0;
147 } 145 }
148 146
149 void AppModalDialog::AcceptWindow() { 147 void AppModalDialog::AcceptWindow() {
150 NOTIMPLEMENTED(); 148 NOTIMPLEMENTED();
151 } 149 }
152 150
153 void AppModalDialog::CancelWindow() { 151 void AppModalDialog::CancelWindow() {
154 NOTIMPLEMENTED(); 152 NOTIMPLEMENTED();
155 } 153 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698