Index: chrome/browser/ui/profile_error_dialog.cc |
diff --git a/chrome/browser/ui/profile_error_dialog.cc b/chrome/browser/ui/profile_error_dialog.cc |
index 0dae4bfd5cb01b50f59d388387a3c658d99edfed..a987efca7eac99f9ee0bd9348bb0757e7cc523db 100644 |
--- a/chrome/browser/ui/profile_error_dialog.cc |
+++ b/chrome/browser/ui/profile_error_dialog.cc |
@@ -4,19 +4,32 @@ |
#include "chrome/browser/ui/profile_error_dialog.h" |
+#include "base/auto_reset.h" |
+#include "base/base_switches.h" |
+#include "base/command_line.h" |
#include "base/metrics/histogram.h" |
#include "chrome/browser/ui/simple_message_box.h" |
#include "chrome/grit/chromium_strings.h" |
#include "ui/base/l10n/l10n_util.h" |
+namespace { |
+bool is_showing_profile_error_dialog = false; |
Peter Kasting
2015/01/26 19:52:46
Nit: A static bool inside the method would be clea
robwu
2015/01/26 23:26:21
Done.
|
+} // namespace |
+ |
void ShowProfileErrorDialog(ProfileErrorType type, int message_id) { |
#if defined(OS_ANDROID) || defined(OS_IOS) |
NOTIMPLEMENTED(); |
#else |
UMA_HISTOGRAM_ENUMERATION("Profile.ProfileError", type, PROFILE_ERROR_END); |
- chrome::ShowMessageBox(NULL, |
- l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), |
- l10n_util::GetStringUTF16(message_id), |
- chrome::MESSAGE_BOX_TYPE_WARNING); |
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kNoErrorDialogs)) |
Peter Kasting
2015/01/26 19:52:46
I wonder if this should be in ShowMessageBox() ins
robwu
2015/01/26 23:26:21
At least ShowWarningMessageBox in chrome/browser/c
Peter Kasting
2015/01/27 00:20:32
Are you sure that should be shown when --noerrdial
robwu
2015/01/27 22:03:47
I'm not sure about that, but I'm definitely to not
|
+ return; |
+ if (!is_showing_profile_error_dialog) { |
+ base::AutoReset<bool> resetter(&is_showing_profile_error_dialog, true); |
Peter Kasting
2015/01/26 19:52:46
If this actually works to eliminate duplicate dial
robwu
2015/01/26 23:26:21
If you follow the calls, then you'll indeed see a
Peter Kasting
2015/01/27 00:20:32
That seems very, very bad. I would imagine this c
robwu
2015/01/27 22:03:47
Can you follow up with the right people? As a memb
|
+ chrome::ShowMessageBox(NULL, |
+ l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), |
+ l10n_util::GetStringUTF16(message_id), |
+ chrome::MESSAGE_BOX_TYPE_WARNING); |
+ } |
#endif |
} |