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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/simple_message_box_mac.mm
diff --git a/chrome/browser/ui/cocoa/simple_message_box_mac.mm b/chrome/browser/ui/cocoa/simple_message_box_mac.mm
new file mode 100644
index 0000000000000000000000000000000000000000..64b3851f899d1b2e4ed9643dfe6639c3123cddbf
--- /dev/null
+++ b/chrome/browser/ui/cocoa/simple_message_box_mac.mm
@@ -0,0 +1,43 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/simple_message_box.h"
+
+#import <Cocoa/Cocoa.h>
+
+#include "base/sys_string_conversions.h"
+#include "grit/generated_resources.h"
+#include "ui/base/l10n/l10n_util_mac.h"
+
+namespace browser {
+
+void ShowErrorBox(gfx::NativeWindow parent,
+ const string16& title,
+ const string16& message) {
+ // Ignore the title; it's the window title on other platforms and ignorable.
+ NSAlert* alert = [[[NSAlert alloc] init] autorelease];
+ [alert addButtonWithTitle:l10n_util::GetNSString(IDS_OK)];
+ [alert setMessageText:base::SysUTF16ToNSString(message)];
+ [alert setAlertStyle:NSWarningAlertStyle];
+ [alert runModal];
+}
+
+bool ShowYesNoBox(gfx::NativeWindow parent,
+ const string16& title,
+ const string16& message) {
+ // Ignore the title; it's the window title on other platforms and ignorable.
+ NSAlert* alert = [[[NSAlert alloc] init] autorelease];
+ [alert setMessageText:base::SysUTF16ToNSString(message)];
+ [alert setAlertStyle:NSWarningAlertStyle];
+
+ [alert addButtonWithTitle:
+ l10n_util::GetNSString(IDS_CONFIRM_MESSAGEBOX_YES_BUTTON_LABEL)];
+ [alert addButtonWithTitle:
+ l10n_util::GetNSString(IDS_CONFIRM_MESSAGEBOX_NO_BUTTON_LABEL)];
+
+ NSInteger result = [alert runModal];
+ return result == NSAlertFirstButtonReturn;
+}
+
+} // namespace browser
« 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