[email protected] | c31d804 | 2014-08-06 16:35:39 | [diff] [blame] | 1 | // Copyright 2012 The Chromium Authors. All rights reserved. |
[email protected] | c476e63 | 2011-06-23 11:18:04 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
[email protected] | 487974a | 2014-06-13 16:49:01 | [diff] [blame] | 5 | #ifndef CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_ |
6 | #define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_ | ||||
[email protected] | c476e63 | 2011-06-23 11:18:04 | [diff] [blame] | 7 | |
[email protected] | 487974a | 2014-06-13 16:49:01 | [diff] [blame] | 8 | #include "base/callback.h" |
avi | 6846aef | 2015-12-26 01:09:38 | [diff] [blame] | 9 | #include "base/macros.h" |
[email protected] | 487974a | 2014-06-13 16:49:01 | [diff] [blame] | 10 | #include "chrome/browser/geolocation/geolocation_permission_context_extensions.h" |
lalitm | ca47d9c4 | 2015-07-08 13:48:14 | [diff] [blame] | 11 | #include "chrome/browser/permissions/permission_context_base.h" |
[email protected] | c476e63 | 2011-06-23 11:18:04 | [diff] [blame] | 12 | |
[email protected] | f068ad0e | 2014-02-11 13:48:23 | [diff] [blame] | 13 | namespace content { |
14 | class WebContents; | ||||
15 | } | ||||
16 | |||||
[email protected] | c0561cc8 | 2013-07-23 09:19:04 | [diff] [blame] | 17 | class PermissionRequestID; |
[email protected] | c476e63 | 2011-06-23 11:18:04 | [diff] [blame] | 18 | class Profile; |
19 | |||||
miguelg | fa05207 | 2014-09-29 15:31:38 | [diff] [blame] | 20 | class GeolocationPermissionContext : public PermissionContextBase { |
[email protected] | c476e63 | 2011-06-23 11:18:04 | [diff] [blame] | 21 | public: |
[email protected] | 487974a | 2014-06-13 16:49:01 | [diff] [blame] | 22 | explicit GeolocationPermissionContext(Profile* profile); |
Daniel Cheng | a542fca | 2014-10-21 09:51:29 | [diff] [blame] | 23 | ~GeolocationPermissionContext() override; |
[email protected] | f068ad0e | 2014-02-11 13:48:23 | [diff] [blame] | 24 | |
kcarattini | 000d0565 | 2015-11-03 19:56:16 | [diff] [blame] | 25 | // In addition to the base class flow the geolocation permission decision |
miguelg | fa05207 | 2014-09-29 15:31:38 | [diff] [blame] | 26 | // checks that it is only code from valid iframes. |
27 | // It also adds special logic when called through an extension. | ||||
kcarattini | 000d0565 | 2015-11-03 19:56:16 | [diff] [blame] | 28 | void DecidePermission(content::WebContents* web_contents, |
29 | const PermissionRequestID& id, | ||||
30 | const GURL& requesting_origin, | ||||
31 | const GURL& embedding_origin, | ||||
benwells | fd2b155 | 2016-07-05 04:26:53 | [diff] [blame] | 32 | bool user_gesture, |
kcarattini | 000d0565 | 2015-11-03 19:56:16 | [diff] [blame] | 33 | const BrowserPermissionCallback& callback) override; |
[email protected] | f068ad0e | 2014-02-11 13:48:23 | [diff] [blame] | 34 | |
miguelg | fa05207 | 2014-09-29 15:31:38 | [diff] [blame] | 35 | // Adds special logic when called through an extension. |
Daniel Cheng | a542fca | 2014-10-21 09:51:29 | [diff] [blame] | 36 | void CancelPermissionRequest(content::WebContents* web_contents, |
37 | const PermissionRequestID& id) override; | ||||
[email protected] | 3ab14c6 | 2012-10-18 01:50:22 | [diff] [blame] | 38 | |
39 | private: | ||||
Daniel Cheng | a542fca | 2014-10-21 09:51:29 | [diff] [blame] | 40 | void UpdateTabContext(const PermissionRequestID& id, |
41 | const GURL& requesting_frame, | ||||
42 | bool allowed) override; | ||||
mlamouri | a31c6ff1 | 2015-06-01 15:40:52 | [diff] [blame] | 43 | bool IsRestrictedToSecureOrigins() const override; |
[email protected] | 1b6a1c2 | 2014-05-27 23:23:14 | [diff] [blame] | 44 | |
miguelg | fa05207 | 2014-09-29 15:31:38 | [diff] [blame] | 45 | // This must only be accessed from the UI thread. |
[email protected] | 487974a | 2014-06-13 16:49:01 | [diff] [blame] | 46 | GeolocationPermissionContextExtensions extensions_context_; |
[email protected] | c476e63 | 2011-06-23 11:18:04 | [diff] [blame] | 47 | |
[email protected] | 487974a | 2014-06-13 16:49:01 | [diff] [blame] | 48 | DISALLOW_COPY_AND_ASSIGN(GeolocationPermissionContext); |
[email protected] | c476e63 | 2011-06-23 11:18:04 | [diff] [blame] | 49 | }; |
50 | |||||
[email protected] | 487974a | 2014-06-13 16:49:01 | [diff] [blame] | 51 | #endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_ |