OLD | NEW |
1 // Copyright (c) 2012 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/api/infobars/infobar_tab_service.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_finder.h" | 10 #include "chrome/browser/ui/browser_finder.h" |
11 #include "chrome/browser/ui/chrome_pages.h" | 11 #include "chrome/browser/ui/chrome_pages.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"; | 17 const char kCategoryTagAutofill[] = "Autofill"; |
18 | 18 |
19 AutofillFeedbackInfoBarDelegate::AutofillFeedbackInfoBarDelegate( | 19 AutofillFeedbackInfoBarDelegate::AutofillFeedbackInfoBarDelegate( |
20 InfoBarTabHelper* infobar_helper, | 20 InfoBarTabService* infobar_service, |
21 const string16& message, | 21 const string16& message, |
22 const string16& link_text, | 22 const string16& link_text, |
23 const std::string& feedback_message) | 23 const std::string& feedback_message) |
24 : LinkInfoBarDelegate(infobar_helper), | 24 : LinkInfoBarDelegate(infobar_service), |
25 message_(message), | 25 message_(message), |
26 link_text_(link_text), | 26 link_text_(link_text), |
27 feedback_message_(feedback_message), | 27 feedback_message_(feedback_message), |
28 link_clicked_(false) { | 28 link_clicked_(false) { |
29 } | 29 } |
30 | 30 |
31 AutofillFeedbackInfoBarDelegate::~AutofillFeedbackInfoBarDelegate() { | 31 AutofillFeedbackInfoBarDelegate::~AutofillFeedbackInfoBarDelegate() { |
32 } | 32 } |
33 | 33 |
34 string16 AutofillFeedbackInfoBarDelegate::GetMessageTextWithOffset( | 34 string16 AutofillFeedbackInfoBarDelegate::GetMessageTextWithOffset( |
35 size_t* link_offset) const { | 35 size_t* link_offset) const { |
36 string16 message = message_ + ASCIIToUTF16(" "); | 36 string16 message = message_ + ASCIIToUTF16(" "); |
37 *link_offset = message.size(); | 37 *link_offset = message.size(); |
38 return message; | 38 return message; |
39 } | 39 } |
40 | 40 |
41 string16 AutofillFeedbackInfoBarDelegate::GetLinkText() const { | 41 string16 AutofillFeedbackInfoBarDelegate::GetLinkText() const { |
42 return link_text_; | 42 return link_text_; |
43 } | 43 } |
44 | 44 |
45 bool AutofillFeedbackInfoBarDelegate::LinkClicked( | 45 bool AutofillFeedbackInfoBarDelegate::LinkClicked( |
46 WindowOpenDisposition disposition) { | 46 WindowOpenDisposition disposition) { |
47 chrome::ShowFeedbackPage( | 47 chrome::ShowFeedbackPage( |
48 browser::FindBrowserWithWebContents(owner()->web_contents()), | 48 browser::FindBrowserWithWebContents(owner()->GetWebContents()), |
49 feedback_message_, | 49 feedback_message_, |
50 std::string(kCategoryTagAutofill)); | 50 std::string(kCategoryTagAutofill)); |
51 return true; | 51 return true; |
52 } | 52 } |
OLD | NEW |