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

Side by Side Diff: chrome/browser/extensions/api/feedback_private/feedback_private_api.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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/extensions/api/feedback_private/feedback_private_api.h" 5 #include "chrome/browser/extensions/api/feedback_private/feedback_private_api.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 #if defined(OS_CHROMEOS) 108 #if defined(OS_CHROMEOS)
109 LogSourceAccessManager* FeedbackPrivateAPI::GetLogSourceAccessManager() const { 109 LogSourceAccessManager* FeedbackPrivateAPI::GetLogSourceAccessManager() const {
110 return log_source_access_manager_.get(); 110 return log_source_access_manager_.get();
111 } 111 }
112 #endif 112 #endif
113 113
114 void FeedbackPrivateAPI::RequestFeedback( 114 void FeedbackPrivateAPI::RequestFeedback(
115 const std::string& description_template, 115 const std::string& description_template,
116 const std::string& category_tag, 116 const std::string& category_tag,
117 const std::string& extra_diagnostics,
117 const GURL& page_url) { 118 const GURL& page_url) {
118 #if defined(OS_WIN) 119 #if defined(OS_WIN)
119 // Show prompt for Software Removal Tool if the Reporter component has found 120 // Show prompt for Software Removal Tool if the Reporter component has found
120 // unwanted software, and the user has never run the cleaner before. 121 // unwanted software, and the user has never run the cleaner before.
121 if (base::FeatureList::IsEnabled(kSrtPromptOnFeedbackForm) && 122 if (base::FeatureList::IsEnabled(kSrtPromptOnFeedbackForm) &&
122 safe_browsing::ReporterFoundUws() && 123 safe_browsing::ReporterFoundUws() &&
123 !safe_browsing::UserHasRunCleaner()) { 124 !safe_browsing::UserHasRunCleaner()) {
124 RequestFeedbackForFlow(description_template, category_tag, page_url, 125 RequestFeedbackForFlow(description_template, category_tag,
126 extra_diagnostics, page_url,
125 FeedbackFlow::FEEDBACK_FLOW_SHOWSRTPROMPT); 127 FeedbackFlow::FEEDBACK_FLOW_SHOWSRTPROMPT);
126 return; 128 return;
127 } 129 }
128 #endif 130 #endif
129 RequestFeedbackForFlow(description_template, category_tag, page_url, 131 RequestFeedbackForFlow(description_template, category_tag, extra_diagnostics,
130 FeedbackFlow::FEEDBACK_FLOW_REGULAR); 132 page_url, FeedbackFlow::FEEDBACK_FLOW_REGULAR);
131 } 133 }
132 134
133 void FeedbackPrivateAPI::RequestFeedbackForFlow( 135 void FeedbackPrivateAPI::RequestFeedbackForFlow(
134 const std::string& description_template, 136 const std::string& description_template,
135 const std::string& category_tag, 137 const std::string& category_tag,
138 const std::string& extra_diagnostics,
136 const GURL& page_url, 139 const GURL& page_url,
137 api::feedback_private::FeedbackFlow flow) { 140 api::feedback_private::FeedbackFlow flow) {
138 if (browser_context_ && EventRouter::Get(browser_context_)) { 141 if (browser_context_ && EventRouter::Get(browser_context_)) {
139 FeedbackInfo info; 142 FeedbackInfo info;
140 info.description = description_template; 143 info.description = description_template;
141 info.category_tag = base::MakeUnique<std::string>(category_tag); 144 info.category_tag = base::MakeUnique<std::string>(category_tag);
142 info.page_url = base::MakeUnique<std::string>(page_url.spec()); 145 info.page_url = base::MakeUnique<std::string>(page_url.spec());
143 info.system_information.reset(new SystemInformationList); 146 info.system_information = base::MakeUnique<SystemInformationList>();
147
148 // Any extra diagnostics information should be added to the sys info.
149 if (!extra_diagnostics.empty()) {
150 SystemInformation extra_info;
151 extra_info.key = "EXTRA_DIAGNOSTICS";
152 extra_info.value = extra_diagnostics;
153 info.system_information->emplace_back(std::move(extra_info));
154 }
155
144 // The manager is only available if tracing is enabled. 156 // The manager is only available if tracing is enabled.
145 if (TracingManager* manager = TracingManager::Get()) { 157 if (TracingManager* manager = TracingManager::Get()) {
146 info.trace_id.reset(new int(manager->RequestTrace())); 158 info.trace_id = base::MakeUnique<int>(manager->RequestTrace());
147 } 159 }
148 info.flow = flow; 160 info.flow = flow;
149 #if defined(OS_MACOSX) 161 #if defined(OS_MACOSX)
150 const bool use_system_window_frame = true; 162 const bool use_system_window_frame = true;
151 #else 163 #else
152 const bool use_system_window_frame = false; 164 const bool use_system_window_frame = false;
153 #endif 165 #endif
154 info.use_system_window_frame = 166 info.use_system_window_frame =
155 base::MakeUnique<bool>(use_system_window_frame); 167 base::MakeUnique<bool>(use_system_window_frame);
156 168
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 case feedback_private::SRT_PROMPT_RESULT_CLOSED: 418 case feedback_private::SRT_PROMPT_RESULT_CLOSED:
407 base::RecordAction(base::UserMetricsAction("Feedback.SrtPromptClosed")); 419 base::RecordAction(base::UserMetricsAction("Feedback.SrtPromptClosed"));
408 break; 420 break;
409 default: 421 default:
410 return RespondNow(Error("Invalid arugment.")); 422 return RespondNow(Error("Invalid arugment."));
411 } 423 }
412 return RespondNow(NoArguments()); 424 return RespondNow(NoArguments());
413 } 425 }
414 426
415 } // namespace extensions 427 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/feedback_private/feedback_private_api.h ('k') | chrome/browser/feedback/show_feedback_page.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698