diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-24 01:00:35 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-24 01:00:35 +0000 |
commit | 810ddc583119d037972380e6bdecd546fbac9504 (patch) | |
tree | f27c4941c4d220babbae358c75427646787aad20 /content/browser/geolocation | |
parent | ba4b4c2e9c36c60c9dbab427c10021fee0a6197c (diff) | |
download | chromium_src-810ddc583119d037972380e6bdecd546fbac9504.zip chromium_src-810ddc583119d037972380e6bdecd546fbac9504.tar.gz chromium_src-810ddc583119d037972380e6bdecd546fbac9504.tar.bz2 |
Hide geolocation_provider.h from chrome, and move geolocation_permission_context.h to content\public and into the content namespace.
BUG=98716
Review URL: https://chromiumcodereview.appspot.com/9160008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118767 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/geolocation')
3 files changed, 21 insertions, 48 deletions
diff --git a/content/browser/geolocation/geolocation_dispatcher_host.cc b/content/browser/geolocation/geolocation_dispatcher_host.cc index 51f475e..78b7392 100644 --- a/content/browser/geolocation/geolocation_dispatcher_host.cc +++ b/content/browser/geolocation/geolocation_dispatcher_host.cc @@ -9,24 +9,38 @@ #include <utility> #include "base/bind.h" -#include "content/browser/geolocation/geolocation_permission_context.h" #include "content/browser/geolocation/geolocation_provider.h" #include "content/browser/renderer_host/render_message_filter.h" #include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_view_host.h" +#include "content/public/browser/geolocation_permission_context.h" #include "content/common/geolocation_messages.h" #include "content/common/geoposition.h" using content::BrowserThread; +using content::GeolocationPermissionContext; namespace { +void NotifyArbitratorPermissionGranted( + const GURL& requesting_frame) { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); + GeolocationProvider::GetInstance()->OnPermissionGranted(requesting_frame); +} + void SendGeolocationPermissionResponse( - int render_process_id, int render_view_id, int bridge_id, bool allowed) { + const GURL& requesting_frame, int render_process_id, int render_view_id, + int bridge_id, bool allowed) { RenderViewHost* r = RenderViewHost::FromID(render_process_id, render_view_id); if (!r) return; r->Send(new GeolocationMsg_PermissionSet(render_view_id, bridge_id, allowed)); + + if (allowed) { + BrowserThread::PostTask( + BrowserThread::IO, FROM_HERE, + base::Bind(&NotifyArbitratorPermissionGranted, requesting_frame)); + } } class GeolocationDispatcherHostImpl : public GeolocationDispatcherHost, @@ -128,8 +142,8 @@ void GeolocationDispatcherHostImpl::OnRequestPermission( render_process_id_, render_view_id, bridge_id, requesting_frame, base::Bind( - &SendGeolocationPermissionResponse, render_process_id_, - render_view_id, bridge_id)); + &SendGeolocationPermissionResponse, requesting_frame, + render_process_id_, render_view_id, bridge_id)); } void GeolocationDispatcherHostImpl::OnCancelPermissionRequest( diff --git a/content/browser/geolocation/geolocation_dispatcher_host.h b/content/browser/geolocation/geolocation_dispatcher_host.h index acd46d6..bdf6a17 100644 --- a/content/browser/geolocation/geolocation_dispatcher_host.h +++ b/content/browser/geolocation/geolocation_dispatcher_host.h @@ -8,7 +8,9 @@ #include "content/public/browser/browser_message_filter.h" +namespace content { class GeolocationPermissionContext; +} // GeolocationDispatcherHost is a browser filter for Geolocation messages. // It's the complement of GeolocationDispatcher (owned by RenderView). @@ -16,7 +18,7 @@ class GeolocationDispatcherHost : public content::BrowserMessageFilter { public: static GeolocationDispatcherHost* New( int render_process_id, - GeolocationPermissionContext* geolocation_permission_context); + content::GeolocationPermissionContext* geolocation_permission_context); protected: GeolocationDispatcherHost() {} diff --git a/content/browser/geolocation/geolocation_permission_context.h b/content/browser/geolocation/geolocation_permission_context.h deleted file mode 100644 index 848c964..0000000 --- a/content/browser/geolocation/geolocation_permission_context.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_ -#define CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_ -#pragma once - -#include "base/callback.h" -#include "base/memory/ref_counted.h" -#include "content/common/content_export.h" - -class GURL; - -// GeolocationPermissionContext must be implemented by the embedder, to provide -// the policy and logic for the Geolocation permissions flow. -// This includes both prompting the user and persisting results, as required. -class CONTENT_EXPORT GeolocationPermissionContext - : public base::RefCountedThreadSafe<GeolocationPermissionContext> { - public: - // The renderer is requesting permission to use Geolocation. - // When the answer to a permission request has been determined, |callback| - // should be called with the result. - virtual void RequestGeolocationPermission( - int render_process_id, - int render_view_id, - int bridge_id, - const GURL& requesting_frame, - base::Callback<void(bool)> callback) = 0; - - // The renderer is cancelling a pending permission request. - virtual void CancelGeolocationPermissionRequest( - int render_process_id, int render_view_id, int bridge_id, - const GURL& requesting_frame) = 0; - - protected: - virtual ~GeolocationPermissionContext() {} - - private: - friend class base::RefCountedThreadSafe<GeolocationPermissionContext>; -}; - -#endif // CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_ |