diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-30 00:49:21 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-30 00:49:21 +0000 |
commit | 138d966ceb995253ec3d7e2f06640d864d9fe635 (patch) | |
tree | 2c62876f104be4a287ab5914e36704c75966b32c /content/browser/geolocation | |
parent | 21b3a6ae029799f140f08c0b2a47d3737e8f1f17 (diff) | |
download | chromium_src-138d966ceb995253ec3d7e2f06640d864d9fe635.zip chromium_src-138d966ceb995253ec3d7e2f06640d864d9fe635.tar.gz chromium_src-138d966ceb995253ec3d7e2f06640d864d9fe635.tar.bz2 |
Hide geolocation_messages.h from chrome. It was only used in a test. Instead of having the GeolocationPermissionContext implementation have to call a static method in the interface, give it a callback when requesting permission. That way in tests we can just give a different callback. Also removed two trivial includes in this change.
BUG=98716
Review URL: http://codereview.chromium.org/8662041
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112085 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/geolocation')
3 files changed, 24 insertions, 43 deletions
diff --git a/content/browser/geolocation/geolocation_dispatcher_host.cc b/content/browser/geolocation/geolocation_dispatcher_host.cc index af23aea..51f475e 100644 --- a/content/browser/geolocation/geolocation_dispatcher_host.cc +++ b/content/browser/geolocation/geolocation_dispatcher_host.cc @@ -8,6 +8,7 @@ #include <set> #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" @@ -19,6 +20,15 @@ using content::BrowserThread; namespace { + +void SendGeolocationPermissionResponse( + 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)); +} + class GeolocationDispatcherHostImpl : public GeolocationDispatcherHost, public GeolocationObserver { public: @@ -116,7 +126,10 @@ void GeolocationDispatcherHostImpl::OnRequestPermission( << render_view_id << ":" << bridge_id; geolocation_permission_context_->RequestGeolocationPermission( render_process_id_, render_view_id, bridge_id, - requesting_frame); + requesting_frame, + base::Bind( + &SendGeolocationPermissionResponse, render_process_id_, + render_view_id, bridge_id)); } void GeolocationDispatcherHostImpl::OnCancelPermissionRequest( diff --git a/content/browser/geolocation/geolocation_permission_context.cc b/content/browser/geolocation/geolocation_permission_context.cc deleted file mode 100644 index dd92515..0000000 --- a/content/browser/geolocation/geolocation_permission_context.cc +++ /dev/null @@ -1,23 +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. - -#include "content/browser/geolocation/geolocation_permission_context.h" - -#include "content/browser/renderer_host/render_view_host.h" -#include "content/common/geolocation_messages.h" - -// static -void GeolocationPermissionContext::SetGeolocationPermissionResponse( - int render_process_id, int render_view_id, int bridge_id, bool is_allowed) { - RenderViewHost* r = RenderViewHost::FromID(render_process_id, render_view_id); - if (r) { - r->Send(new GeolocationMsg_PermissionSet(render_view_id, bridge_id, - is_allowed)); - } -} - -GeolocationPermissionContext::GeolocationPermissionContext() {} - -GeolocationPermissionContext::~GeolocationPermissionContext() {} - diff --git a/content/browser/geolocation/geolocation_permission_context.h b/content/browser/geolocation/geolocation_permission_context.h index ddbade7..848c964 100644 --- a/content/browser/geolocation/geolocation_permission_context.h +++ b/content/browser/geolocation/geolocation_permission_context.h @@ -6,7 +6,7 @@ #define CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_ #pragma once -#include "base/basictypes.h" +#include "base/callback.h" #include "base/memory/ref_counted.h" #include "content/common/content_export.h" @@ -19,34 +19,25 @@ 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, the result - // should be forwarded to the renderer via SetGeolocationPermissionResponse(). - virtual void RequestGeolocationPermission(int render_process_id, - int render_view_id, - int bridge_id, - const GURL& requesting_frame) = 0; + // 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; - // The embedder must callback to this method when the outcome of a previous - // geolocation request (indicated via RequestGeolocationPermission above) has - // been determined. - static void SetGeolocationPermissionResponse(int render_process_id, - int render_view_id, - int bridge_id, - bool is_allowed); - protected: - GeolocationPermissionContext(); - virtual ~GeolocationPermissionContext(); + virtual ~GeolocationPermissionContext() {} private: friend class base::RefCountedThreadSafe<GeolocationPermissionContext>; - - DISALLOW_COPY_AND_ASSIGN(GeolocationPermissionContext); }; #endif // CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_ |