| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_ | 5 #ifndef CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_ |
| 6 #define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_ | 6 #define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "chrome/browser/geolocation/geolocation_permission_context_extensions.h
" | 10 #include "chrome/browser/geolocation/geolocation_permission_context_extensions.h
" |
| 11 #include "chrome/browser/permissions/permission_context_base.h" | 11 #include "chrome/browser/permissions/permission_context_base.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 class WebContents; | 14 class WebContents; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace url { |
| 18 class Origin; |
| 19 } |
| 20 |
| 17 class PermissionRequestID; | 21 class PermissionRequestID; |
| 18 class Profile; | 22 class Profile; |
| 19 | 23 |
| 20 class GeolocationPermissionContext : public PermissionContextBase { | 24 class GeolocationPermissionContext : public PermissionContextBase { |
| 21 public: | 25 public: |
| 22 explicit GeolocationPermissionContext(Profile* profile); | 26 explicit GeolocationPermissionContext(Profile* profile); |
| 23 ~GeolocationPermissionContext() override; | 27 ~GeolocationPermissionContext() override; |
| 24 | 28 |
| 25 // In addition to the base class flow the geolocation permission decision | 29 // In addition to the base class flow the geolocation permission decision |
| 26 // checks that it is only code from valid iframes. | 30 // checks that it is only code from valid iframes. |
| 27 // It also adds special logic when called through an extension. | 31 // It also adds special logic when called through an extension. |
| 28 void DecidePermission(content::WebContents* web_contents, | 32 void DecidePermission(content::WebContents* web_contents, |
| 29 const PermissionRequestID& id, | 33 const PermissionRequestID& id, |
| 30 const GURL& requesting_origin, | 34 const url::Origin& requesting_origin, |
| 31 const GURL& embedding_origin, | 35 const url::Origin& embedding_origin, |
| 32 const BrowserPermissionCallback& callback) override; | 36 const BrowserPermissionCallback& callback) override; |
| 33 | 37 |
| 34 // Adds special logic when called through an extension. | 38 // Adds special logic when called through an extension. |
| 35 void CancelPermissionRequest(content::WebContents* web_contents, | 39 void CancelPermissionRequest(content::WebContents* web_contents, |
| 36 const PermissionRequestID& id) override; | 40 const PermissionRequestID& id) override; |
| 37 | 41 |
| 38 private: | 42 private: |
| 39 void UpdateTabContext(const PermissionRequestID& id, | 43 void UpdateTabContext(const PermissionRequestID& id, |
| 40 const GURL& requesting_frame, | 44 const url::Origin& requesting_frame, |
| 41 bool allowed) override; | 45 bool allowed) override; |
| 42 bool IsRestrictedToSecureOrigins() const override; | 46 bool IsRestrictedToSecureOrigins() const override; |
| 43 | 47 |
| 44 // This must only be accessed from the UI thread. | 48 // This must only be accessed from the UI thread. |
| 45 GeolocationPermissionContextExtensions extensions_context_; | 49 GeolocationPermissionContextExtensions extensions_context_; |
| 46 | 50 |
| 47 DISALLOW_COPY_AND_ASSIGN(GeolocationPermissionContext); | 51 DISALLOW_COPY_AND_ASSIGN(GeolocationPermissionContext); |
| 48 }; | 52 }; |
| 49 | 53 |
| 50 #endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_ | 54 #endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_ |
| OLD | NEW |