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

Side by Side Diff: chrome/browser/ui/profile_error_dialog.cc

Issue 2107493002: Offer user to send feedback from profile error dialog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Yet more compile errors Created 4 years, 5 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 unified diff | Download patch
OLDNEW
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"
Lei Zhang 2016/07/09 01:04:47 Also not needed.
afakhry 2016/07/11 16:47:45 Done.
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(ProfileErrorType type,
28 int message_id,
29 const sql::DatabaseDiagnosticMap& diagnostics) {
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) {
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.
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
49 for (const auto& diagnostic : diagnostics) {
50 feedback_description +=
51 "\n" + diagnostic.first + ": " + diagnostic.second;
52 }
53
54 chrome::ShowFeedbackPage(nullptr, feedback_description,
55 kProfileErrorFeedbackCategory);
56 }
31 } 57 }
32 #endif 58 #endif
33 } 59 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698