blob: 41c3e0ea4a42167748d8f69139ef031f60318fcf [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"
miguelgfa052072014-09-29 15:31:389#include "chrome/browser/content_settings/permission_context_base.h"
[email protected]487974a2014-06-13 16:49:0110#include "chrome/browser/geolocation/geolocation_permission_context_extensions.h"
[email protected]c476e632011-06-23 11:18:0411
[email protected]f068ad0e2014-02-11 13:48:2312namespace content {
13class WebContents;
14}
15
[email protected]c0561cc82013-07-23 09:19:0416class PermissionRequestID;
[email protected]c476e632011-06-23 11:18:0417class Profile;
18
miguelgfa052072014-09-29 15:31:3819class GeolocationPermissionContext : public PermissionContextBase {
[email protected]c476e632011-06-23 11:18:0420 public:
[email protected]487974a2014-06-13 16:49:0121 explicit GeolocationPermissionContext(Profile* profile);
Daniel Chenga542fca2014-10-21 09:51:2922 ~GeolocationPermissionContext() override;
[email protected]f068ad0e2014-02-11 13:48:2323
miguelgfa052072014-09-29 15:31:3824 // In addition to the base class flow the geolocation permission request
25 // checks that it is only code from valid iframes.
26 // It also adds special logic when called through an extension.
Daniel Chenga542fca2014-10-21 09:51:2927 void RequestPermission(content::WebContents* web_contents,
28 const PermissionRequestID& id,
29 const GURL& requesting_frame_origin,
30 bool user_gesture,
31 const BrowserPermissionCallback& callback) override;
[email protected]f068ad0e2014-02-11 13:48:2332
miguelgfa052072014-09-29 15:31:3833 // Adds special logic when called through an extension.
Daniel Chenga542fca2014-10-21 09:51:2934 void CancelPermissionRequest(content::WebContents* web_contents,
35 const PermissionRequestID& id) override;
[email protected]3ab14c62012-10-18 01:50:2236
37 private:
Daniel Chenga542fca2014-10-21 09:51:2938 void UpdateTabContext(const PermissionRequestID& id,
39 const GURL& requesting_frame,
40 bool allowed) override;
mlamouria31c6ff12015-06-01 15:40:5241 bool IsRestrictedToSecureOrigins() const override;
[email protected]1b6a1c22014-05-27 23:23:1442
miguelgfa052072014-09-29 15:31:3843 // This must only be accessed from the UI thread.
[email protected]487974a2014-06-13 16:49:0144 GeolocationPermissionContextExtensions extensions_context_;
[email protected]c476e632011-06-23 11:18:0445
[email protected]487974a2014-06-13 16:49:0146 DISALLOW_COPY_AND_ASSIGN(GeolocationPermissionContext);
[email protected]c476e632011-06-23 11:18:0447};
48
[email protected]487974a2014-06-13 16:49:0149#endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_