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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 // Called by the InfoBarDelegate to notify permission has been set. | 44 // Called by the InfoBarDelegate to notify permission has been set. |
45 // It'll notify and dismiss any other pending InfoBar request for the same | 45 // It'll notify and dismiss any other pending InfoBar request for the same |
46 // |requesting_frame| and embedder. | 46 // |requesting_frame| and embedder. |
47 void OnPermissionSet(const PermissionRequestID& id, | 47 void OnPermissionSet(const PermissionRequestID& id, |
48 const GURL& requesting_frame, | 48 const GURL& requesting_frame, |
49 const GURL& embedder, | 49 const GURL& embedder, |
50 bool update_content_setting, | 50 bool update_content_setting, |
51 bool allowed); | 51 bool allowed); |
52 | 52 |
| 53 // Performs the update to content settings for a particular request frame |
| 54 // context. |
| 55 void UpdateContentSetting( |
| 56 const GURL& requesting_frame, const GURL& embedder, bool allowed); |
| 57 |
53 protected: | 58 protected: |
54 // content::NotificationObserver: | 59 // content::NotificationObserver: |
55 virtual void Observe(int type, | 60 virtual void Observe(int type, |
56 const content::NotificationSource& source, | 61 const content::NotificationSource& source, |
57 const content::NotificationDetails& details) OVERRIDE; | 62 const content::NotificationDetails& details) OVERRIDE; |
58 | 63 |
59 private: | 64 private: |
60 class PendingInfobarRequest; | 65 class PendingInfobarRequest; |
61 class RequestEquals; | 66 class RequestEquals; |
62 | 67 |
63 typedef std::vector<PendingInfobarRequest> PendingInfobarRequests; | 68 typedef std::vector<PendingInfobarRequest> PendingInfobarRequests; |
64 | 69 |
65 // Returns true if a geolocation infobar is already visible for the tab | 70 // Returns true if a geolocation infobar is already visible for the tab |
66 // corresponding to |id|. | 71 // corresponding to |id|. |
67 bool AlreadyShowingInfoBarForTab(const PermissionRequestID& id) const; | 72 bool AlreadyShowingInfoBarForTab(const PermissionRequestID& id) const; |
68 | 73 |
69 // Shows the next pending infobar for the tab corresponding to |id|, if any. | 74 // Shows the next pending infobar for the tab corresponding to |id|, if any. |
70 // Note that this may not be the pending request whose ID is |id| if other | 75 // Note that this may not be the pending request whose ID is |id| if other |
71 // requests are higher in the queue. If we can't show infobars because there | 76 // requests are higher in the queue. If we can't show infobars because there |
72 // is no InfoBarService for this tab, removes all queued requests for this | 77 // is no InfoBarService for this tab, removes all queued requests for this |
73 // tab. | 78 // tab. |
74 void ShowQueuedInfoBarForTab(const PermissionRequestID& id); | 79 void ShowQueuedInfoBarForTab(const PermissionRequestID& id); |
75 | 80 |
76 void ClearPendingInfobarRequestsForTab(const PermissionRequestID& id); | 81 void ClearPendingInfobarRequestsForTab(const PermissionRequestID& id); |
77 | 82 |
78 void RegisterForInfoBarNotifications(InfoBarService* infobar_service); | 83 void RegisterForInfoBarNotifications(InfoBarService* infobar_service); |
79 void UnregisterForInfoBarNotifications(InfoBarService* infobar_service); | 84 void UnregisterForInfoBarNotifications(InfoBarService* infobar_service); |
80 | 85 |
81 void UpdateContentSetting( | |
82 const GURL& requesting_frame, const GURL& embedder, bool allowed); | |
83 | |
84 content::NotificationRegistrar registrar_; | 86 content::NotificationRegistrar registrar_; |
85 | 87 |
86 Profile* const profile_; | 88 Profile* const profile_; |
87 ContentSettingsType type_; | 89 ContentSettingsType type_; |
88 PendingInfobarRequests pending_infobar_requests_; | 90 PendingInfobarRequests pending_infobar_requests_; |
89 bool in_shutdown_; | 91 bool in_shutdown_; |
90 | 92 |
91 DISALLOW_COPY_AND_ASSIGN(PermissionQueueController); | 93 DISALLOW_COPY_AND_ASSIGN(PermissionQueueController); |
92 }; | 94 }; |
93 | 95 |
94 #endif // CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_QUEUE_CONTROLLER_H_ | 96 #endif // CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_QUEUE_CONTROLLER_H_ |
OLD | NEW |