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

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: pkasting's & droger's Created 4 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
« no previous file with comments | « chrome/browser/ui/chrome_pages.h ('k') | chrome/browser/ui/profile_error_dialog.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..1c0a692ac8ab3e11eeaa381e5c28e93f4c41bb3e 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,24 @@ 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 || ([checkbox state] == NSOnState))
+ return MESSAGE_BOX_RESULT_YES;
+
+ return MESSAGE_BOX_RESULT_NO;
}
} // namespace
@@ -47,13 +64,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
« no previous file with comments | « chrome/browser/ui/chrome_pages.h ('k') | chrome/browser/ui/profile_error_dialog.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698