OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CONTEXT_BASE_H_ | 5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_CONTEXT_BASE_H_ |
6 #define CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_CONTEXT_BASE_H_ | 6 #define CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_CONTEXT_BASE_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/containers/scoped_ptr_hash_map.h" | 9 #include "base/containers/scoped_ptr_hash_map.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "chrome/browser/ui/website_settings/permission_bubble_request.h" | 12 #include "chrome/browser/ui/website_settings/permission_bubble_request.h" |
| 13 #include "components/content_settings/core/common/content_settings.h" |
13 #include "components/content_settings/core/common/content_settings_types.h" | 14 #include "components/content_settings/core/common/content_settings_types.h" |
14 #include "components/keyed_service/core/keyed_service.h" | 15 #include "components/keyed_service/core/keyed_service.h" |
15 #include "url/gurl.h" | 16 #include "url/gurl.h" |
16 | 17 |
17 class PermissionQueueController; | 18 class PermissionQueueController; |
18 class PermissionRequestID; | 19 class PermissionRequestID; |
19 class Profile; | 20 class Profile; |
20 | 21 |
21 namespace content { | 22 namespace content { |
22 class WebContents; | 23 class WebContents; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 57 |
57 // The renderer is requesting permission to push messages. | 58 // The renderer is requesting permission to push messages. |
58 // When the answer to a permission request has been determined, |callback| | 59 // When the answer to a permission request has been determined, |callback| |
59 // should be called with the result. | 60 // should be called with the result. |
60 virtual void RequestPermission(content::WebContents* web_contents, | 61 virtual void RequestPermission(content::WebContents* web_contents, |
61 const PermissionRequestID& id, | 62 const PermissionRequestID& id, |
62 const GURL& requesting_frame, | 63 const GURL& requesting_frame, |
63 bool user_gesture, | 64 bool user_gesture, |
64 const BrowserPermissionCallback& callback); | 65 const BrowserPermissionCallback& callback); |
65 | 66 |
| 67 // Returns whether the permission has been granted, denied... |
| 68 virtual ContentSetting GetPermissionStatus( |
| 69 const GURL& requesting_origin, |
| 70 const GURL& embedding_origin) const; |
| 71 |
66 // Withdraw an existing permission request, no op if the permission request | 72 // Withdraw an existing permission request, no op if the permission request |
67 // was already cancelled by some other means. | 73 // was already cancelled by some other means. |
68 virtual void CancelPermissionRequest(content::WebContents* web_contents, | 74 virtual void CancelPermissionRequest(content::WebContents* web_contents, |
69 const PermissionRequestID& id); | 75 const PermissionRequestID& id); |
70 | 76 |
71 protected: | 77 protected: |
72 // Decide whether the permission should be granted. | 78 // Decide whether the permission should be granted. |
73 // Calls PermissionDecided if permission can be decided non-interactively, | 79 // Calls PermissionDecided if permission can be decided non-interactively, |
74 // or NotifyPermissionSet if permission decided by presenting an infobar. | 80 // or NotifyPermissionSet if permission decided by presenting an infobar. |
75 void DecidePermission(content::WebContents* web_contents, | 81 void DecidePermission(content::WebContents* web_contents, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 scoped_ptr<PermissionQueueController> permission_queue_controller_; | 126 scoped_ptr<PermissionQueueController> permission_queue_controller_; |
121 base::ScopedPtrHashMap<std::string, PermissionBubbleRequest> | 127 base::ScopedPtrHashMap<std::string, PermissionBubbleRequest> |
122 pending_bubbles_; | 128 pending_bubbles_; |
123 | 129 |
124 // Must be the last member, to ensure that it will be | 130 // Must be the last member, to ensure that it will be |
125 // destroyed first, which will invalidate weak pointers | 131 // destroyed first, which will invalidate weak pointers |
126 base::WeakPtrFactory<PermissionContextBase> weak_factory_; | 132 base::WeakPtrFactory<PermissionContextBase> weak_factory_; |
127 }; | 133 }; |
128 | 134 |
129 #endif // CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_CONTEXT_BASE_H_ | 135 #endif // CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_CONTEXT_BASE_H_ |
OLD | NEW |