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

Side by Side Diff: content/browser/geolocation/network_location_request.cc

Issue 10534120: Remove RadioData from geolocation (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fix content_unittests Created 8 years, 6 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 unified diff | Download patch
« no previous file with comments | « content/browser/geolocation/network_location_request.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/geolocation/network_location_request.h" 5 #include "content/browser/geolocation/network_location_request.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 9
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 ListenerInterface* listener) 67 ListenerInterface* listener)
68 : url_context_(context), listener_(listener), 68 : url_context_(context), listener_(listener),
69 url_(url) { 69 url_(url) {
70 DCHECK(listener); 70 DCHECK(listener);
71 } 71 }
72 72
73 NetworkLocationRequest::~NetworkLocationRequest() { 73 NetworkLocationRequest::~NetworkLocationRequest() {
74 } 74 }
75 75
76 bool NetworkLocationRequest::MakeRequest(const string16& access_token, 76 bool NetworkLocationRequest::MakeRequest(const string16& access_token,
77 const RadioData& radio_data,
78 const WifiData& wifi_data, 77 const WifiData& wifi_data,
79 const base::Time& timestamp) { 78 const base::Time& timestamp) {
80 if (url_fetcher_ != NULL) { 79 if (url_fetcher_ != NULL) {
81 DVLOG(1) << "NetworkLocationRequest : Cancelling pending request"; 80 DVLOG(1) << "NetworkLocationRequest : Cancelling pending request";
82 url_fetcher_.reset(); 81 url_fetcher_.reset();
83 } 82 }
84 radio_data_ = radio_data;
85 wifi_data_ = wifi_data; 83 wifi_data_ = wifi_data;
86 timestamp_ = timestamp; 84 timestamp_ = timestamp;
87 85
88 GURL request_url = FormRequestURL(url_.spec(), access_token, 86 GURL request_url = FormRequestURL(url_.spec(), access_token,
89 wifi_data, timestamp_); 87 wifi_data, timestamp_);
90 url_fetcher_.reset(content::URLFetcher::Create( 88 url_fetcher_.reset(content::URLFetcher::Create(
91 url_fetcher_id_for_tests, request_url, net::URLFetcher::GET, this)); 89 url_fetcher_id_for_tests, request_url, net::URLFetcher::GET, this));
92 url_fetcher_->SetRequestContext(url_context_); 90 url_fetcher_->SetRequestContext(url_context_);
93 url_fetcher_->SetLoadFlags( 91 url_fetcher_->SetLoadFlags(
94 net::LOAD_BYPASS_CACHE | net::LOAD_DISABLE_CACHE | 92 net::LOAD_BYPASS_CACHE | net::LOAD_DISABLE_CACHE |
(...skipping 22 matching lines...) Expand all
117 source->GetURL(), 115 source->GetURL(),
118 &position, 116 &position,
119 &access_token); 117 &access_token);
120 const bool server_error = 118 const bool server_error =
121 !status.is_success() || (response_code >= 500 && response_code < 600); 119 !status.is_success() || (response_code >= 500 && response_code < 600);
122 url_fetcher_.reset(); 120 url_fetcher_.reset();
123 121
124 DCHECK(listener_); 122 DCHECK(listener_);
125 DVLOG(1) << "NetworkLocationRequest::Run() : Calling listener with position."; 123 DVLOG(1) << "NetworkLocationRequest::Run() : Calling listener with position.";
126 listener_->LocationResponseAvailable(position, server_error, access_token, 124 listener_->LocationResponseAvailable(position, server_error, access_token,
127 radio_data_, wifi_data_); 125 wifi_data_);
128 } 126 }
129 127
130 // Local functions. 128 // Local functions.
131 namespace { 129 namespace {
132 130
133 struct AccessPointLess { 131 struct AccessPointLess {
134 bool operator()(const AccessPointData* ap1, 132 bool operator()(const AccessPointData* ap1,
135 const AccessPointData* ap2) const { 133 const AccessPointData* ap2) const {
136 return ap2->radio_signal_strength < ap1->radio_signal_strength; 134 return ap2->radio_signal_strength < ap1->radio_signal_strength;
137 } 135 }
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 position->longitude = longitude; 406 position->longitude = longitude;
409 position->timestamp = timestamp; 407 position->timestamp = timestamp;
410 408
411 // Other fields are optional. 409 // Other fields are optional.
412 GetAsDouble(*response_object, kAccuracyString, &position->accuracy); 410 GetAsDouble(*response_object, kAccuracyString, &position->accuracy);
413 411
414 return true; 412 return true;
415 } 413 }
416 414
417 } // namespace 415 } // namespace
OLDNEW
« no previous file with comments | « content/browser/geolocation/network_location_request.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698