blob: 61fcd0a1782a8568358fc3d24db693bb759071ef [file] [log] [blame]
[email protected]c31d8042014-08-06 16:35:391// Copyright 2012 The Chromium Authors. All rights reserved.
[email protected]c476e632011-06-23 11:18:042// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]487974a2014-06-13 16:49:015#ifndef CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_
6#define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_
[email protected]c476e632011-06-23 11:18:047
[email protected]487974a2014-06-13 16:49:018#include "base/callback.h"
avi6846aef2015-12-26 01:09:389#include "base/macros.h"
[email protected]487974a2014-06-13 16:49:0110#include "chrome/browser/geolocation/geolocation_permission_context_extensions.h"
lalitmca47d9c42015-07-08 13:48:1411#include "chrome/browser/permissions/permission_context_base.h"
[email protected]c476e632011-06-23 11:18:0412
[email protected]f068ad0e2014-02-11 13:48:2313namespace content {
14class WebContents;
15}
16
[email protected]c0561cc82013-07-23 09:19:0417class PermissionRequestID;
[email protected]c476e632011-06-23 11:18:0418class Profile;
19
miguelgfa052072014-09-29 15:31:3820class GeolocationPermissionContext : public PermissionContextBase {
[email protected]c476e632011-06-23 11:18:0421 public:
[email protected]487974a2014-06-13 16:49:0122 explicit GeolocationPermissionContext(Profile* profile);
Daniel Chenga542fca2014-10-21 09:51:2923 ~GeolocationPermissionContext() override;
[email protected]f068ad0e2014-02-11 13:48:2324
kcarattini000d05652015-11-03 19:56:1625 // In addition to the base class flow the geolocation permission decision
miguelgfa052072014-09-29 15:31:3826 // checks that it is only code from valid iframes.
27 // It also adds special logic when called through an extension.
kcarattini000d05652015-11-03 19:56:1628 void DecidePermission(content::WebContents* web_contents,
29 const PermissionRequestID& id,
30 const GURL& requesting_origin,
31 const GURL& embedding_origin,
benwellsfd2b1552016-07-05 04:26:5332 bool user_gesture,
kcarattini000d05652015-11-03 19:56:1633 const BrowserPermissionCallback& callback) override;
[email protected]f068ad0e2014-02-11 13:48:2334
miguelgfa052072014-09-29 15:31:3835 // Adds special logic when called through an extension.
Daniel Chenga542fca2014-10-21 09:51:2936 void CancelPermissionRequest(content::WebContents* web_contents,
37 const PermissionRequestID& id) override;
[email protected]3ab14c62012-10-18 01:50:2238
39 private:
Daniel Chenga542fca2014-10-21 09:51:2940 void UpdateTabContext(const PermissionRequestID& id,
41 const GURL& requesting_frame,
42 bool allowed) override;
mlamouria31c6ff12015-06-01 15:40:5243 bool IsRestrictedToSecureOrigins() const override;
[email protected]1b6a1c22014-05-27 23:23:1444
miguelgfa052072014-09-29 15:31:3845 // This must only be accessed from the UI thread.
[email protected]487974a2014-06-13 16:49:0146 GeolocationPermissionContextExtensions extensions_context_;
[email protected]c476e632011-06-23 11:18:0447
[email protected]487974a2014-06-13 16:49:0148 DISALLOW_COPY_AND_ASSIGN(GeolocationPermissionContext);
[email protected]c476e632011-06-23 11:18:0449};
50
[email protected]487974a2014-06-13 16:49:0151#endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_