Chromium Code Reviews| 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/files/file_path.h" | |
| 10 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" | 
| 11 #include "build/build_config.h" | 12 #include "build/build_config.h" | 
| 13 #include "chrome/browser/ui/chrome_pages.h" | |
| 12 #include "chrome/browser/ui/simple_message_box.h" | 14 #include "chrome/browser/ui/simple_message_box.h" | 
| 13 #include "chrome/grit/chromium_strings.h" | 15 #include "chrome/grit/chromium_strings.h" | 
| 16 #include "chrome/grit/generated_resources.h" | |
| 14 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" | 
| 15 | 18 | 
| 16 void ShowProfileErrorDialog(ProfileErrorType type, int message_id) { | 19 namespace { | 
| 20 | |
| 21 #if !defined(OS_ANDROID) | |
| 22 constexpr char kProfileErrorFeedbackCategory[] = "FEEDBACK_PROFILE_ERROR"; | |
| 23 #endif // !defined(OS_ANDROID) | |
| 24 | |
| 25 } // namespace | |
| 26 | |
| 27 void ShowProfileErrorDialog(const base::FilePath& corrupted_file, | |
| 28 ProfileErrorType type, | |
| 29 int message_id) { | |
| 17 #if defined(OS_ANDROID) | 30 #if defined(OS_ANDROID) | 
| 18 NOTIMPLEMENTED(); | 31 NOTIMPLEMENTED(); | 
| 19 #else | 32 #else | 
| 20 UMA_HISTOGRAM_ENUMERATION("Profile.ProfileError", type, PROFILE_ERROR_END); | 33 UMA_HISTOGRAM_ENUMERATION("Profile.ProfileError", type, PROFILE_ERROR_END); | 
| 21 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 34 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 
| 22 switches::kNoErrorDialogs)) | 35 switches::kNoErrorDialogs)) { | 
| 23 return; | 36 return; | 
| 37 } | |
| 24 | 38 | 
| 25 static bool is_showing_profile_error_dialog = false; | 39 static bool is_showing_profile_error_dialog = false; | 
| 26 if (!is_showing_profile_error_dialog) { | 40 if (!is_showing_profile_error_dialog) { | 
| 27 base::AutoReset<bool> resetter(&is_showing_profile_error_dialog, true); | 41 base::AutoReset<bool> resetter(&is_showing_profile_error_dialog, true); | 
| 28 chrome::ShowWarningMessageBox(NULL, | 42 if (chrome::ShowWarningMessageBoxWithCheckbox( | 
| 29 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), | 43 nullptr, l10n_util::GetStringUTF16(IDS_PROFILE_ERROR_DIALOG_TITLE), | 
| 30 l10n_util::GetStringUTF16(message_id)); | 44 l10n_util::GetStringUTF16(message_id), | 
| 45 l10n_util::GetStringUTF16(IDS_PROFILE_ERROR_DIALOG_CHECKBOX))) { | |
| 46 std::string feedback_description = | |
| 47 l10n_util::GetStringUTF8(IDS_PROFILE_ERROR_FEEDBACK_DESCRIPTION); | |
| 48 feedback_description += | |
| 49 "\nCorrupted file: " + corrupted_file.AsUTF8Unsafe(); | |
| 
 
Scott Hess - ex-Googler
2016/06/29 05:13:48
May be worth replacing the profile dir with .../ .
 
afakhry
2016/06/29 18:57:18
We need to distinguish between the default profile
 
Scott Hess - ex-Googler
2016/06/29 19:17:27
Bit of clarification from offline: My concern is t
 
 | |
| 50 chrome::ShowFeedbackPage( | |
| 51 nullptr, | |
| 52 feedback_description, | |
| 53 kProfileErrorFeedbackCategory); | |
| 54 } | |
| 31 } | 55 } | 
| 32 #endif | 56 #endif | 
| 33 } | 57 } | 
| OLD | NEW |