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

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

Issue 2934303002: Provide a better way of injecting extra diagnostics in feedbacks (Closed)
Patch Set: pkasting's comments Created 3 years, 6 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
« no previous file with comments | « chrome/browser/ui/chrome_pages.h ('k') | chrome/browser/ui/sad_tab.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/bind.h" 8 #include "base/bind.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 12 matching lines...) Expand all
23 23
24 void OnProfileErrorDialogDismissed(const std::string& diagnostics, 24 void OnProfileErrorDialogDismissed(const std::string& diagnostics,
25 bool needs_feedback) { 25 bool needs_feedback) {
26 g_is_showing_profile_error_dialog = false; 26 g_is_showing_profile_error_dialog = false;
27 27
28 if (!needs_feedback) 28 if (!needs_feedback)
29 return; 29 return;
30 30
31 std::string feedback_description = 31 std::string feedback_description =
32 l10n_util::GetStringUTF8(IDS_PROFILE_ERROR_FEEDBACK_DESCRIPTION); 32 l10n_util::GetStringUTF8(IDS_PROFILE_ERROR_FEEDBACK_DESCRIPTION);
33 if (!diagnostics.empty()) {
34 // TODO(afakhry): Add support to inject diagnostics to the feedback
35 // reports without adding them to the description. crbug.com/708511.
36 feedback_description +=
37 "\n\n" +
38 l10n_util::GetStringUTF8(IDS_PROFILE_ERROR_FEEDBACK_DIAGNOSTICS_LINE) +
39 diagnostics;
40 }
41 33
42 chrome::ShowFeedbackPage(nullptr, chrome::kFeedbackSourceProfileErrorDialog, 34 chrome::ShowFeedbackPage(nullptr, chrome::kFeedbackSourceProfileErrorDialog,
43 feedback_description, kProfileErrorFeedbackCategory); 35 feedback_description, kProfileErrorFeedbackCategory,
36 diagnostics);
44 } 37 }
45 #endif // !defined(OS_ANDROID) 38 #endif // !defined(OS_ANDROID)
46 39
47 } // namespace 40 } // namespace
48 41
49 void ShowProfileErrorDialog(ProfileErrorType type, 42 void ShowProfileErrorDialog(ProfileErrorType type,
50 int message_id, 43 int message_id,
51 const std::string& diagnostics) { 44 const std::string& diagnostics) {
52 #if defined(OS_ANDROID) 45 #if defined(OS_ANDROID)
53 NOTIMPLEMENTED(); 46 NOTIMPLEMENTED();
54 #else 47 #else
55 UMA_HISTOGRAM_ENUMERATION("Profile.ProfileError", static_cast<int>(type), 48 UMA_HISTOGRAM_ENUMERATION("Profile.ProfileError", static_cast<int>(type),
56 static_cast<int>(ProfileErrorType::END)); 49 static_cast<int>(ProfileErrorType::END));
57 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 50 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
58 switches::kNoErrorDialogs)) { 51 switches::kNoErrorDialogs)) {
59 return; 52 return;
60 } 53 }
61 54
62 if (g_is_showing_profile_error_dialog) 55 if (g_is_showing_profile_error_dialog)
63 return; 56 return;
64 57
65 g_is_showing_profile_error_dialog = true; 58 g_is_showing_profile_error_dialog = true;
66 chrome::ShowWarningMessageBoxWithCheckbox( 59 chrome::ShowWarningMessageBoxWithCheckbox(
67 nullptr, l10n_util::GetStringUTF16(IDS_PROFILE_ERROR_DIALOG_TITLE), 60 nullptr, l10n_util::GetStringUTF16(IDS_PROFILE_ERROR_DIALOG_TITLE),
68 l10n_util::GetStringUTF16(message_id), 61 l10n_util::GetStringUTF16(message_id),
69 l10n_util::GetStringUTF16(IDS_PROFILE_ERROR_DIALOG_CHECKBOX), 62 l10n_util::GetStringUTF16(IDS_PROFILE_ERROR_DIALOG_CHECKBOX),
70 base::Bind(&OnProfileErrorDialogDismissed, diagnostics)); 63 base::Bind(&OnProfileErrorDialogDismissed, diagnostics));
71 #endif 64 #endif
72 } 65 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/chrome_pages.h ('k') | chrome/browser/ui/sad_tab.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698