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

Side by Side Diff: chrome/browser/platform_util_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
« no previous file with comments | « chrome/browser/platform_util_common_linux.cc ('k') | chrome/browser/platform_util_win.cc » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 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 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/platform_util.h" 5 #include "chrome/browser/platform_util.h"
6 6
7 #include <Carbon/Carbon.h> 7 #include <Carbon/Carbon.h>
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 #include <CoreServices/CoreServices.h> 9 #include <CoreServices/CoreServices.h>
10 10
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 } 145 }
146 146
147 bool IsVisible(gfx::NativeView view) { 147 bool IsVisible(gfx::NativeView view) {
148 // A reasonable approximation of how you'd expect this to behave. 148 // A reasonable approximation of how you'd expect this to behave.
149 return (view && 149 return (view &&
150 ![view isHiddenOrHasHiddenAncestor] && 150 ![view isHiddenOrHasHiddenAncestor] &&
151 [view window] && 151 [view window] &&
152 [[view window] isVisible]); 152 [[view window] isVisible]);
153 } 153 }
154 154
155 void SimpleErrorBox(gfx::NativeWindow parent,
156 const string16& title,
157 const string16& message) {
158 // Ignore the title; it's the window title on other platforms and ignorable.
159 NSAlert* alert = [[[NSAlert alloc] init] autorelease];
160 [alert addButtonWithTitle:l10n_util::GetNSString(IDS_OK)];
161 [alert setMessageText:base::SysUTF16ToNSString(message)];
162 [alert setAlertStyle:NSWarningAlertStyle];
163 [alert runModal];
164 }
165
166 bool SimpleYesNoBox(gfx::NativeWindow parent,
167 const string16& title,
168 const string16& message) {
169 // Ignore the title; it's the window title on other platforms and ignorable.
170 NSAlert* alert = [[[NSAlert alloc] init] autorelease];
171 [alert setMessageText:base::SysUTF16ToNSString(message)];
172 [alert setAlertStyle:NSWarningAlertStyle];
173
174 [alert addButtonWithTitle:
175 l10n_util::GetNSString(IDS_CONFIRM_MESSAGEBOX_YES_BUTTON_LABEL)];
176 [alert addButtonWithTitle:
177 l10n_util::GetNSString(IDS_CONFIRM_MESSAGEBOX_NO_BUTTON_LABEL)];
178
179 NSInteger result = [alert runModal];
180 return result == NSAlertFirstButtonReturn;
181 }
182
183 } // namespace platform_util 155 } // namespace platform_util
OLDNEW
« no previous file with comments | « chrome/browser/platform_util_common_linux.cc ('k') | chrome/browser/platform_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698