| 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 "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "chrome/browser/permissions/permission_context_base.h" | 10 #include "chrome/browser/permissions/permission_context_base.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 ContentSetting GetPermissionStatus( | 23 ContentSetting GetPermissionStatus( |
| 24 const GURL& requesting_origin, | 24 const GURL& requesting_origin, |
| 25 const GURL& embedding_origin) const override; | 25 const GURL& embedding_origin) const override; |
| 26 | 26 |
| 27 protected: | 27 protected: |
| 28 // PermissionContextBase: | 28 // PermissionContextBase: |
| 29 void DecidePermission(content::WebContents* web_contents, | 29 void DecidePermission(content::WebContents* web_contents, |
| 30 const PermissionRequestID& id, | 30 const PermissionRequestID& id, |
| 31 const GURL& requesting_origin, | 31 const GURL& requesting_origin, |
| 32 const GURL& embedding_origin, | 32 const GURL& embedding_origin, |
| 33 bool user_gesture, |
| 33 const BrowserPermissionCallback& callback) override; | 34 const BrowserPermissionCallback& callback) override; |
| 34 bool IsRestrictedToSecureOrigins() const override; | 35 bool IsRestrictedToSecureOrigins() const override; |
| 35 | 36 |
| 36 private: | 37 private: |
| 37 FRIEND_TEST_ALL_PREFIXES(PushMessagingPermissionContextTest, | 38 FRIEND_TEST_ALL_PREFIXES(PushMessagingPermissionContextTest, |
| 38 DecidePermission); | 39 DecidePermission); |
| 39 FRIEND_TEST_ALL_PREFIXES(PushMessagingPermissionContextTest, | 40 FRIEND_TEST_ALL_PREFIXES(PushMessagingPermissionContextTest, |
| 40 DecidePushPermission); | 41 DecidePushPermission); |
| 41 FRIEND_TEST_ALL_PREFIXES(PushMessagingPermissionContextTest, InsecureOrigin); | 42 FRIEND_TEST_ALL_PREFIXES(PushMessagingPermissionContextTest, InsecureOrigin); |
| 42 | 43 |
| 43 // Used to decide the permission for push, once the permission for | 44 // Used to decide the permission for push, once the permission for |
| 44 // Notification has been granted/denied. | 45 // Notification has been granted/denied. |
| 45 void DecidePushPermission( | 46 void DecidePushPermission( |
| 46 const PermissionRequestID& id, | 47 const PermissionRequestID& id, |
| 47 const GURL& requesting_origin, | 48 const GURL& requesting_origin, |
| 48 const GURL& embedding_origin, | 49 const GURL& embedding_origin, |
| 49 const BrowserPermissionCallback& callback, | 50 const BrowserPermissionCallback& callback, |
| 50 blink::mojom::PermissionStatus notifications_status); | 51 blink::mojom::PermissionStatus notifications_status); |
| 51 | 52 |
| 52 Profile* profile_; | 53 Profile* profile_; |
| 53 | 54 |
| 54 // Must be the last member, to ensure that it will be | 55 // Must be the last member, to ensure that it will be |
| 55 // destroyed first, which will invalidate weak pointers | 56 // destroyed first, which will invalidate weak pointers |
| 56 base::WeakPtrFactory<PushMessagingPermissionContext> weak_factory_ui_thread_; | 57 base::WeakPtrFactory<PushMessagingPermissionContext> weak_factory_ui_thread_; |
| 57 | 58 |
| 58 DISALLOW_COPY_AND_ASSIGN(PushMessagingPermissionContext); | 59 DISALLOW_COPY_AND_ASSIGN(PushMessagingPermissionContext); |
| 59 }; | 60 }; |
| 60 | 61 |
| 61 #endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_PERMISSION_CONTEXT_H_ | 62 #endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_PERMISSION_CONTEXT_H_ |
| OLD | NEW |