Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser/tab_contents/navigation_details.h" | 12 #include "content/browser/tab_contents/navigation_details.h" |
| 13 #include "content/browser/tab_contents/tab_contents.h" | 13 #include "content/browser/tab_contents/tab_contents.h" |
| 14 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
| 15 | 15 |
| 16 const char kCategoryTagAutofill[] = "Autofill"; | |
|
xiyuan
2011/12/22 02:18:23
"static" or anonymous namespace if we don't use it
tfarina
2011/12/22 02:20:43
const has internal linkage so it doesn't need eith
rkc
2011/12/22 22:41:46
Confirmed that the C++ standard does specify inter
| |
| 17 | |
| 16 AutofillFeedbackInfoBarDelegate::AutofillFeedbackInfoBarDelegate( | 18 AutofillFeedbackInfoBarDelegate::AutofillFeedbackInfoBarDelegate( |
| 17 InfoBarTabHelper* infobar_helper, | 19 InfoBarTabHelper* infobar_helper, |
| 18 const string16& message, | 20 const string16& message, |
| 19 const string16& link_text, | 21 const string16& link_text, |
| 20 const std::string& feedback_message) | 22 const std::string& feedback_message) |
| 21 : LinkInfoBarDelegate(infobar_helper), | 23 : LinkInfoBarDelegate(infobar_helper), |
| 22 message_(message), | 24 message_(message), |
| 23 link_text_(link_text), | 25 link_text_(link_text), |
| 24 feedback_message_(feedback_message), | 26 feedback_message_(feedback_message), |
| 25 link_clicked_(false) { | 27 link_clicked_(false) { |
| 26 } | 28 } |
| 27 | 29 |
| 28 AutofillFeedbackInfoBarDelegate::~AutofillFeedbackInfoBarDelegate() { | 30 AutofillFeedbackInfoBarDelegate::~AutofillFeedbackInfoBarDelegate() { |
| 29 } | 31 } |
| 30 | 32 |
| 31 string16 AutofillFeedbackInfoBarDelegate::GetMessageTextWithOffset( | 33 string16 AutofillFeedbackInfoBarDelegate::GetMessageTextWithOffset( |
| 32 size_t* link_offset) const { | 34 size_t* link_offset) const { |
| 33 string16 message = message_ + ASCIIToUTF16(" "); | 35 string16 message = message_ + ASCIIToUTF16(" "); |
| 34 *link_offset = message.size(); | 36 *link_offset = message.size(); |
| 35 return message; | 37 return message; |
| 36 } | 38 } |
| 37 | 39 |
| 38 string16 AutofillFeedbackInfoBarDelegate::GetLinkText() const { | 40 string16 AutofillFeedbackInfoBarDelegate::GetLinkText() const { |
| 39 return link_text_; | 41 return link_text_; |
| 40 } | 42 } |
| 41 | 43 |
| 42 bool AutofillFeedbackInfoBarDelegate::LinkClicked( | 44 bool AutofillFeedbackInfoBarDelegate::LinkClicked( |
| 43 WindowOpenDisposition disposition) { | 45 WindowOpenDisposition disposition) { |
| 44 #if defined(OS_CHROMEOS) | 46 browser::ShowHtmlFeedbackView( |
| 45 size_t issue_type = userfeedback::ChromeOsData_ChromeOsCategory_AUTOFILL; | |
| 46 #else | |
| 47 size_t issue_type = | |
| 48 userfeedback::ChromeBrowserData_ChromeBrowserCategory_AUTOFILL; | |
| 49 #endif | |
| 50 | |
| 51 browser::ShowHtmlBugReportView( | |
| 52 Browser::GetBrowserForController(&owner()->tab_contents()->controller(), | 47 Browser::GetBrowserForController(&owner()->tab_contents()->controller(), |
| 53 NULL), | 48 NULL), |
| 54 feedback_message_, | 49 feedback_message_, |
| 55 issue_type); | 50 std::string(kCategoryTagAutofill)); |
| 56 return true; | 51 return true; |
| 57 } | 52 } |
| OLD | NEW |