summaryrefslogtreecommitdiffstats
path: root/content/browser
diff options
context:
space:
mode:
authorbartfab@chromium.org <bartfab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-20 12:42:49 +0000
committerbartfab@chromium.org <bartfab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-20 12:42:49 +0000
commita980b054825712a4aca6e80a432082bb6bb1d443 (patch)
treeb4790d91655e248fc3149155ba10ce4a8678ab28 /content/browser
parent634b12e8b3184734f51593df47d775d8c591fdde (diff)
downloadchromium_src-a980b054825712a4aca6e80a432082bb6bb1d443.zip
chromium_src-a980b054825712a4aca6e80a432082bb6bb1d443.tar.gz
chromium_src-a980b054825712a4aca6e80a432082bb6bb1d443.tar.bz2
Remove requesting_frame parameters from Geolocation stack
This CL removes requesting_frame parameters from the Geolocation stack because the URL passed around in these is no longer used for anything. BUG=123815 TEST=unit_tests, browser_tests *Geolocation* Review URL: http://codereview.chromium.org/10107017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133183 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser')
-rw-r--r--content/browser/geolocation/geolocation_dispatcher_host.cc16
-rw-r--r--content/browser/geolocation/geolocation_provider.cc21
-rw-r--r--content/browser/geolocation/geolocation_provider.h9
-rw-r--r--content/browser/geolocation/geolocation_provider_unittest.cc4
-rw-r--r--content/browser/geolocation/gps_location_provider_linux.cc4
-rw-r--r--content/browser/geolocation/gps_location_provider_linux.h3
-rw-r--r--content/browser/geolocation/location_arbitrator.cc19
-rw-r--r--content/browser/geolocation/location_arbitrator.h8
-rw-r--r--content/browser/geolocation/location_arbitrator_unittest.cc13
-rw-r--r--content/browser/geolocation/location_provider.h4
-rw-r--r--content/browser/geolocation/mock_location_provider.cc11
-rw-r--r--content/browser/geolocation/mock_location_provider.h7
-rw-r--r--content/browser/geolocation/network_location_provider.cc18
-rw-r--r--content/browser/geolocation/network_location_provider.h10
-rw-r--r--content/browser/geolocation/network_location_provider_unittest.cc10
-rw-r--r--content/browser/geolocation/network_location_request.cc4
-rw-r--r--content/browser/geolocation/network_location_request.h7
-rw-r--r--content/browser/geolocation/win7_location_provider_win.cc4
-rw-r--r--content/browser/geolocation/win7_location_provider_win.h3
19 files changed, 74 insertions, 101 deletions
diff --git a/content/browser/geolocation/geolocation_dispatcher_host.cc b/content/browser/geolocation/geolocation_dispatcher_host.cc
index 63d8099..5ee8af0 100644
--- a/content/browser/geolocation/geolocation_dispatcher_host.cc
+++ b/content/browser/geolocation/geolocation_dispatcher_host.cc
@@ -23,15 +23,15 @@ using content::RenderViewHostImpl;
namespace {
-void NotifyArbitratorPermissionGranted(
- const GURL& requesting_frame) {
+void NotifyArbitratorPermissionGranted() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- GeolocationProvider::GetInstance()->OnPermissionGranted(requesting_frame);
+ GeolocationProvider::GetInstance()->OnPermissionGranted();
}
-void SendGeolocationPermissionResponse(
- const GURL& requesting_frame, int render_process_id, int render_view_id,
- int bridge_id, bool allowed) {
+void SendGeolocationPermissionResponse(int render_process_id,
+ int render_view_id,
+ int bridge_id,
+ bool allowed) {
RenderViewHostImpl* r = RenderViewHostImpl::FromID(
render_process_id, render_view_id);
if (!r)
@@ -41,7 +41,7 @@ void SendGeolocationPermissionResponse(
if (allowed) {
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
- base::Bind(&NotifyArbitratorPermissionGranted, requesting_frame));
+ base::Bind(&NotifyArbitratorPermissionGranted));
}
}
@@ -144,7 +144,7 @@ void GeolocationDispatcherHostImpl::OnRequestPermission(
render_process_id_, render_view_id, bridge_id,
requesting_frame,
base::Bind(
- &SendGeolocationPermissionResponse, requesting_frame,
+ &SendGeolocationPermissionResponse,
render_process_id_, render_view_id, bridge_id));
}
diff --git a/content/browser/geolocation/geolocation_provider.cc b/content/browser/geolocation/geolocation_provider.cc
index 8090ddf..e090ac9 100644
--- a/content/browser/geolocation/geolocation_provider.cc
+++ b/content/browser/geolocation/geolocation_provider.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -17,6 +17,7 @@ GeolocationProvider* GeolocationProvider::GetInstance() {
GeolocationProvider::GeolocationProvider()
: base::Thread("Geolocation"),
client_loop_(base::MessageLoopProxy::current()),
+ is_permission_granted_(false),
arbitrator_(NULL) {
}
@@ -53,7 +54,7 @@ void GeolocationProvider::OnObserversChanged() {
if (!IsRunning()) {
Start();
if (HasPermissionBeenGranted())
- InformProvidersPermissionGranted(most_recent_authorized_frame_);
+ InformProvidersPermissionGranted();
}
// The high accuracy requirement may have changed.
@@ -91,27 +92,25 @@ void GeolocationProvider::StopProviders() {
arbitrator_->StopProviders();
}
-void GeolocationProvider::OnPermissionGranted(const GURL& requesting_frame) {
+void GeolocationProvider::OnPermissionGranted() {
DCHECK(OnClientThread());
- most_recent_authorized_frame_ = requesting_frame;
+ is_permission_granted_ = true;
if (IsRunning())
- InformProvidersPermissionGranted(requesting_frame);
+ InformProvidersPermissionGranted();
}
-void GeolocationProvider::InformProvidersPermissionGranted(
- const GURL& requesting_frame) {
+void GeolocationProvider::InformProvidersPermissionGranted() {
DCHECK(IsRunning());
- DCHECK(requesting_frame.is_valid());
if (!OnGeolocationThread()) {
message_loop()->PostTask(
FROM_HERE,
base::Bind(&GeolocationProvider::InformProvidersPermissionGranted,
- base::Unretained(this), requesting_frame));
+ base::Unretained(this)));
return;
}
DCHECK(OnGeolocationThread());
DCHECK(arbitrator_);
- arbitrator_->OnPermissionGranted(requesting_frame);
+ arbitrator_->OnPermissionGranted();
}
void GeolocationProvider::Init() {
@@ -136,7 +135,7 @@ void GeolocationProvider::OnLocationUpdate(const Geoposition& position) {
bool GeolocationProvider::HasPermissionBeenGranted() const {
DCHECK(OnClientThread());
- return most_recent_authorized_frame_.is_valid();
+ return is_permission_granted_;
}
bool GeolocationProvider::OnClientThread() const {
diff --git a/content/browser/geolocation/geolocation_provider.h b/content/browser/geolocation/geolocation_provider.h
index b627b1e..a45a365 100644
--- a/content/browser/geolocation/geolocation_provider.h
+++ b/content/browser/geolocation/geolocation_provider.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -12,7 +12,6 @@
#include "content/browser/geolocation/geolocation_observer.h"
#include "content/common/content_export.h"
#include "content/common/geoposition.h"
-#include "googleurl/src/gurl.h"
class GeolocationArbitrator;
@@ -43,7 +42,7 @@ class CONTENT_EXPORT GeolocationProvider
// via AddObserver(). Returns true if the observer was removed.
bool RemoveObserver(GeolocationObserver* delegate);
- void OnPermissionGranted(const GURL& requesting_frame);
+ void OnPermissionGranted();
bool HasPermissionBeenGranted() const;
// GeolocationObserver
@@ -77,7 +76,7 @@ class CONTENT_EXPORT GeolocationProvider
void StartProviders(const GeolocationObserverOptions& options);
// Update the providers on the geolocation thread, which must be running.
- void InformProvidersPermissionGranted(const GURL& requesting_frame);
+ void InformProvidersPermissionGranted();
// Notifies observers when a new position fix is available.
void NotifyObservers(const Geoposition& position);
@@ -90,7 +89,7 @@ class CONTENT_EXPORT GeolocationProvider
// Only used on client thread
ObserverMap observers_;
- GURL most_recent_authorized_frame_;
+ bool is_permission_granted_;
Geoposition position_;
// Only to be used on the geolocation thread.
diff --git a/content/browser/geolocation/geolocation_provider_unittest.cc b/content/browser/geolocation/geolocation_provider_unittest.cc
index b214f01..1b131e9 100644
--- a/content/browser/geolocation/geolocation_provider_unittest.cc
+++ b/content/browser/geolocation/geolocation_provider_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -61,7 +61,7 @@ class GeolocationProviderTest : public testing::Test {
// Regression test for http://crbug.com/59377
TEST_F(GeolocationProviderTest, OnPermissionGrantedWithoutObservers) {
EXPECT_FALSE(provider_->HasPermissionBeenGranted());
- provider_->OnPermissionGranted(GURL("http://example.com"));
+ provider_->OnPermissionGranted();
EXPECT_TRUE(provider_->HasPermissionBeenGranted());
}
diff --git a/content/browser/geolocation/gps_location_provider_linux.cc b/content/browser/geolocation/gps_location_provider_linux.cc
index 1c00d69..e5103fa 100644
--- a/content/browser/geolocation/gps_location_provider_linux.cc
+++ b/content/browser/geolocation/gps_location_provider_linux.cc
@@ -91,10 +91,6 @@ void GpsLocationProviderLinux::UpdatePosition() {
ScheduleNextGpsPoll(0);
}
-void GpsLocationProviderLinux::OnPermissionGranted(
- const GURL& requesting_frame) {
-}
-
void GpsLocationProviderLinux::DoGpsPollTask() {
if (!gps_->Start()) {
DLOG(WARNING) << "Couldn't start GPS provider.";
diff --git a/content/browser/geolocation/gps_location_provider_linux.h b/content/browser/geolocation/gps_location_provider_linux.h
index 472d0a5..c004e06 100644
--- a/content/browser/geolocation/gps_location_provider_linux.h
+++ b/content/browser/geolocation/gps_location_provider_linux.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -48,7 +48,6 @@ class CONTENT_EXPORT GpsLocationProviderLinux : public LocationProviderBase {
virtual void StopProvider() OVERRIDE;
virtual void GetPosition(Geoposition* position) OVERRIDE;
virtual void UpdatePosition() OVERRIDE;
- virtual void OnPermissionGranted(const GURL& requesting_frame) OVERRIDE;
private:
// Task which run in the child thread.
diff --git a/content/browser/geolocation/location_arbitrator.cc b/content/browser/geolocation/location_arbitrator.cc
index 4927a04c..5ae3e38 100644
--- a/content/browser/geolocation/location_arbitrator.cc
+++ b/content/browser/geolocation/location_arbitrator.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -10,6 +10,7 @@
#include "base/bind_helpers.h"
#include "content/browser/geolocation/arbitrator_dependency_factory.h"
#include "content/public/browser/access_token_store.h"
+#include "googleurl/src/gurl.h"
using content::AccessTokenStore;
@@ -32,7 +33,8 @@ GeolocationArbitrator::GeolocationArbitrator(
access_token_store_(dependency_factory->NewAccessTokenStore()),
get_time_now_(dependency_factory->GetTimeFunction()),
observer_(observer),
- position_provider_(NULL) {
+ position_provider_(NULL),
+ is_permission_granted_(false) {
}
@@ -51,12 +53,11 @@ GeolocationArbitrator* GeolocationArbitrator::Create(
return arbitrator;
}
-void GeolocationArbitrator::OnPermissionGranted(
- const GURL& requesting_frame) {
- most_recent_authorized_frame_ = requesting_frame;
+void GeolocationArbitrator::OnPermissionGranted() {
+ is_permission_granted_ = true;
for (ScopedVector<LocationProviderBase>::iterator i = providers_.begin();
i != providers_.end(); ++i) {
- (*i)->OnPermissionGranted(requesting_frame);
+ (*i)->OnPermissionGranted();
}
}
@@ -113,8 +114,8 @@ void GeolocationArbitrator::RegisterProvider(
if (!provider)
return;
provider->RegisterListener(this);
- if (most_recent_authorized_frame_.is_valid())
- provider->OnPermissionGranted(most_recent_authorized_frame_);
+ if (is_permission_granted_)
+ provider->OnPermissionGranted();
providers_->push_back(provider);
}
@@ -159,7 +160,7 @@ bool GeolocationArbitrator::IsNewPositionBetter(
}
bool GeolocationArbitrator::HasPermissionBeenGranted() const {
- return most_recent_authorized_frame_.is_valid();
+ return is_permission_granted_;
}
void GeolocationArbitrator::SetDependencyFactoryForTest(
diff --git a/content/browser/geolocation/location_arbitrator.h b/content/browser/geolocation/location_arbitrator.h
index bf9efe0..cbecf64 100644
--- a/content/browser/geolocation/location_arbitrator.h
+++ b/content/browser/geolocation/location_arbitrator.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -14,11 +14,9 @@
#include "content/common/content_export.h"
#include "content/common/geoposition.h"
#include "content/public/browser/access_token_store.h"
-#include "googleurl/src/gurl.h"
#include "net/url_request/url_request_context_getter.h"
class GeolocationArbitratorDependencyFactory;
-class GURL;
class LocationProviderBase;
namespace content {
@@ -58,7 +56,7 @@ class CONTENT_EXPORT GeolocationArbitrator
// infobar prompt) or inferred from a persisted site permission.
// The arbitrator will inform all providers of this, which may in turn use
// this information to modify their internal policy.
- void OnPermissionGranted(const GURL& requesting_frame);
+ void OnPermissionGranted();
// Returns true if this arbitrator has received at least one call to
// OnPermissionGranted().
@@ -98,7 +96,7 @@ class CONTENT_EXPORT GeolocationArbitrator
GeolocationObserverOptions current_provider_options_;
// The provider which supplied the current |position_|
const LocationProviderBase* position_provider_;
- GURL most_recent_authorized_frame_;
+ bool is_permission_granted_;
// The current best estimate of our position.
Geoposition position_;
diff --git a/content/browser/geolocation/location_arbitrator_unittest.cc b/content/browser/geolocation/location_arbitrator_unittest.cc
index a78875b..ab7d7ea 100644
--- a/content/browser/geolocation/location_arbitrator_unittest.cc
+++ b/content/browser/geolocation/location_arbitrator_unittest.cc
@@ -155,7 +155,7 @@ TEST_F(GeolocationLocationArbitratorTest, CreateDestroy) {
TEST_F(GeolocationLocationArbitratorTest, OnPermissionGranted) {
EXPECT_FALSE(arbitrator_->HasPermissionBeenGranted());
- arbitrator_->OnPermissionGranted(GURL("http://frame.test"));
+ arbitrator_->OnPermissionGranted();
EXPECT_TRUE(arbitrator_->HasPermissionBeenGranted());
// Can't check the provider has been notified without going through the
// motions to create the provider (see next test).
@@ -188,16 +188,11 @@ TEST_F(GeolocationLocationArbitratorTest, NormalUsage) {
EXPECT_EQ(cell()->position_.latitude,
observer_->last_position_.latitude);
- EXPECT_FALSE(
- cell()->permission_granted_url_.is_valid());
+ EXPECT_FALSE(cell()->is_permission_granted_);
EXPECT_FALSE(arbitrator_->HasPermissionBeenGranted());
- GURL frame_url("http://frame.test");
- arbitrator_->OnPermissionGranted(frame_url);
+ arbitrator_->OnPermissionGranted();
EXPECT_TRUE(arbitrator_->HasPermissionBeenGranted());
- EXPECT_TRUE(
- cell()->permission_granted_url_.is_valid());
- EXPECT_EQ(frame_url,
- cell()->permission_granted_url_);
+ EXPECT_TRUE(cell()->is_permission_granted_);
}
TEST_F(GeolocationLocationArbitratorTest, SetObserverOptions) {
diff --git a/content/browser/geolocation/location_provider.h b/content/browser/geolocation/location_provider.h
index f0f666c..1d845b6 100644
--- a/content/browser/geolocation/location_provider.h
+++ b/content/browser/geolocation/location_provider.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -75,7 +75,7 @@ class CONTENT_EXPORT LocationProviderBase
virtual void UpdatePosition() {}
// Delegated to the provider by GeolocationArbitrator. See the corresponding
// method on that class for more details.
- virtual void OnPermissionGranted(const GURL& requesting_frame) {}
+ virtual void OnPermissionGranted() {}
bool has_listeners() const;
diff --git a/content/browser/geolocation/mock_location_provider.cc b/content/browser/geolocation/mock_location_provider.cc
index 29b7058..fc9abd3 100644
--- a/content/browser/geolocation/mock_location_provider.cc
+++ b/content/browser/geolocation/mock_location_provider.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -19,6 +19,7 @@ MockLocationProvider* MockLocationProvider::instance_ = NULL;
MockLocationProvider::MockLocationProvider(MockLocationProvider** self_ref)
: state_(STOPPED),
+ is_permission_granted_(false),
self_ref_(self_ref),
provider_loop_(base::MessageLoopProxy::current()) {
CHECK(self_ref_);
@@ -58,8 +59,8 @@ void MockLocationProvider::GetPosition(Geoposition* position) {
*position = position_;
}
-void MockLocationProvider::OnPermissionGranted(const GURL& requesting_frame) {
- permission_granted_url_ = requesting_frame;
+void MockLocationProvider::OnPermissionGranted() {
+ is_permission_granted_ = true;
}
// Mock location provider that automatically calls back its client at most
@@ -92,8 +93,8 @@ class AutoMockLocationProvider : public MockLocationProvider {
return true;
}
- void OnPermissionGranted(const GURL& requesting_frame) {
- MockLocationProvider::OnPermissionGranted(requesting_frame);
+ void OnPermissionGranted() {
+ MockLocationProvider::OnPermissionGranted();
if (requires_permission_to_start_) {
UpdateListenersIfNeeded();
}
diff --git a/content/browser/geolocation/mock_location_provider.h b/content/browser/geolocation/mock_location_provider.h
index b375a53..69411c3 100644
--- a/content/browser/geolocation/mock_location_provider.h
+++ b/content/browser/geolocation/mock_location_provider.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -12,7 +12,6 @@
#include "base/threading/thread.h"
#include "content/browser/geolocation/location_provider.h"
#include "content/common/geoposition.h"
-#include "googleurl/src/gurl.h"
// Mock implementation of a location provider for testing.
class MockLocationProvider : public LocationProviderBase {
@@ -29,11 +28,11 @@ class MockLocationProvider : public LocationProviderBase {
virtual bool StartProvider(bool high_accuracy) OVERRIDE;
virtual void StopProvider() OVERRIDE;
virtual void GetPosition(Geoposition* position) OVERRIDE;
- virtual void OnPermissionGranted(const GURL& requesting_frame) OVERRIDE;
+ virtual void OnPermissionGranted() OVERRIDE;
Geoposition position_;
enum State { STOPPED, LOW_ACCURACY, HIGH_ACCURACY } state_;
- GURL permission_granted_url_;
+ bool is_permission_granted_;
MockLocationProvider** self_ref_;
scoped_refptr<base::MessageLoopProxy> provider_loop_;
diff --git a/content/browser/geolocation/network_location_provider.cc b/content/browser/geolocation/network_location_provider.cc
index aebbf08..5312aaf 100644
--- a/content/browser/geolocation/network_location_provider.cc
+++ b/content/browser/geolocation/network_location_provider.cc
@@ -116,6 +116,7 @@ NetworkLocationProvider::NetworkLocationProvider(
is_radio_data_complete_(false),
is_wifi_data_complete_(false),
access_token_(access_token),
+ is_permission_granted_(false),
is_new_data_available_(false),
ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
// Create the position cache.
@@ -144,12 +145,10 @@ void NetworkLocationProvider::UpdatePosition() {
}
}
-void NetworkLocationProvider::OnPermissionGranted(
- const GURL& requesting_frame) {
- const bool host_was_empty = most_recent_authorized_host_.empty();
- most_recent_authorized_host_ = requesting_frame.host();
- if (host_was_empty && !most_recent_authorized_host_.empty()
- && IsStarted()) {
+void NetworkLocationProvider::OnPermissionGranted() {
+ const bool was_permission_granted = is_permission_granted_;
+ is_permission_granted_ = true;
+ if (!was_permission_granted && IsStarted()) {
UpdatePosition();
}
}
@@ -257,7 +256,7 @@ void NetworkLocationProvider::RequestPosition() {
return;
}
// Don't send network requests until authorized. http://crbug.com/39171
- if (most_recent_authorized_host_.empty())
+ if (!is_permission_granted_)
return;
weak_factory_.InvalidateWeakPtrs();
@@ -270,10 +269,7 @@ void NetworkLocationProvider::RequestPosition() {
"with new data. Wifi APs: "
<< wifi_data_.access_point_data.size();
}
- // The hostname sent in the request is just to give a first-order
- // approximation of usage. We do not need to guarantee that this network
- // request was triggered by an API call from this specific host.
- request_->MakeRequest(most_recent_authorized_host_, access_token_,
+ request_->MakeRequest(access_token_,
radio_data_, wifi_data_,
device_data_updated_timestamp_);
}
diff --git a/content/browser/geolocation/network_location_provider.h b/content/browser/geolocation/network_location_provider.h
index 787adb6..03ae8fa 100644
--- a/content/browser/geolocation/network_location_provider.h
+++ b/content/browser/geolocation/network_location_provider.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -7,7 +7,6 @@
#pragma once
#include <list>
-#include <string>
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
@@ -79,7 +78,7 @@ class NetworkLocationProvider
virtual void StopProvider() OVERRIDE;
virtual void GetPosition(Geoposition *position) OVERRIDE;
virtual void UpdatePosition() OVERRIDE;
- virtual void OnPermissionGranted(const GURL& requesting_frame) OVERRIDE;
+ virtual void OnPermissionGranted() OVERRIDE;
private:
// Satisfies a position request from cache or network.
@@ -123,9 +122,10 @@ class NetworkLocationProvider
// The current best position estimate.
Geoposition position_;
- bool is_new_data_available_;
+ // Whether permission has been granted for the provider to operate.
+ bool is_permission_granted_;
- std::string most_recent_authorized_host_;
+ bool is_new_data_available_;
// The network location request object, and the url it uses.
scoped_ptr<NetworkLocationRequest> request_;
diff --git a/content/browser/geolocation/network_location_provider_unittest.cc b/content/browser/geolocation/network_location_provider_unittest.cc
index ae75a73..a98b747 100644
--- a/content/browser/geolocation/network_location_provider_unittest.cc
+++ b/content/browser/geolocation/network_location_provider_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -21,8 +21,6 @@ namespace {
// Constants used in multiple tests.
const char kTestServerUrl[] = "https://www.geolocation.test/service";
-const char kTestHost[] = "myclienthost.test";
-const char kTestHostUrl[] = "http://myclienthost.test/some/path";
const char kTestJson[] = "?browser=chromium&sensor=true";
const char kTestBrowser[] = "browser=chromium";
const char kTestSensor[] = "sensor=true";
@@ -141,7 +139,7 @@ class GeolocationNetworkProviderTest : public testing::Test {
test_server_url_,
access_token_store_->access_token_set_[test_server_url_]);
if (set_permission_granted)
- provider->OnPermissionGranted(GURL(kTestHostUrl));
+ provider->OnPermissionGranted();
return provider;
}
@@ -497,7 +495,7 @@ TEST_F(GeolocationNetworkProviderTest, NetworkRequestDeferredForPermission) {
EXPECT_TRUE(provider->StartProvider(false));
TestURLFetcher* fetcher = get_url_fetcher_and_advance_id();
EXPECT_FALSE(fetcher);
- provider->OnPermissionGranted(GURL(kTestHostUrl));
+ provider->OnPermissionGranted();
fetcher = get_url_fetcher_and_advance_id();
ASSERT_TRUE(fetcher != NULL);
@@ -522,7 +520,7 @@ TEST_F(GeolocationNetworkProviderTest,
fetcher = get_url_fetcher_and_advance_id();
EXPECT_FALSE(fetcher);
- provider->OnPermissionGranted(GURL(kTestHostUrl));
+ provider->OnPermissionGranted();
fetcher = get_url_fetcher_and_advance_id();
ASSERT_TRUE(fetcher != NULL);
diff --git a/content/browser/geolocation/network_location_request.cc b/content/browser/geolocation/network_location_request.cc
index 8bb6846..c8702b2 100644
--- a/content/browser/geolocation/network_location_request.cc
+++ b/content/browser/geolocation/network_location_request.cc
@@ -5,6 +5,7 @@
#include "content/browser/geolocation/network_location_request.h"
#include <set>
+#include <string>
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
@@ -72,8 +73,7 @@ NetworkLocationRequest::NetworkLocationRequest(
NetworkLocationRequest::~NetworkLocationRequest() {
}
-bool NetworkLocationRequest::MakeRequest(const std::string& host_name,
- const string16& access_token,
+bool NetworkLocationRequest::MakeRequest(const string16& access_token,
const RadioData& radio_data,
const WifiData& wifi_data,
const base::Time& timestamp) {
diff --git a/content/browser/geolocation/network_location_request.h b/content/browser/geolocation/network_location_request.h
index b74b544..52d7905 100644
--- a/content/browser/geolocation/network_location_request.h
+++ b/content/browser/geolocation/network_location_request.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -6,8 +6,6 @@
#define CONTENT_BROWSER_GEOLOCATION_NETWORK_LOCATION_REQUEST_H_
#pragma once
-#include <string>
-
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
@@ -53,8 +51,7 @@ class NetworkLocationRequest : private content::URLFetcherDelegate {
// Makes a new request. Returns true if the new request was successfully
// started. In all cases, any currently pending request will be canceled.
- bool MakeRequest(const std::string& host,
- const string16& access_token,
+ bool MakeRequest(const string16& access_token,
const RadioData& radio_data,
const WifiData& wifi_data,
const base::Time& timestamp);
diff --git a/content/browser/geolocation/win7_location_provider_win.cc b/content/browser/geolocation/win7_location_provider_win.cc
index 927c053..cfcf3f3 100644
--- a/content/browser/geolocation/win7_location_provider_win.cc
+++ b/content/browser/geolocation/win7_location_provider_win.cc
@@ -75,10 +75,6 @@ void Win7LocationProvider::UpdatePosition() {
ScheduleNextPoll(0);
}
-void Win7LocationProvider::OnPermissionGranted(
- const GURL& requesting_frame) {
-}
-
void Win7LocationProvider::DoPollTask() {
Geoposition new_position;
api_->GetPosition(&new_position);
diff --git a/content/browser/geolocation/win7_location_provider_win.h b/content/browser/geolocation/win7_location_provider_win.h
index ed96275..1a918e7 100644
--- a/content/browser/geolocation/win7_location_provider_win.h
+++ b/content/browser/geolocation/win7_location_provider_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -29,7 +29,6 @@ class CONTENT_EXPORT Win7LocationProvider : public LocationProviderBase {
virtual void StopProvider() OVERRIDE;
virtual void GetPosition(Geoposition* position) OVERRIDE;
virtual void UpdatePosition() OVERRIDE;
- virtual void OnPermissionGranted(const GURL& requesting_frame) OVERRIDE;
private:
// Task which runs in the child thread.