Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(734)

Unified Diff: content/browser/geolocation/network_location_provider.cc

Issue 10107017: Remove requesting_frame parameters from Geolocation stack (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Comment addressed. Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/geolocation/network_location_provider.cc
diff --git a/content/browser/geolocation/network_location_provider.cc b/content/browser/geolocation/network_location_provider.cc
index aebbf08c326637eb9d414dd6219b06158445e897..5312aafe7c41b51619797f6a821f7a1a92f9130d 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_);
}

Powered by Google App Engine
This is Rietveld 408576698