OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_CONTENT_SETTINGS_PERMISSION_QUEUE_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_QUEUE_CONTROLLER_H_ |
6 #define CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_QUEUE_CONTROLLER_H_ | 6 #define CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_QUEUE_CONTROLLER_H_ |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "chrome/common/content_settings_types.h" | 9 #include "chrome/common/content_settings_types.h" |
10 #include "content/public/browser/notification_observer.h" | 10 #include "content/public/browser/notification_observer.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 // The InfoBar will be displayed immediately if the tab is not already | 33 // The InfoBar will be displayed immediately if the tab is not already |
34 // displaying one, otherwise it'll be queued. | 34 // displaying one, otherwise it'll be queued. |
35 void CreateInfoBarRequest(const PermissionRequestID& id, | 35 void CreateInfoBarRequest(const PermissionRequestID& id, |
36 const GURL& requesting_frame, | 36 const GURL& requesting_frame, |
37 const GURL& embedder, | 37 const GURL& embedder, |
38 PermissionDecidedCallback callback); | 38 PermissionDecidedCallback callback); |
39 | 39 |
40 // Cancels a specific infobar request. | 40 // Cancels a specific infobar request. |
41 void CancelInfoBarRequest(const PermissionRequestID& id); | 41 void CancelInfoBarRequest(const PermissionRequestID& id); |
42 | 42 |
| 43 // Cancels all infobar requests that match |group_id|. |
| 44 void CancelInfoBarRequests(int group_id); |
| 45 |
43 // Called by the InfoBarDelegate to notify permission has been set. | 46 // Called by the InfoBarDelegate to notify permission has been set. |
44 // It'll notify and dismiss any other pending InfoBar request for the same | 47 // It'll notify and dismiss any other pending InfoBar request for the same |
45 // |requesting_frame| and embedder. | 48 // |requesting_frame| and embedder. |
46 void OnPermissionSet(const PermissionRequestID& id, | 49 void OnPermissionSet(const PermissionRequestID& id, |
47 const GURL& requesting_frame, | 50 const GURL& requesting_frame, |
48 const GURL& embedder, | 51 const GURL& embedder, |
49 bool update_content_setting, | 52 bool update_content_setting, |
50 bool allowed); | 53 bool allowed); |
51 | 54 |
52 protected: | 55 protected: |
53 // content::NotificationObserver: | 56 // content::NotificationObserver: |
54 virtual void Observe(int type, | 57 virtual void Observe(int type, |
55 const content::NotificationSource& source, | 58 const content::NotificationSource& source, |
56 const content::NotificationDetails& details) OVERRIDE; | 59 const content::NotificationDetails& details) OVERRIDE; |
57 | 60 |
58 private: | 61 private: |
59 class PendingInfoBarRequest; | 62 class PendingInfobarRequest; |
60 class RequestEquals; | 63 class RequestEquals; |
61 | 64 |
62 typedef std::vector<PendingInfoBarRequest> PendingInfoBarRequests; | 65 typedef std::vector<PendingInfobarRequest> PendingInfobarRequests; |
63 | 66 |
64 // Returns true if a geolocation infobar is already visible for the tab | 67 // Returns true if a geolocation infobar is already visible for the tab |
65 // corresponding to |id|. | 68 // corresponding to |id|. |
66 bool AlreadyShowingInfoBarForTab(const PermissionRequestID& id) const; | 69 bool AlreadyShowingInfoBarForTab(const PermissionRequestID& id) const; |
67 | 70 |
68 // Shows the next pending infobar for the tab corresponding to |id|, if any. | 71 // Shows the next pending infobar for the tab corresponding to |id|, if any. |
69 // Note that this may not be the pending request whose ID is |id| if other | 72 // Note that this may not be the pending request whose ID is |id| if other |
70 // requests are higher in the queue. If we can't show infobars because there | 73 // requests are higher in the queue. If we can't show infobars because there |
71 // is no InfoBarService for this tab, removes all queued requests for this | 74 // is no InfoBarService for this tab, removes all queued requests for this |
72 // tab. | 75 // tab. |
73 void ShowQueuedInfoBarForTab(const PermissionRequestID& id); | 76 void ShowQueuedInfoBarForTab(const PermissionRequestID& id); |
74 | 77 |
75 void ClearPendingInfoBarRequestsForTab(const PermissionRequestID& id); | 78 void ClearPendingInfobarRequestsForTab(const PermissionRequestID& id); |
76 | 79 |
77 void RegisterForInfoBarNotifications(InfoBarService* infobar_service); | 80 void RegisterForInfoBarNotifications(InfoBarService* infobar_service); |
78 void UnregisterForInfoBarNotifications(InfoBarService* infobar_service); | 81 void UnregisterForInfoBarNotifications(InfoBarService* infobar_service); |
79 | 82 |
80 void UpdateContentSetting( | 83 void UpdateContentSetting( |
81 const GURL& requesting_frame, const GURL& embedder, bool allowed); | 84 const GURL& requesting_frame, const GURL& embedder, bool allowed); |
82 | 85 |
83 content::NotificationRegistrar registrar_; | 86 content::NotificationRegistrar registrar_; |
84 | 87 |
85 Profile* const profile_; | 88 Profile* const profile_; |
86 ContentSettingsType type_; | 89 ContentSettingsType type_; |
87 PendingInfoBarRequests pending_infobar_requests_; | 90 PendingInfobarRequests pending_infobar_requests_; |
88 bool in_shutdown_; | 91 bool in_shutdown_; |
89 | 92 |
90 DISALLOW_COPY_AND_ASSIGN(PermissionQueueController); | 93 DISALLOW_COPY_AND_ASSIGN(PermissionQueueController); |
91 }; | 94 }; |
92 | 95 |
93 #endif // CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_QUEUE_CONTROLLER_H_ | 96 #endif // CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_QUEUE_CONTROLLER_H_ |
OLD | NEW |