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

Side by Side Diff: chrome/browser/feedback/show_feedback_page.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <string> 5 #include <string>
6 6
7 #include "base/metrics/histogram_macros.h" 7 #include "base/metrics/histogram_macros.h"
8 #include "chrome/browser/extensions/api/feedback_private/feedback_private_api.h" 8 #include "chrome/browser/extensions/api/feedback_private/feedback_private_api.h"
9 #include "chrome/browser/feedback/feedback_dialog_utils.h" 9 #include "chrome/browser/feedback/feedback_dialog_utils.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
12 #include "chrome/browser/ui/chrome_pages.h" 12 #include "chrome/browser/ui/chrome_pages.h"
13 #include "chrome/browser/ui/tabs/tab_strip_model.h" 13 #include "chrome/browser/ui/tabs/tab_strip_model.h"
14 #include "chrome/browser/ui/webui/md_feedback/md_feedback_dialog_controller.h" 14 #include "chrome/browser/ui/webui/md_feedback/md_feedback_dialog_controller.h"
15 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
16 16
17 namespace feedback_private = extensions::api::feedback_private; 17 namespace feedback_private = extensions::api::feedback_private;
18 18
19 namespace chrome { 19 namespace chrome {
20 20
21 void ShowFeedbackPage(Browser* browser, 21 void ShowFeedbackPage(Browser* browser,
22 FeedbackSource source, 22 FeedbackSource source,
23 const std::string& description_template, 23 const std::string& description_template,
24 const std::string& category_tag) { 24 const std::string& category_tag,
25 const std::string& extra_diagnostics) {
25 GURL page_url; 26 GURL page_url;
26 if (browser) { 27 if (browser) {
27 page_url = GetTargetTabUrl(browser->session_id().id(), 28 page_url = GetTargetTabUrl(browser->session_id().id(),
28 browser->tab_strip_model()->active_index()); 29 browser->tab_strip_model()->active_index());
29 } 30 }
30 31
31 Profile* profile = GetFeedbackProfile(browser); 32 Profile* profile = GetFeedbackProfile(browser);
32 if (!profile) { 33 if (!profile) {
33 LOG(ERROR) << "Cannot invoke feedback: No profile found!"; 34 LOG(ERROR) << "Cannot invoke feedback: No profile found!";
34 return; 35 return;
35 } 36 }
36 37
37 // Record an UMA histogram to know the most frequent feedback request source. 38 // Record an UMA histogram to know the most frequent feedback request source.
38 UMA_HISTOGRAM_ENUMERATION("Feedback.RequestSource", source, 39 UMA_HISTOGRAM_ENUMERATION("Feedback.RequestSource", source,
39 kFeedbackSourceCount); 40 kFeedbackSourceCount);
40 41
41 if (::switches::MdFeedbackEnabled()) { 42 if (::switches::MdFeedbackEnabled()) {
42 MdFeedbackDialogController::GetInstance()->Show(profile); 43 MdFeedbackDialogController::GetInstance()->Show(profile);
43 return; 44 return;
44 } 45 }
45 46
46 extensions::FeedbackPrivateAPI* api = 47 extensions::FeedbackPrivateAPI* api =
47 extensions::FeedbackPrivateAPI::GetFactoryInstance()->Get(profile); 48 extensions::FeedbackPrivateAPI::GetFactoryInstance()->Get(profile);
48 49
49 api->RequestFeedbackForFlow( 50 api->RequestFeedbackForFlow(
50 description_template, category_tag, page_url, 51 description_template, category_tag, extra_diagnostics, page_url,
51 source == kFeedbackSourceSadTabPage 52 source == kFeedbackSourceSadTabPage
52 ? feedback_private::FeedbackFlow::FEEDBACK_FLOW_SADTABCRASH 53 ? feedback_private::FeedbackFlow::FEEDBACK_FLOW_SADTABCRASH
53 : feedback_private::FeedbackFlow::FEEDBACK_FLOW_REGULAR); 54 : feedback_private::FeedbackFlow::FEEDBACK_FLOW_REGULAR);
54 } 55 }
55 56
56 } // namespace chrome 57 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698