Chromium Code Reviews| 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 39eb774268cf3be40c722178e1a84de106e32ffc..e3988affc9f50e37f7af21e89fb030e3a8943354 100644 |
| --- a/chrome/browser/ui/profile_error_dialog.cc |
| +++ b/chrome/browser/ui/profile_error_dialog.cc |
| @@ -7,27 +7,53 @@ |
| #include "base/auto_reset.h" |
| #include "base/base_switches.h" |
| #include "base/command_line.h" |
| +#include "base/files/file_path.h" |
|
Lei Zhang
2016/07/09 01:04:47
Also not needed.
afakhry
2016/07/11 16:47:45
Done.
|
| #include "base/metrics/histogram.h" |
| #include "build/build_config.h" |
| +#include "chrome/browser/ui/chrome_pages.h" |
| #include "chrome/browser/ui/simple_message_box.h" |
| #include "chrome/grit/chromium_strings.h" |
| +#include "chrome/grit/generated_resources.h" |
| #include "ui/base/l10n/l10n_util.h" |
| -void ShowProfileErrorDialog(ProfileErrorType type, int message_id) { |
| +namespace { |
| + |
| +#if !defined(OS_ANDROID) |
| +constexpr char kProfileErrorFeedbackCategory[] = "FEEDBACK_PROFILE_ERROR"; |
| +#endif // !defined(OS_ANDROID) |
| + |
| +} // namespace |
| + |
| +void ShowProfileErrorDialog(ProfileErrorType type, |
| + int message_id, |
| + const sql::DatabaseDiagnosticMap& diagnostics) { |
| #if defined(OS_ANDROID) |
| NOTIMPLEMENTED(); |
| #else |
| UMA_HISTOGRAM_ENUMERATION("Profile.ProfileError", type, PROFILE_ERROR_END); |
| if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| - switches::kNoErrorDialogs)) |
| + switches::kNoErrorDialogs)) { |
| return; |
| + } |
| static bool is_showing_profile_error_dialog = false; |
| if (!is_showing_profile_error_dialog) { |
|
Lei Zhang
2016/07/09 01:04:47
I'd do an early return, so you have more columns t
afakhry
2016/07/11 16:47:45
Done.
|
| base::AutoReset<bool> resetter(&is_showing_profile_error_dialog, true); |
| - chrome::ShowWarningMessageBox(NULL, |
| - l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), |
| - l10n_util::GetStringUTF16(message_id)); |
| + 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); |
| + |
| + for (const auto& diagnostic : diagnostics) { |
| + feedback_description += |
| + "\n" + diagnostic.first + ": " + diagnostic.second; |
| + } |
| + |
| + chrome::ShowFeedbackPage(nullptr, feedback_description, |
| + kProfileErrorFeedbackCategory); |
| + } |
| } |
| #endif |
| } |