| OLD | NEW |
| 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; |
| 18 |
| 17 namespace chrome { | 19 namespace chrome { |
| 18 | 20 |
| 19 void ShowFeedbackPage(Browser* browser, | 21 void ShowFeedbackPage(Browser* browser, |
| 20 FeedbackSource source, | 22 FeedbackSource source, |
| 21 const std::string& description_template, | 23 const std::string& description_template, |
| 22 const std::string& category_tag) { | 24 const std::string& category_tag) { |
| 23 GURL page_url; | 25 GURL page_url; |
| 24 if (browser) { | 26 if (browser) { |
| 25 page_url = GetTargetTabUrl(browser->session_id().id(), | 27 page_url = GetTargetTabUrl(browser->session_id().id(), |
| 26 browser->tab_strip_model()->active_index()); | 28 browser->tab_strip_model()->active_index()); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 37 kFeedbackSourceCount); | 39 kFeedbackSourceCount); |
| 38 | 40 |
| 39 if (::switches::MdFeedbackEnabled()) { | 41 if (::switches::MdFeedbackEnabled()) { |
| 40 MdFeedbackDialogController::GetInstance()->Show(profile); | 42 MdFeedbackDialogController::GetInstance()->Show(profile); |
| 41 return; | 43 return; |
| 42 } | 44 } |
| 43 | 45 |
| 44 extensions::FeedbackPrivateAPI* api = | 46 extensions::FeedbackPrivateAPI* api = |
| 45 extensions::FeedbackPrivateAPI::GetFactoryInstance()->Get(profile); | 47 extensions::FeedbackPrivateAPI::GetFactoryInstance()->Get(profile); |
| 46 | 48 |
| 47 api->RequestFeedback(description_template, | 49 api->RequestFeedbackForFlow( |
| 48 category_tag, | 50 description_template, category_tag, page_url, |
| 49 page_url); | 51 source == kFeedbackSourceSadTabPage |
| 52 ? feedback_private::FeedbackFlow::FEEDBACK_FLOW_SADTABCRASH |
| 53 : feedback_private::FeedbackFlow::FEEDBACK_FLOW_REGULAR); |
| 50 } | 54 } |
| 51 | 55 |
| 52 } // namespace chrome | 56 } // namespace chrome |
| OLD | NEW |