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