Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 51 void RecordUmaEvent(NetworkLocationRequestEvent event) { | 51 void RecordUmaEvent(NetworkLocationRequestEvent event) { |
| 52 UMA_HISTOGRAM_ENUMERATION("Geolocation.NetworkLocationRequest.Event", | 52 UMA_HISTOGRAM_ENUMERATION("Geolocation.NetworkLocationRequest.Event", |
| 53 event, NETWORK_LOCATION_REQUEST_EVENT_COUNT); | 53 event, NETWORK_LOCATION_REQUEST_EVENT_COUNT); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void RecordUmaResponseCode(int code) { | 56 void RecordUmaResponseCode(int code) { |
| 57 UMA_HISTOGRAM_SPARSE_SLOWLY("Geolocation.NetworkLocationRequest.ResponseCode", | 57 UMA_HISTOGRAM_SPARSE_SLOWLY("Geolocation.NetworkLocationRequest.ResponseCode", |
| 58 code); | 58 code); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void RecordUmaAccessPoints(int count) { | |
| 62 UMA_HISTOGRAM_SPARSE_SLOWLY("Geolocation.NetworkLocationRequest.AccessPoints", | |
| 63 count); | |
|
Ilya Sherman
2013/10/08 23:51:03
What sorts of counts are expected? Could you use
Michael van Ouwerkerk
2013/10/09 13:09:57
I expect counts of 0 to 10 but in some cases there
Ilya Sherman
2013/10/09 22:47:40
I'm pretty sure this is not accurate -- 0 is a val
Michael van Ouwerkerk
2013/10/10 10:20:03
Done.
| |
| 64 } | |
| 65 | |
| 61 // Local functions | 66 // Local functions |
| 62 // Creates the request url to send to the server. | 67 // Creates the request url to send to the server. |
| 63 GURL FormRequestURL(const GURL& url); | 68 GURL FormRequestURL(const GURL& url); |
| 64 | 69 |
| 65 void FormUploadData(const WifiData& wifi_data, | 70 void FormUploadData(const WifiData& wifi_data, |
| 66 const base::Time& timestamp, | 71 const base::Time& timestamp, |
| 67 const string16& access_token, | 72 const string16& access_token, |
| 68 std::string* upload_data); | 73 std::string* upload_data); |
| 69 | 74 |
| 70 // Attempts to extract a position from the response. Detects and indicates | 75 // Attempts to extract a position from the response. Detects and indicates |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 100 url_(url) { | 105 url_(url) { |
| 101 } | 106 } |
| 102 | 107 |
| 103 NetworkLocationRequest::~NetworkLocationRequest() { | 108 NetworkLocationRequest::~NetworkLocationRequest() { |
| 104 } | 109 } |
| 105 | 110 |
| 106 bool NetworkLocationRequest::MakeRequest(const string16& access_token, | 111 bool NetworkLocationRequest::MakeRequest(const string16& access_token, |
| 107 const WifiData& wifi_data, | 112 const WifiData& wifi_data, |
| 108 const base::Time& timestamp) { | 113 const base::Time& timestamp) { |
| 109 RecordUmaEvent(NETWORK_LOCATION_REQUEST_EVENT_REQUEST_START); | 114 RecordUmaEvent(NETWORK_LOCATION_REQUEST_EVENT_REQUEST_START); |
| 115 RecordUmaAccessPoints(wifi_data.access_point_data.size()); | |
| 110 if (url_fetcher_ != NULL) { | 116 if (url_fetcher_ != NULL) { |
| 111 DVLOG(1) << "NetworkLocationRequest : Cancelling pending request"; | 117 DVLOG(1) << "NetworkLocationRequest : Cancelling pending request"; |
| 112 RecordUmaEvent(NETWORK_LOCATION_REQUEST_EVENT_REQUEST_CANCEL); | 118 RecordUmaEvent(NETWORK_LOCATION_REQUEST_EVENT_REQUEST_CANCEL); |
| 113 url_fetcher_.reset(); | 119 url_fetcher_.reset(); |
| 114 } | 120 } |
| 115 wifi_data_ = wifi_data; | 121 wifi_data_ = wifi_data; |
| 116 timestamp_ = timestamp; | 122 timestamp_ = timestamp; |
| 117 | 123 |
| 118 GURL request_url = FormRequestURL(url_); | 124 GURL request_url = FormRequestURL(url_); |
| 119 url_fetcher_.reset(net::URLFetcher::Create( | 125 url_fetcher_.reset(net::URLFetcher::Create( |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 413 | 419 |
| 414 // Other fields are optional. | 420 // Other fields are optional. |
| 415 GetAsDouble(*response_object, kAccuracyString, &position->accuracy); | 421 GetAsDouble(*response_object, kAccuracyString, &position->accuracy); |
| 416 | 422 |
| 417 return true; | 423 return true; |
| 418 } | 424 } |
| 419 | 425 |
| 420 } // namespace | 426 } // namespace |
| 421 | 427 |
| 422 } // namespace content | 428 } // namespace content |
| OLD | NEW |