OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef CHROME_BROWSER_PEPPER_BROKER_INFOBAR_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_PEPPER_BROKER_INFOBAR_DELEGATE_H_ |
| 7 |
| 8 #include "base/callback.h" |
| 9 #include "base/file_path.h" |
| 10 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" |
| 11 #include "googleurl/src/gurl.h" |
| 12 |
| 13 class HostContentSettingsMap; |
| 14 class InfoBarTabHelper; |
| 15 |
| 16 namespace content { |
| 17 class WebContents; |
| 18 } |
| 19 |
| 20 // Shows an infobar that asks the user whether a Pepper plug-in is allowed |
| 21 // to connect to its (privileged) broker. The user decision is made "sticky" |
| 22 // by storing a content setting for the site. |
| 23 class PepperBrokerInfoBarDelegate : public ConfirmInfoBarDelegate { |
| 24 public: |
| 25 virtual ~PepperBrokerInfoBarDelegate(); |
| 26 |
| 27 static void Show( |
| 28 content::WebContents* web_contents, |
| 29 const GURL& url, |
| 30 const FilePath& plugin_path, |
| 31 const base::Callback<void(bool)>& callback); |
| 32 |
| 33 // ConfirmInfoBarDelegate: |
| 34 virtual string16 GetMessageText() const OVERRIDE; |
| 35 virtual int GetButtons() const OVERRIDE; |
| 36 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; |
| 37 virtual bool Accept() OVERRIDE; |
| 38 virtual bool Cancel() OVERRIDE; |
| 39 virtual string16 GetLinkText() const OVERRIDE; |
| 40 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; |
| 41 virtual gfx::Image* GetIcon() const OVERRIDE; |
| 42 |
| 43 private: |
| 44 PepperBrokerInfoBarDelegate( |
| 45 InfoBarTabHelper* helper, |
| 46 const GURL& url, |
| 47 const FilePath& plugin_path, |
| 48 const std::string& languages, |
| 49 HostContentSettingsMap* content_settings, |
| 50 const base::Callback<void(bool)>& callback); |
| 51 |
| 52 void DispatchCallback(bool result); |
| 53 |
| 54 const GURL url_; |
| 55 const FilePath plugin_path_; |
| 56 const std::string languages_; |
| 57 HostContentSettingsMap* content_settings_; |
| 58 base::Callback<void(bool)> callback_; |
| 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(PepperBrokerInfoBarDelegate); |
| 61 }; |
| 62 |
| 63 #endif // CHROME_BROWSER_PEPPER_BROKER_INFOBAR_DELEGATE_H_ |
OLD | NEW |