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..40423cbe18ff2104485513c7b642a57d8b95aca0 100644 |
--- a/chrome/browser/ui/profile_error_dialog.cc |
+++ b/chrome/browser/ui/profile_error_dialog.cc |
@@ -4,6 +4,9 @@ |
#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" |
@@ -14,9 +17,17 @@ void ShowProfileErrorDialog(ProfileErrorType type, int message_id) { |
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)) |
+ return; |
+ |
+ static bool is_showing_profile_error_dialog = false; |
+ if (!is_showing_profile_error_dialog) { |
+ base::AutoReset<bool> resetter(&is_showing_profile_error_dialog, true); |
+ chrome::ShowMessageBox(NULL, |
+ l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), |
+ l10n_util::GetStringUTF16(message_id), |
+ chrome::MESSAGE_BOX_TYPE_WARNING); |
+ } |
#endif |
} |