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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_
6 #define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_
8 #include "base/callback.h"
9 #include "chrome/browser/geolocation/geolocation_permission_context_extensions.h"
10 #include "chrome/browser/permissions/permission_context_base.h"
16 class PermissionRequestID
;
19 class GeolocationPermissionContext
: public PermissionContextBase
{
21 explicit GeolocationPermissionContext(Profile
* profile
);
22 ~GeolocationPermissionContext() override
;
24 // 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.
27 void RequestPermission(content::WebContents
* web_contents
,
28 const PermissionRequestID
& id
,
29 const GURL
& requesting_frame_origin
,
31 const BrowserPermissionCallback
& callback
) override
;
33 // Adds special logic when called through an extension.
34 void CancelPermissionRequest(content::WebContents
* web_contents
,
35 const PermissionRequestID
& id
) override
;
38 void UpdateTabContext(const PermissionRequestID
& id
,
39 const GURL
& requesting_frame
,
40 bool allowed
) override
;
41 bool IsRestrictedToSecureOrigins() const override
;
43 // This must only be accessed from the UI thread.
44 GeolocationPermissionContextExtensions extensions_context_
;
46 DISALLOW_COPY_AND_ASSIGN(GeolocationPermissionContext
);
49 #endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_