OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_PUSH_MESSAGING_PUSH_MESSAGING_PERMISSION_CONTEXT_H_ | 5 #ifndef CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_PERMISSION_CONTEXT_H_ |
6 #define CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_PERMISSION_CONTEXT_H_ | 6 #define CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_PERMISSION_CONTEXT_H_ |
7 | 7 |
8 #include "chrome/browser/content_settings/permission_context_base.h" | 8 #include "chrome/browser/content_settings/permission_context_base.h" |
9 | 9 |
10 #include "components/content_settings/core/common/content_settings_types.h" | 10 #include "components/content_settings/core/common/content_settings_types.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 const PermissionRequestID& id) override; | 27 const PermissionRequestID& id) override; |
28 | 28 |
29 protected: | 29 protected: |
30 // PermissionContextBase: | 30 // PermissionContextBase: |
31 void DecidePermission(content::WebContents* web_contents, | 31 void DecidePermission(content::WebContents* web_contents, |
32 const PermissionRequestID& id, | 32 const PermissionRequestID& id, |
33 const GURL& requesting_origin, | 33 const GURL& requesting_origin, |
34 const GURL& embedding_origin, | 34 const GURL& embedding_origin, |
35 bool user_gesture, | 35 bool user_gesture, |
36 const BrowserPermissionCallback& callback) override; | 36 const BrowserPermissionCallback& callback) override; |
| 37 bool RestrictToSecureOrigins() const override; |
37 | 38 |
38 private: | 39 private: |
39 FRIEND_TEST_ALL_PREFIXES(PushMessagingPermissionContextTest, | 40 FRIEND_TEST_ALL_PREFIXES(PushMessagingPermissionContextTest, |
40 DecidePushPermission); | 41 DecidePushPermission); |
41 | 42 |
42 // Used to decide the permission for push, once the permission for | 43 // Used to decide the permission for push, once the permission for |
43 // Notification has been granted/denied. | 44 // Notification has been granted/denied. |
44 void DecidePushPermission(const PermissionRequestID& id, | 45 void DecidePushPermission(const PermissionRequestID& id, |
45 const GURL& requesting_origin, | 46 const GURL& requesting_origin, |
46 const GURL& embedding_origin, | 47 const GURL& embedding_origin, |
47 const BrowserPermissionCallback& callback, | 48 const BrowserPermissionCallback& callback, |
48 ContentSetting notifications_content_setting); | 49 ContentSetting notifications_content_setting); |
49 | 50 |
50 Profile* profile_; | 51 Profile* profile_; |
51 | 52 |
52 // Must be the last member, to ensure that it will be | 53 // Must be the last member, to ensure that it will be |
53 // destroyed first, which will invalidate weak pointers | 54 // destroyed first, which will invalidate weak pointers |
54 base::WeakPtrFactory<PushMessagingPermissionContext> weak_factory_ui_thread_; | 55 base::WeakPtrFactory<PushMessagingPermissionContext> weak_factory_ui_thread_; |
55 | 56 |
56 DISALLOW_COPY_AND_ASSIGN(PushMessagingPermissionContext); | 57 DISALLOW_COPY_AND_ASSIGN(PushMessagingPermissionContext); |
57 }; | 58 }; |
58 | 59 |
59 #endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_PERMISSION_CONTEXT_H_ | 60 #endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_PERMISSION_CONTEXT_H_ |
OLD | NEW |