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

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

Issue 10662046: Add a histogram to measure browser window display (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Improve code comments Created 8 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/ui/browser.cc ('k') | chrome/browser/ui/views/simple_message_box_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) 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 "chrome/common/startup_metric_utils.h"
10 #include "grit/generated_resources.h" 11 #include "grit/generated_resources.h"
11 #include "ui/base/l10n/l10n_util_mac.h" 12 #include "ui/base/l10n/l10n_util_mac.h"
12 13
13 namespace chrome { 14 namespace chrome {
14 15
15 MessageBoxResult ShowMessageBox(gfx::NativeWindow parent, 16 MessageBoxResult ShowMessageBox(gfx::NativeWindow parent,
16 const string16& title, 17 const string16& title,
17 const string16& message, 18 const string16& message,
18 MessageBoxType type) { 19 MessageBoxType type) {
20 startup_metric_utils::SetNonBrowserUIDisplayed();
21
19 // Ignore the title; it's the window title on other platforms and ignorable. 22 // Ignore the title; it's the window title on other platforms and ignorable.
20 NSAlert* alert = [[[NSAlert alloc] init] autorelease]; 23 NSAlert* alert = [[[NSAlert alloc] init] autorelease];
21 [alert setMessageText:base::SysUTF16ToNSString(message)]; 24 [alert setMessageText:base::SysUTF16ToNSString(message)];
22 NSUInteger style = (type == MESSAGE_BOX_TYPE_INFORMATION) ? 25 NSUInteger style = (type == MESSAGE_BOX_TYPE_INFORMATION) ?
23 NSInformationalAlertStyle : NSWarningAlertStyle; 26 NSInformationalAlertStyle : NSWarningAlertStyle;
24 [alert setAlertStyle:style]; 27 [alert setAlertStyle:style];
25 if (type == MESSAGE_BOX_TYPE_QUESTION) { 28 if (type == MESSAGE_BOX_TYPE_QUESTION) {
26 [alert addButtonWithTitle: 29 [alert addButtonWithTitle:
27 l10n_util::GetNSString(IDS_CONFIRM_MESSAGEBOX_YES_BUTTON_LABEL)]; 30 l10n_util::GetNSString(IDS_CONFIRM_MESSAGEBOX_YES_BUTTON_LABEL)];
28 [alert addButtonWithTitle: 31 [alert addButtonWithTitle:
29 l10n_util::GetNSString(IDS_CONFIRM_MESSAGEBOX_NO_BUTTON_LABEL)]; 32 l10n_util::GetNSString(IDS_CONFIRM_MESSAGEBOX_NO_BUTTON_LABEL)];
30 } else { 33 } else {
31 [alert addButtonWithTitle:l10n_util::GetNSString(IDS_OK)]; 34 [alert addButtonWithTitle:l10n_util::GetNSString(IDS_OK)];
32 } 35 }
33 NSInteger result = [alert runModal]; 36 NSInteger result = [alert runModal];
34 return (result == NSAlertSecondButtonReturn) ? 37 return (result == NSAlertSecondButtonReturn) ?
35 MESSAGE_BOX_RESULT_NO : MESSAGE_BOX_RESULT_YES; 38 MESSAGE_BOX_RESULT_NO : MESSAGE_BOX_RESULT_YES;
36 } 39 }
37 40
38 } // namespace chrome 41 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/views/simple_message_box_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698