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

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

Issue 7601014: browser: Abstract message box dialog functions into its own header file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: compile on linux_view? Created 9 years, 4 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
(Empty)
1 // Copyright (c) 2011 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/simple_message_box.h"
6
7 #import <Cocoa/Cocoa.h>
8
9 #include "base/sys_string_conversions.h"
10 #include "grit/generated_resources.h"
11 #include "ui/base/l10n/l10n_util_mac.h"
12
13 namespace browser {
14
15 void ShowErrorBox(gfx::NativeWindow parent,
16 const string16& title,
17 const string16& message) {
18 // Ignore the title; it's the window title on other platforms and ignorable.
19 NSAlert* alert = [[[NSAlert alloc] init] autorelease];
20 [alert addButtonWithTitle:l10n_util::GetNSString(IDS_OK)];
21 [alert setMessageText:base::SysUTF16ToNSString(message)];
22 [alert setAlertStyle:NSWarningAlertStyle];
23 [alert runModal];
24 }
25
26 bool ShowYesNoBox(gfx::NativeWindow parent,
27 const string16& title,
28 const string16& message) {
29 // Ignore the title; it's the window title on other platforms and ignorable.
30 NSAlert* alert = [[[NSAlert alloc] init] autorelease];
31 [alert setMessageText:base::SysUTF16ToNSString(message)];
32 [alert setAlertStyle:NSWarningAlertStyle];
33
34 [alert addButtonWithTitle:
35 l10n_util::GetNSString(IDS_CONFIRM_MESSAGEBOX_YES_BUTTON_LABEL)];
36 [alert addButtonWithTitle:
37 l10n_util::GetNSString(IDS_CONFIRM_MESSAGEBOX_NO_BUTTON_LABEL)];
38
39 NSInteger result = [alert runModal];
40 return result == NSAlertFirstButtonReturn;
41 }
42
43 } // namespace browser
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/render_view_context_menu.cc ('k') | chrome/browser/ui/gtk/infobars/infobar_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698