blob: d580d08fe7e9c970bf3cee4900d982b3ad973250 [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);
[email protected]487974a2014-06-13 16:49:0122 virtual ~GeolocationPermissionContext();
[email protected]f068ad0e2014-02-11 13:48:2323
[email protected]f068ad0e2014-02-11 13:48:2324
miguelgfa052072014-09-29 15:31:3825 // In addition to the base class flow the geolocation permission request
26 // checks that it is only code from valid iframes.
27 // It also adds special logic when called through an extension.
28 virtual void RequestPermission(content::WebContents* web_contents,
29 const PermissionRequestID& id,
30 const GURL& requesting_frame_origin,
31 bool user_gesture,
32 const BrowserPermissionCallback& callback) OVERRIDE;
[email protected]f068ad0e2014-02-11 13:48:2333
miguelgfa052072014-09-29 15:31:3834 // Adds special logic when called through an extension.
35 virtual void CancelPermissionRequest(content::WebContents* web_contents,
36 const PermissionRequestID& id) OVERRIDE;
[email protected]3ab14c62012-10-18 01:50:2237
38 private:
miguelgfa052072014-09-29 15:31:3839 virtual void UpdateTabContext(const PermissionRequestID& id,
40 const GURL& requesting_frame,
41 bool allowed) 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_