| 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_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #endif // !defined(OS_ANDROID) | 21 #endif // !defined(OS_ANDROID) |
| 22 | 22 |
| 23 } // namespace | 23 } // namespace |
| 24 | 24 |
| 25 void ShowProfileErrorDialog(ProfileErrorType type, | 25 void ShowProfileErrorDialog(ProfileErrorType type, |
| 26 int message_id, | 26 int message_id, |
| 27 const std::string& diagnostics) { | 27 const std::string& diagnostics) { |
| 28 #if defined(OS_ANDROID) | 28 #if defined(OS_ANDROID) |
| 29 NOTIMPLEMENTED(); | 29 NOTIMPLEMENTED(); |
| 30 #else | 30 #else |
| 31 UMA_HISTOGRAM_ENUMERATION("Profile.ProfileError", type, PROFILE_ERROR_END); | 31 UMA_HISTOGRAM_ENUMERATION("Profile.ProfileError", static_cast<int>(type), |
| 32 static_cast<int>(ProfileErrorType::END)); |
| 32 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 33 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 33 switches::kNoErrorDialogs)) { | 34 switches::kNoErrorDialogs)) { |
| 34 return; | 35 return; |
| 35 } | 36 } |
| 36 | 37 |
| 37 static bool is_showing_profile_error_dialog = false; | 38 static bool is_showing_profile_error_dialog = false; |
| 38 if (is_showing_profile_error_dialog) | 39 if (is_showing_profile_error_dialog) |
| 39 return; | 40 return; |
| 40 | 41 |
| 41 base::AutoReset<bool> resetter(&is_showing_profile_error_dialog, true); | 42 base::AutoReset<bool> resetter(&is_showing_profile_error_dialog, true); |
| 42 if (chrome::ShowWarningMessageBoxWithCheckbox( | 43 if (chrome::ShowWarningMessageBoxWithCheckbox( |
| 43 nullptr, l10n_util::GetStringUTF16(IDS_PROFILE_ERROR_DIALOG_TITLE), | 44 nullptr, l10n_util::GetStringUTF16(IDS_PROFILE_ERROR_DIALOG_TITLE), |
| 44 l10n_util::GetStringUTF16(message_id), | 45 l10n_util::GetStringUTF16(message_id), |
| 45 l10n_util::GetStringUTF16(IDS_PROFILE_ERROR_DIALOG_CHECKBOX))) { | 46 l10n_util::GetStringUTF16(IDS_PROFILE_ERROR_DIALOG_CHECKBOX))) { |
| 46 std::string feedback_description = | 47 std::string feedback_description = |
| 47 l10n_util::GetStringUTF8(IDS_PROFILE_ERROR_FEEDBACK_DESCRIPTION); | 48 l10n_util::GetStringUTF8(IDS_PROFILE_ERROR_FEEDBACK_DESCRIPTION); |
| 48 feedback_description += "\n" + diagnostics; | 49 feedback_description += "\n" + diagnostics; |
| 49 | 50 |
| 50 chrome::ShowFeedbackPage(nullptr, feedback_description, | 51 chrome::ShowFeedbackPage(nullptr, feedback_description, |
| 51 kProfileErrorFeedbackCategory); | 52 kProfileErrorFeedbackCategory); |
| 52 } | 53 } |
| 53 #endif | 54 #endif |
| 54 } | 55 } |
| OLD | NEW |