OLD | NEW |
---|---|
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/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #include "chrome/browser/ui/simple_message_box_internal.h" | 10 #include "chrome/browser/ui/simple_message_box_internal.h" |
(...skipping 18 matching lines...) Expand all Loading... | |
29 NSAlert* alert = [[[NSAlert alloc] init] autorelease]; | 29 NSAlert* alert = [[[NSAlert alloc] init] autorelease]; |
30 [alert setMessageText:base::SysUTF16ToNSString(message)]; | 30 [alert setMessageText:base::SysUTF16ToNSString(message)]; |
31 [alert setAlertStyle:NSWarningAlertStyle]; | 31 [alert setAlertStyle:NSWarningAlertStyle]; |
32 if (type == MESSAGE_BOX_TYPE_QUESTION) { | 32 if (type == MESSAGE_BOX_TYPE_QUESTION) { |
33 [alert addButtonWithTitle: | 33 [alert addButtonWithTitle: |
34 l10n_util::GetNSString(IDS_CONFIRM_MESSAGEBOX_YES_BUTTON_LABEL)]; | 34 l10n_util::GetNSString(IDS_CONFIRM_MESSAGEBOX_YES_BUTTON_LABEL)]; |
35 [alert addButtonWithTitle: | 35 [alert addButtonWithTitle: |
36 l10n_util::GetNSString(IDS_CONFIRM_MESSAGEBOX_NO_BUTTON_LABEL)]; | 36 l10n_util::GetNSString(IDS_CONFIRM_MESSAGEBOX_NO_BUTTON_LABEL)]; |
37 } else { | 37 } else { |
38 [alert addButtonWithTitle:l10n_util::GetNSString(IDS_OK)]; | 38 [alert addButtonWithTitle:l10n_util::GetNSString(IDS_OK)]; |
39 } | 39 } |
tapted
2016/06/29 03:19:55
If OWNERS like the API changes in general, It's pr
afakhry
2016/06/29 18:57:18
Done.
Thank you very much, and sorry that I know n
| |
40 NSInteger result = [alert runModal]; | 40 NSInteger result = [alert runModal]; |
41 return (result == NSAlertSecondButtonReturn) ? | 41 return (result == NSAlertSecondButtonReturn) ? |
42 MESSAGE_BOX_RESULT_NO : MESSAGE_BOX_RESULT_YES; | 42 MESSAGE_BOX_RESULT_NO : MESSAGE_BOX_RESULT_YES; |
43 } | 43 } |
44 | 44 |
45 } // namespace | 45 } // namespace |
46 | 46 |
47 void ShowWarningMessageBox(gfx::NativeWindow parent, | 47 void ShowWarningMessageBox(gfx::NativeWindow parent, |
48 const base::string16& title, | 48 const base::string16& title, |
49 const base::string16& message) { | 49 const base::string16& message) { |
50 ShowMessageBox(parent, title, message, MESSAGE_BOX_TYPE_WARNING); | 50 ShowMessageBox(parent, title, message, MESSAGE_BOX_TYPE_WARNING); |
51 } | 51 } |
52 | 52 |
53 bool ShowWarningMessageBoxWithCheckbox(gfx::NativeWindow parent, | |
54 const base::string16& title, | |
55 const base::string16& message, | |
56 const base::string16& checkbox_text) { | |
57 // TODO(afakhry): Figure out how to add a checkbox in cocoa. | |
58 ShowMessageBox(parent, title, message, MESSAGE_BOX_TYPE_WARNING); | |
59 return false; | |
60 } | |
61 | |
53 MessageBoxResult ShowQuestionMessageBox(gfx::NativeWindow parent, | 62 MessageBoxResult ShowQuestionMessageBox(gfx::NativeWindow parent, |
54 const base::string16& title, | 63 const base::string16& title, |
55 const base::string16& message) { | 64 const base::string16& message) { |
56 return ShowMessageBox(parent, title, message, MESSAGE_BOX_TYPE_QUESTION); | 65 return ShowMessageBox(parent, title, message, MESSAGE_BOX_TYPE_QUESTION); |
57 } | 66 } |
58 | 67 |
59 } // namespace chrome | 68 } // namespace chrome |
OLD | NEW |