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

Side by Side Diff: chrome/browser/ui/cocoa/simple_message_box_mac.mm

Issue 10689095: browser: Put simple_message_box.h and chrome_web_contents_view_delegate.h into chrome namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/simple_message_box.h" 5 #include "chrome/browser/ui/simple_message_box.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/sys_string_conversions.h" 9 #include "base/sys_string_conversions.h"
10 #include "grit/generated_resources.h" 10 #include "grit/generated_resources.h"
11 #include "ui/base/l10n/l10n_util_mac.h" 11 #include "ui/base/l10n/l10n_util_mac.h"
12 12
13 namespace browser { 13 namespace chrome {
14 14
15 MessageBoxResult ShowMessageBox(gfx::NativeWindow parent, 15 MessageBoxResult ShowMessageBox(gfx::NativeWindow parent,
16 const string16& title, 16 const string16& title,
17 const string16& message, 17 const string16& message,
18 MessageBoxType type) { 18 MessageBoxType type) {
19 // Ignore the title; it's the window title on other platforms and ignorable. 19 // Ignore the title; it's the window title on other platforms and ignorable.
20 NSAlert* alert = [[[NSAlert alloc] init] autorelease]; 20 NSAlert* alert = [[[NSAlert alloc] init] autorelease];
21 [alert setMessageText:base::SysUTF16ToNSString(message)]; 21 [alert setMessageText:base::SysUTF16ToNSString(message)];
22 NSUInteger style = (type == MESSAGE_BOX_TYPE_INFORMATION) ? 22 NSUInteger style = (type == MESSAGE_BOX_TYPE_INFORMATION) ?
23 NSInformationalAlertStyle : NSWarningAlertStyle; 23 NSInformationalAlertStyle : NSWarningAlertStyle;
24 [alert setAlertStyle:style]; 24 [alert setAlertStyle:style];
25 if (type == MESSAGE_BOX_TYPE_QUESTION) { 25 if (type == MESSAGE_BOX_TYPE_QUESTION) {
26 [alert addButtonWithTitle: 26 [alert addButtonWithTitle:
27 l10n_util::GetNSString(IDS_CONFIRM_MESSAGEBOX_YES_BUTTON_LABEL)]; 27 l10n_util::GetNSString(IDS_CONFIRM_MESSAGEBOX_YES_BUTTON_LABEL)];
28 [alert addButtonWithTitle: 28 [alert addButtonWithTitle:
29 l10n_util::GetNSString(IDS_CONFIRM_MESSAGEBOX_NO_BUTTON_LABEL)]; 29 l10n_util::GetNSString(IDS_CONFIRM_MESSAGEBOX_NO_BUTTON_LABEL)];
30 } else { 30 } else {
31 [alert addButtonWithTitle:l10n_util::GetNSString(IDS_OK)]; 31 [alert addButtonWithTitle:l10n_util::GetNSString(IDS_OK)];
32 } 32 }
33 NSInteger result = [alert runModal]; 33 NSInteger result = [alert runModal];
34 return (result == NSAlertSecondButtonReturn) ? 34 return (result == NSAlertSecondButtonReturn) ?
35 MESSAGE_BOX_RESULT_NO : MESSAGE_BOX_RESULT_YES; 35 MESSAGE_BOX_RESULT_NO : MESSAGE_BOX_RESULT_YES;
36 } 36 }
37 37
38 } // namespace browser 38 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/process_singleton_win.cc ('k') | chrome/browser/ui/cocoa/tab_contents/chrome_web_contents_view_delegate_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698