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

Unified Diff: chrome/browser/ui/cocoa/simple_message_box_mac.mm

Issue 2107493002: Offer user to send feedback from profile error dialog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Yet more compile errors Created 4 years, 5 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
index 84865c07b3b9354ee82858a20637f898bdbf69cf..047496144f866aadb41c4c0e2a53cfbe62f96e95 100644
--- a/chrome/browser/ui/cocoa/simple_message_box_mac.mm
+++ b/chrome/browser/ui/cocoa/simple_message_box_mac.mm
@@ -6,6 +6,7 @@
#import <Cocoa/Cocoa.h>
+#include "base/mac/scoped_nsobject.h"
#include "base/strings/sys_string_conversions.h"
#include "chrome/browser/ui/simple_message_box_internal.h"
#include "chrome/grit/generated_resources.h"
@@ -20,6 +21,7 @@ namespace {
MessageBoxResult ShowMessageBox(gfx::NativeWindow parent,
const base::string16& title,
const base::string16& message,
+ const base::string16& checkbox_text,
MessageBoxType type) {
startup_metric_utils::SetNonBrowserUIDisplayed();
if (internal::g_should_skip_message_box_for_test)
@@ -37,9 +39,26 @@ MessageBoxResult ShowMessageBox(gfx::NativeWindow parent,
} else {
[alert addButtonWithTitle:l10n_util::GetNSString(IDS_OK)];
}
+
+ base::scoped_nsobject<NSButton> checkbox;
+ if (!checkbox_text.empty()) {
+ checkbox.reset([[NSButton alloc] initWithFrame:NSZeroRect]);
+ [checkbox setButtonType:NSSwitchButton];
+ [checkbox setTitle:base::SysUTF16ToNSString(checkbox_text)];
+ [checkbox sizeToFit];
+ [alert setAccessoryView:checkbox];
+ }
+
NSInteger result = [alert runModal];
- return (result == NSAlertSecondButtonReturn) ?
- MESSAGE_BOX_RESULT_NO : MESSAGE_BOX_RESULT_YES;
+ if (result == NSAlertSecondButtonReturn)
+ return MESSAGE_BOX_RESULT_NO;
+
+ if (checkbox) {
+ return ([checkbox state] == NSOnState) ? MESSAGE_BOX_RESULT_YES_CHECKED
+ : MESSAGE_BOX_RESULT_YES_NOT_CHECKED;
+ }
+
+ return MESSAGE_BOX_RESULT_YES;
}
} // namespace
@@ -47,13 +66,24 @@ MessageBoxResult ShowMessageBox(gfx::NativeWindow parent,
void ShowWarningMessageBox(gfx::NativeWindow parent,
const base::string16& title,
const base::string16& message) {
- ShowMessageBox(parent, title, message, MESSAGE_BOX_TYPE_WARNING);
+ ShowMessageBox(parent, title, message, base::string16(),
+ MESSAGE_BOX_TYPE_WARNING);
+}
+
+bool ShowWarningMessageBoxWithCheckbox(gfx::NativeWindow parent,
+ const base::string16& title,
+ const base::string16& message,
+ const base::string16& checkbox_text) {
+ ShowMessageBox(parent, title, message, checkbox_text,
+ MESSAGE_BOX_TYPE_WARNING);
+ return false;
}
MessageBoxResult ShowQuestionMessageBox(gfx::NativeWindow parent,
const base::string16& title,
const base::string16& message) {
- return ShowMessageBox(parent, title, message, MESSAGE_BOX_TYPE_QUESTION);
+ return ShowMessageBox(parent, title, message, base::string16(),
+ MESSAGE_BOX_TYPE_QUESTION);
}
} // namespace chrome

Powered by Google App Engine
This is Rietveld 408576698