Fix build break
[chromium-blink-merge.git] / chrome / browser / pepper_broker_infobar_delegate.h
blobb8a75bcf9aaf08208fb77491675db096254db5ff
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_PEPPER_BROKER_INFOBAR_DELEGATE_H_
6 #define CHROME_BROWSER_PEPPER_BROKER_INFOBAR_DELEGATE_H_
8 #include "base/callback.h"
9 #include "base/files/file_path.h"
10 #include "chrome/browser/infobars/confirm_infobar_delegate.h"
11 #include "googleurl/src/gurl.h"
13 class HostContentSettingsMap;
14 class InfoBarService;
15 class TabSpecificContentSettings;
17 namespace content {
18 class WebContents;
21 // Shows an infobar that asks the user whether a Pepper plug-in is allowed
22 // to connect to its (privileged) broker. The user decision is made "sticky"
23 // by storing a content setting for the site.
24 class PepperBrokerInfoBarDelegate : public ConfirmInfoBarDelegate {
25 public:
26 // Determines whether the broker setting is allow, deny, or ask. In the first
27 // two cases, runs the callback directly. In the third, creates a pepper
28 // broker delegate and adds it to the InfoBarService associated with
29 // |web_contents|.
30 static void Create(content::WebContents* web_contents,
31 const GURL& url,
32 const base::FilePath& plugin_path,
33 const base::Callback<void(bool)>& callback);
35 // ConfirmInfoBarDelegate:
36 virtual string16 GetMessageText() const OVERRIDE;
37 virtual int GetButtons() const OVERRIDE;
38 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
39 virtual bool Accept() OVERRIDE;
40 virtual bool Cancel() OVERRIDE;
41 virtual string16 GetLinkText() const OVERRIDE;
42 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE;
43 virtual gfx::Image* GetIcon() const OVERRIDE;
45 private:
46 PepperBrokerInfoBarDelegate(
47 InfoBarService* infobar_service,
48 const GURL& url,
49 const base::FilePath& plugin_path,
50 const std::string& languages,
51 HostContentSettingsMap* content_settings,
52 TabSpecificContentSettings* tab_content_settings,
53 const base::Callback<void(bool)>& callback);
54 virtual ~PepperBrokerInfoBarDelegate();
56 void DispatchCallback(bool result);
58 const GURL url_;
59 const base::FilePath plugin_path_;
60 const std::string languages_;
61 HostContentSettingsMap* content_settings_;
62 TabSpecificContentSettings* tab_content_settings_;
63 base::Callback<void(bool)> callback_;
65 DISALLOW_COPY_AND_ASSIGN(PepperBrokerInfoBarDelegate);
68 #endif // CHROME_BROWSER_PEPPER_BROKER_INFOBAR_DELEGATE_H_