| OLD | NEW |
| 1 // Copyright (c) 2011 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/autofill/autofill_feedback_infobar_delegate.h" | 5 #include "chrome/browser/autofill/autofill_feedback_infobar_delegate.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/infobars/infobar_tab_helper.h" | 8 #include "chrome/browser/infobars/infobar_tab_helper.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/webui/bug_report_ui.h" | 10 #include "chrome/browser/ui/webui/feedback_ui.h" |
| 11 #include "chrome/browser/userfeedback/proto/extension.pb.h" | 11 #include "chrome/browser/feedback/proto/extension.pb.h" |
| 12 #include "content/public/browser/navigation_controller.h" | 12 #include "content/public/browser/navigation_controller.h" |
| 13 #include "content/public/browser/navigation_details.h" | 13 #include "content/public/browser/navigation_details.h" |
| 14 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
| 15 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
| 16 | 16 |
| 17 const char kCategoryTagAutofill[] = "Autofill"; |
| 18 |
| 17 AutofillFeedbackInfoBarDelegate::AutofillFeedbackInfoBarDelegate( | 19 AutofillFeedbackInfoBarDelegate::AutofillFeedbackInfoBarDelegate( |
| 18 InfoBarTabHelper* infobar_helper, | 20 InfoBarTabHelper* infobar_helper, |
| 19 const string16& message, | 21 const string16& message, |
| 20 const string16& link_text, | 22 const string16& link_text, |
| 21 const std::string& feedback_message) | 23 const std::string& feedback_message) |
| 22 : LinkInfoBarDelegate(infobar_helper), | 24 : LinkInfoBarDelegate(infobar_helper), |
| 23 message_(message), | 25 message_(message), |
| 24 link_text_(link_text), | 26 link_text_(link_text), |
| 25 feedback_message_(feedback_message), | 27 feedback_message_(feedback_message), |
| 26 link_clicked_(false) { | 28 link_clicked_(false) { |
| 27 } | 29 } |
| 28 | 30 |
| 29 AutofillFeedbackInfoBarDelegate::~AutofillFeedbackInfoBarDelegate() { | 31 AutofillFeedbackInfoBarDelegate::~AutofillFeedbackInfoBarDelegate() { |
| 30 } | 32 } |
| 31 | 33 |
| 32 string16 AutofillFeedbackInfoBarDelegate::GetMessageTextWithOffset( | 34 string16 AutofillFeedbackInfoBarDelegate::GetMessageTextWithOffset( |
| 33 size_t* link_offset) const { | 35 size_t* link_offset) const { |
| 34 string16 message = message_ + ASCIIToUTF16(" "); | 36 string16 message = message_ + ASCIIToUTF16(" "); |
| 35 *link_offset = message.size(); | 37 *link_offset = message.size(); |
| 36 return message; | 38 return message; |
| 37 } | 39 } |
| 38 | 40 |
| 39 string16 AutofillFeedbackInfoBarDelegate::GetLinkText() const { | 41 string16 AutofillFeedbackInfoBarDelegate::GetLinkText() const { |
| 40 return link_text_; | 42 return link_text_; |
| 41 } | 43 } |
| 42 | 44 |
| 43 bool AutofillFeedbackInfoBarDelegate::LinkClicked( | 45 bool AutofillFeedbackInfoBarDelegate::LinkClicked( |
| 44 WindowOpenDisposition disposition) { | 46 WindowOpenDisposition disposition) { |
| 45 #if defined(OS_CHROMEOS) | 47 browser::ShowHtmlFeedbackView( |
| 46 size_t issue_type = userfeedback::ChromeOsData_ChromeOsCategory_AUTOFILL; | |
| 47 #else | |
| 48 size_t issue_type = | |
| 49 userfeedback::ChromeBrowserData_ChromeBrowserCategory_AUTOFILL; | |
| 50 #endif | |
| 51 | |
| 52 browser::ShowHtmlBugReportView( | |
| 53 Browser::GetBrowserForController( | 48 Browser::GetBrowserForController( |
| 54 &owner()->web_contents()->GetController(), NULL), | 49 &owner()->web_contents()->GetController(), NULL), |
| 55 feedback_message_, | 50 feedback_message_, |
| 56 issue_type); | 51 std::string(kCategoryTagAutofill)); |
| 57 return true; | 52 return true; |
| 58 } | 53 } |
| OLD | NEW |