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

Unified Diff: chrome/browser/ui/profile_error_dialog.cc

Issue 2929953002: Make profile error dialog async (Closed)
Patch Set: for #3 comments Created 3 years, 6 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/cocoa/simple_message_box_mac.mm ('k') | chrome/browser/ui/simple_message_box.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 93b5c947b5343e3b9277d784f49fd2687ac1d095..ec3164897ae5a93f0dbf54feb9df97092064bec2 100644
--- a/chrome/browser/ui/profile_error_dialog.cc
+++ b/chrome/browser/ui/profile_error_dialog.cc
@@ -4,8 +4,8 @@
#include "chrome/browser/ui/profile_error_dialog.h"
-#include "base/auto_reset.h"
#include "base/base_switches.h"
+#include "base/bind.h"
#include "base/command_line.h"
#include "base/metrics/histogram_macros.h"
#include "build/build_config.h"
@@ -18,6 +18,30 @@ namespace {
#if !defined(OS_ANDROID)
constexpr char kProfileErrorFeedbackCategory[] = "FEEDBACK_PROFILE_ERROR";
+
+bool g_is_showing_profile_error_dialog = false;
+
+void OnProfileErrorDialogDismissed(const std::string& diagnostics,
+ bool needs_feedback) {
+ g_is_showing_profile_error_dialog = false;
+
+ if (!needs_feedback)
+ return;
+
+ std::string feedback_description =
+ l10n_util::GetStringUTF8(IDS_PROFILE_ERROR_FEEDBACK_DESCRIPTION);
+ if (!diagnostics.empty()) {
+ // TODO(afakhry): Add support to inject diagnostics to the feedback
+ // reports without adding them to the description. crbug.com/708511.
+ feedback_description +=
+ "\n\n" +
+ l10n_util::GetStringUTF8(IDS_PROFILE_ERROR_FEEDBACK_DIAGNOSTICS_LINE) +
+ diagnostics;
+ }
+
+ chrome::ShowFeedbackPage(nullptr, chrome::kFeedbackSourceProfileErrorDialog,
+ feedback_description, kProfileErrorFeedbackCategory);
+}
#endif // !defined(OS_ANDROID)
} // namespace
@@ -35,29 +59,14 @@ void ShowProfileErrorDialog(ProfileErrorType type,
return;
}
- static bool is_showing_profile_error_dialog = false;
- if (is_showing_profile_error_dialog)
+ if (g_is_showing_profile_error_dialog)
return;
- base::AutoReset<bool> resetter(&is_showing_profile_error_dialog, true);
- if (chrome::ShowWarningMessageBoxWithCheckbox(
- nullptr, l10n_util::GetStringUTF16(IDS_PROFILE_ERROR_DIALOG_TITLE),
- l10n_util::GetStringUTF16(message_id),
- l10n_util::GetStringUTF16(IDS_PROFILE_ERROR_DIALOG_CHECKBOX))) {
- std::string feedback_description =
- l10n_util::GetStringUTF8(IDS_PROFILE_ERROR_FEEDBACK_DESCRIPTION);
- if (!diagnostics.empty()) {
- // TODO(afakhry): Add support to inject diagnostics to the feedback
- // reports without adding them to the description. crbug.com/708511.
- feedback_description += "\n\n" +
- l10n_util::GetStringUTF8(
- IDS_PROFILE_ERROR_FEEDBACK_DIAGNOSTICS_LINE) +
- diagnostics;
- }
-
- chrome::ShowFeedbackPage(nullptr, chrome::kFeedbackSourceProfileErrorDialog,
- feedback_description,
- kProfileErrorFeedbackCategory);
- }
+ g_is_showing_profile_error_dialog = true;
+ chrome::ShowWarningMessageBoxWithCheckbox(
+ nullptr, l10n_util::GetStringUTF16(IDS_PROFILE_ERROR_DIALOG_TITLE),
+ l10n_util::GetStringUTF16(message_id),
+ l10n_util::GetStringUTF16(IDS_PROFILE_ERROR_DIALOG_CHECKBOX),
+ base::Bind(&OnProfileErrorDialogDismissed, diagnostics));
#endif
}
« no previous file with comments | « chrome/browser/ui/cocoa/simple_message_box_mac.mm ('k') | chrome/browser/ui/simple_message_box.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698