Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: chrome/browser/pepper_broker_infobar_delegate.h

Issue 22694006: Infobar system refactor. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_PEPPER_BROKER_INFOBAR_DELEGATE_H_ 5 #ifndef CHROME_BROWSER_PEPPER_BROKER_INFOBAR_DELEGATE_H_
6 #define CHROME_BROWSER_PEPPER_BROKER_INFOBAR_DELEGATE_H_ 6 #define CHROME_BROWSER_PEPPER_BROKER_INFOBAR_DELEGATE_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "chrome/browser/infobars/confirm_infobar_delegate.h" 10 #include "chrome/browser/infobars/confirm_infobar_delegate.h"
11 #include "url/gurl.h" 11 #include "url/gurl.h"
12 12
13 class HostContentSettingsMap; 13 class HostContentSettingsMap;
14 class InfoBarService; 14 class InfoBarService;
15 class TabSpecificContentSettings; 15 class TabSpecificContentSettings;
16 16
17 namespace content { 17 namespace content {
18 class WebContents; 18 class WebContents;
19 } 19 }
20 20
21 // Shows an infobar that asks the user whether a Pepper plug-in is allowed 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" 22 // to connect to its (privileged) broker. The user decision is made "sticky"
23 // by storing a content setting for the site. 23 // by storing a content setting for the site.
24 class PepperBrokerInfoBarDelegate : public ConfirmInfoBarDelegate { 24 class PepperBrokerInfoBarDelegate : public ConfirmInfoBarDelegate {
25 public: 25 public:
26 // Determines whether the broker setting is allow, deny, or ask. In the first 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 27 // two cases, runs the callback directly. In the third, creates a pepper
28 // broker infobar delegate and adds it to the InfoBarService associated with 28 // broker infobar and delegate and adds the infobar to the InfoBarService
29 // |web_contents|. 29 // associated with |web_contents|.
30 static void Create(content::WebContents* web_contents, 30 static void Create(content::WebContents* web_contents,
31 const GURL& url, 31 const GURL& url,
32 const base::FilePath& plugin_path, 32 const base::FilePath& plugin_path,
33 const base::Callback<void(bool)>& callback); 33 const base::Callback<void(bool)>& callback);
34 34
35 private: 35 private:
36 PepperBrokerInfoBarDelegate(InfoBarService* infobar_service, 36 PepperBrokerInfoBarDelegate(const GURL& url,
37 const GURL& url,
38 const base::FilePath& plugin_path, 37 const base::FilePath& plugin_path,
39 const std::string& languages, 38 const std::string& languages,
40 HostContentSettingsMap* content_settings, 39 HostContentSettingsMap* content_settings,
41 TabSpecificContentSettings* tab_content_settings, 40 TabSpecificContentSettings* tab_content_settings,
42 const base::Callback<void(bool)>& callback); 41 const base::Callback<void(bool)>& callback);
43 virtual ~PepperBrokerInfoBarDelegate(); 42 virtual ~PepperBrokerInfoBarDelegate();
44 43
45 // ConfirmInfoBarDelegate: 44 // ConfirmInfoBarDelegate:
46 virtual int GetIconID() const OVERRIDE; 45 virtual int GetIconID() const OVERRIDE;
47 virtual string16 GetMessageText() const OVERRIDE; 46 virtual string16 GetMessageText() const OVERRIDE;
48 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; 47 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
49 virtual bool Accept() OVERRIDE; 48 virtual bool Accept() OVERRIDE;
50 virtual bool Cancel() OVERRIDE; 49 virtual bool Cancel() OVERRIDE;
51 virtual string16 GetLinkText() const OVERRIDE; 50 virtual string16 GetLinkText() const OVERRIDE;
52 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; 51 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE;
53 52
54 void DispatchCallback(bool result); 53 void DispatchCallback(bool result);
55 54
56 const GURL url_; 55 const GURL url_;
57 const base::FilePath plugin_path_; 56 const base::FilePath plugin_path_;
58 const std::string languages_; 57 const std::string languages_;
59 HostContentSettingsMap* content_settings_; 58 HostContentSettingsMap* content_settings_;
60 TabSpecificContentSettings* tab_content_settings_; 59 TabSpecificContentSettings* tab_content_settings_;
61 base::Callback<void(bool)> callback_; 60 base::Callback<void(bool)> callback_;
62 61
63 DISALLOW_COPY_AND_ASSIGN(PepperBrokerInfoBarDelegate); 62 DISALLOW_COPY_AND_ASSIGN(PepperBrokerInfoBarDelegate);
64 }; 63 };
65 64
66 #endif // CHROME_BROWSER_PEPPER_BROKER_INFOBAR_DELEGATE_H_ 65 #endif // CHROME_BROWSER_PEPPER_BROKER_INFOBAR_DELEGATE_H_
OLDNEW
« no previous file with comments | « chrome/browser/password_manager/password_manager_delegate_impl.cc ('k') | chrome/browser/pepper_broker_infobar_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698