OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/profile_error_dialog.h" | 5 #include "chrome/browser/ui/profile_error_dialog.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/base_switches.h" | 8 #include "base/base_switches.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "chrome/browser/ui/chrome_pages.h" |
12 #include "chrome/browser/ui/simple_message_box.h" | 13 #include "chrome/browser/ui/simple_message_box.h" |
13 #include "chrome/grit/chromium_strings.h" | 14 #include "chrome/grit/chromium_strings.h" |
| 15 #include "chrome/grit/generated_resources.h" |
14 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
15 | 17 |
16 void ShowProfileErrorDialog(ProfileErrorType type, int message_id) { | 18 namespace { |
| 19 |
| 20 #if !defined(OS_ANDROID) |
| 21 constexpr char kProfileErrorFeedbackCategory[] = "FEEDBACK_PROFILE_ERROR"; |
| 22 #endif // !defined(OS_ANDROID) |
| 23 |
| 24 } // namespace |
| 25 |
| 26 void ShowProfileErrorDialog(ProfileErrorType type, |
| 27 int message_id, |
| 28 const std::string& diagnostics) { |
17 #if defined(OS_ANDROID) | 29 #if defined(OS_ANDROID) |
18 NOTIMPLEMENTED(); | 30 NOTIMPLEMENTED(); |
19 #else | 31 #else |
20 UMA_HISTOGRAM_ENUMERATION("Profile.ProfileError", type, PROFILE_ERROR_END); | 32 UMA_HISTOGRAM_ENUMERATION("Profile.ProfileError", type, PROFILE_ERROR_END); |
21 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 33 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
22 switches::kNoErrorDialogs)) | 34 switches::kNoErrorDialogs)) { |
| 35 return; |
| 36 } |
| 37 |
| 38 static bool is_showing_profile_error_dialog = false; |
| 39 if (is_showing_profile_error_dialog) |
23 return; | 40 return; |
24 | 41 |
25 static bool is_showing_profile_error_dialog = false; | 42 base::AutoReset<bool> resetter(&is_showing_profile_error_dialog, true); |
26 if (!is_showing_profile_error_dialog) { | 43 if (chrome::ShowWarningMessageBoxWithCheckbox( |
27 base::AutoReset<bool> resetter(&is_showing_profile_error_dialog, true); | 44 nullptr, l10n_util::GetStringUTF16(IDS_PROFILE_ERROR_DIALOG_TITLE), |
28 chrome::ShowWarningMessageBox(NULL, | 45 l10n_util::GetStringUTF16(message_id), |
29 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), | 46 l10n_util::GetStringUTF16(IDS_PROFILE_ERROR_DIALOG_CHECKBOX))) { |
30 l10n_util::GetStringUTF16(message_id)); | 47 std::string feedback_description = |
| 48 l10n_util::GetStringUTF8(IDS_PROFILE_ERROR_FEEDBACK_DESCRIPTION); |
| 49 feedback_description += "\n" + diagnostics; |
| 50 |
| 51 chrome::ShowFeedbackPage(nullptr, feedback_description, |
| 52 kProfileErrorFeedbackCategory); |
31 } | 53 } |
32 #endif | 54 #endif |
33 } | 55 } |
OLD | NEW |