Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / net / spdyproxy / data_reduction_proxy_infobar_delegate.cc
blob86e0309d8e196fa287971ab5654a35651c917769
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.
5 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_infobar_delegate.h"
7 #include "base/memory/scoped_ptr.h"
8 #include "chrome/browser/infobars/infobar_service.h"
9 #include "components/infobars/core/infobar.h"
10 #include "components/infobars/core/infobar_delegate.h"
11 #include "content/public/browser/web_contents.h"
12 #include "grit/components_strings.h"
13 #include "ui/base/l10n/l10n_util.h"
14 #include "url/gurl.h"
16 // static
17 void DataReductionProxyInfoBarDelegate::Create(
18 content::WebContents* web_contents, const std::string& link_url) {
19 InfoBarService* infobar_service =
20 InfoBarService::FromWebContents(web_contents);
21 infobar_service->AddInfoBar(
22 DataReductionProxyInfoBarDelegate::CreateInfoBar(
23 infobar_service,
24 scoped_ptr<DataReductionProxyInfoBarDelegate>(
25 new DataReductionProxyInfoBarDelegate(link_url))));
28 #if !defined(OS_ANDROID)
29 // This infobar currently only supports Android.
31 // static
32 scoped_ptr<infobars::InfoBar> DataReductionProxyInfoBarDelegate::CreateInfoBar(
33 infobars::InfoBarManager* infobar_manager,
34 scoped_ptr<DataReductionProxyInfoBarDelegate> delegate) {
35 return infobar_manager->CreateConfirmInfoBar(delegate.Pass());
37 #endif
39 DataReductionProxyInfoBarDelegate::~DataReductionProxyInfoBarDelegate() {
42 DataReductionProxyInfoBarDelegate::DataReductionProxyInfoBarDelegate(
43 const std::string& link_url)
44 : ConfirmInfoBarDelegate(),
45 link_url_(link_url) {
48 bool DataReductionProxyInfoBarDelegate::ShouldExpire(
49 const NavigationDetails& details) const {
50 return false;
53 base::string16 DataReductionProxyInfoBarDelegate::GetMessageText() const {
54 return base::string16();
57 int DataReductionProxyInfoBarDelegate::GetButtons() const {
58 return BUTTON_NONE;
61 bool DataReductionProxyInfoBarDelegate::LinkClicked(
62 WindowOpenDisposition disposition) {
63 InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL(
64 content::OpenURLParams(
65 GURL(link_url_),
66 content::Referrer(),
67 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
68 ui::PAGE_TRANSITION_LINK, false));
69 return true;