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 #ifndef CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_INFOBAR_DELEGATE_H_
6 #define CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_INFOBAR_DELEGATE_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "components/infobars/core/confirm_infobar_delegate.h"
11 #include "components/infobars/core/infobar_delegate.h"
17 // Configures an InfoBar with no buttons that stays visible until it is
18 // explicitly dismissed. This InfoBar is suitable for displaying a message
19 // and a link, and is used only by an Android field trial.
20 class DataReductionProxyInfoBarDelegate : public ConfirmInfoBarDelegate {
22 // Creates the InfoBar and adds it to the provided |web_contents|.
23 static void Create(content::WebContents* web_contents,
24 const std::string& link_url);
26 ~DataReductionProxyInfoBarDelegate() override;
29 explicit DataReductionProxyInfoBarDelegate(const std::string& link_url);
31 // Returns a Data Reduction Proxy infobar that owns |delegate|.
32 static scoped_ptr<infobars::InfoBar> CreateInfoBar(
33 scoped_ptr<DataReductionProxyInfoBarDelegate> delegate);
35 // ConfirmInfoBarDelegate
36 base::string16 GetMessageText() const override;
37 int GetButtons() const override;
38 bool ShouldExpire(const NavigationDetails& details) const override;
39 bool LinkClicked(WindowOpenDisposition disposition) override;
41 std::string link_url_;
43 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyInfoBarDelegate);
46 #endif // CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_INFOBAR_DELEGATE_H_