| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_BACKGROUND_SYNC_BACKGROUND_SYNC_PERMISSION_CONTEXT_H_ | 5 #ifndef CHROME_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_PERMISSION_CONTEXT_H_ |
| 6 #define CHROME_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_PERMISSION_CONTEXT_H_ | 6 #define CHROME_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_PERMISSION_CONTEXT_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "chrome/browser/permissions/permission_context_base.h" | 9 #include "chrome/browser/permissions/permission_context_base.h" |
| 10 | 10 |
| 11 class Profile; | 11 class Profile; |
| 12 | 12 |
| 13 // Manages user permissions for background sync. The context is scoped to the | 13 // Manages user permissions for background sync. The context is scoped to the |
| 14 // requesting origin, which should always be equal to the top-level origin as | 14 // requesting origin, which should always be equal to the top-level origin as |
| 15 // background syncs can only be requested from top-level pages. | 15 // background syncs can only be requested from top-level pages. |
| 16 // The permission status is ALLOW by default and can be changed globally or on a | 16 // The permission status is ALLOW by default and can be changed globally or on a |
| 17 // per-site basis from the content settings page. The user is not prompted for | 17 // per-site basis from the content settings page. The user is not prompted for |
| 18 // permission. | 18 // permission. |
| 19 // TODO(nsatragno): actually implement the UI to allow changing the setting. | 19 // TODO(nsatragno): actually implement the UI to allow changing the setting. |
| 20 class BackgroundSyncPermissionContext : public PermissionContextBase { | 20 class BackgroundSyncPermissionContext : public PermissionContextBase { |
| 21 public: | 21 public: |
| 22 explicit BackgroundSyncPermissionContext(Profile* profile); | 22 explicit BackgroundSyncPermissionContext(Profile* profile); |
| 23 ~BackgroundSyncPermissionContext() override = default; | 23 ~BackgroundSyncPermissionContext() override = default; |
| 24 | 24 |
| 25 // PermissionContextBase: | 25 // PermissionContextBase: |
| 26 void CancelPermissionRequest(content::WebContents* web_contents, | 26 void CancelPermissionRequest(content::WebContents* web_contents, |
| 27 const PermissionRequestID& id) override; | 27 const PermissionRequestID& id) override; |
| 28 bool IsAllowedInWorkers() const override; |
| 28 | 29 |
| 29 private: | 30 private: |
| 30 // PermissionContextBase: | 31 // PermissionContextBase: |
| 31 void DecidePermission(content::WebContents* web_contents, | 32 void DecidePermission(content::WebContents* web_contents, |
| 32 const PermissionRequestID& id, | 33 const PermissionRequestID& id, |
| 33 const GURL& requesting_origin, | 34 const GURL& requesting_origin, |
| 34 const GURL& embedding_origin, | 35 const GURL& embedding_origin, |
| 35 bool user_gesture, | 36 bool user_gesture, |
| 36 const BrowserPermissionCallback& callback) override; | 37 const BrowserPermissionCallback& callback) override; |
| 37 bool IsRestrictedToSecureOrigins() const override; | 38 bool IsRestrictedToSecureOrigins() const override; |
| 38 | 39 |
| 39 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncPermissionContext); | 40 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncPermissionContext); |
| 40 }; | 41 }; |
| 41 | 42 |
| 42 #endif // CHROME_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_PERMISSION_CONTEXT_H_ | 43 #endif // CHROME_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_PERMISSION_CONTEXT_H_ |
| OLD | NEW |