| 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 "chrome/browser/net/spdyproxy/data_reduction_proxy_infobar_delegate.h" | 5 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_infobar_delegate_and
roid.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "chrome/browser/infobars/infobar_service.h" | 8 #include "chrome/browser/infobars/infobar_service.h" |
| 9 #include "components/infobars/core/infobar.h" | 9 #include "components/infobars/core/infobar.h" |
| 10 #include "components/infobars/core/infobar_delegate.h" | 10 #include "components/infobars/core/infobar_delegate.h" |
| 11 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
| 12 #include "grit/components_strings.h" | 12 #include "grit/components_strings.h" |
| 13 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
| 14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
| 15 | 15 |
| 16 // static | 16 // static |
| 17 void DataReductionProxyInfoBarDelegate::Create( | 17 void DataReductionProxyInfoBarDelegateAndroid::Create( |
| 18 content::WebContents* web_contents, const std::string& link_url) { | 18 content::WebContents* web_contents, |
| 19 const std::string& link_url) { |
| 19 InfoBarService* infobar_service = | 20 InfoBarService* infobar_service = |
| 20 InfoBarService::FromWebContents(web_contents); | 21 InfoBarService::FromWebContents(web_contents); |
| 21 infobar_service->AddInfoBar( | 22 infobar_service->AddInfoBar( |
| 22 DataReductionProxyInfoBarDelegate::CreateInfoBar( | 23 DataReductionProxyInfoBarDelegateAndroid::CreateInfoBar( |
| 23 infobar_service, | 24 infobar_service, |
| 24 scoped_ptr<DataReductionProxyInfoBarDelegate>( | 25 scoped_ptr<DataReductionProxyInfoBarDelegateAndroid>( |
| 25 new DataReductionProxyInfoBarDelegate(link_url)))); | 26 new DataReductionProxyInfoBarDelegateAndroid(link_url)))); |
| 26 } | 27 } |
| 27 | 28 |
| 28 DataReductionProxyInfoBarDelegate::~DataReductionProxyInfoBarDelegate() { | 29 DataReductionProxyInfoBarDelegateAndroid:: |
| 29 } | 30 ~DataReductionProxyInfoBarDelegateAndroid() {} |
| 30 | 31 |
| 31 DataReductionProxyInfoBarDelegate::DataReductionProxyInfoBarDelegate( | 32 DataReductionProxyInfoBarDelegateAndroid:: |
| 32 const std::string& link_url) | 33 DataReductionProxyInfoBarDelegateAndroid(const std::string& link_url) |
| 33 : ConfirmInfoBarDelegate(), | 34 : ConfirmInfoBarDelegate(), link_url_(link_url) {} |
| 34 link_url_(link_url) { | |
| 35 } | |
| 36 | 35 |
| 37 bool DataReductionProxyInfoBarDelegate::ShouldExpire( | 36 bool DataReductionProxyInfoBarDelegateAndroid::ShouldExpire( |
| 38 const NavigationDetails& details) const { | 37 const NavigationDetails& details) const { |
| 39 return false; | 38 return false; |
| 40 } | 39 } |
| 41 | 40 |
| 42 base::string16 DataReductionProxyInfoBarDelegate::GetMessageText() const { | 41 base::string16 DataReductionProxyInfoBarDelegateAndroid::GetMessageText() |
| 42 const { |
| 43 return base::string16(); | 43 return base::string16(); |
| 44 } | 44 } |
| 45 | 45 |
| 46 int DataReductionProxyInfoBarDelegate::GetButtons() const { | 46 int DataReductionProxyInfoBarDelegateAndroid::GetButtons() const { |
| 47 return BUTTON_NONE; | 47 return BUTTON_NONE; |
| 48 } | 48 } |
| 49 | 49 |
| 50 GURL DataReductionProxyInfoBarDelegate::GetLinkURL() const { | 50 GURL DataReductionProxyInfoBarDelegateAndroid::GetLinkURL() const { |
| 51 return GURL(link_url_); | 51 return GURL(link_url_); |
| 52 } | 52 } |
| 53 | 53 |
| 54 bool DataReductionProxyInfoBarDelegate::LinkClicked( | 54 bool DataReductionProxyInfoBarDelegateAndroid::LinkClicked( |
| 55 WindowOpenDisposition disposition) { | 55 WindowOpenDisposition disposition) { |
| 56 ConfirmInfoBarDelegate::LinkClicked(disposition); | 56 ConfirmInfoBarDelegate::LinkClicked(disposition); |
| 57 return true; | 57 return true; |
| 58 } | 58 } |
| OLD | NEW |