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

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

Issue 26482003: Geolocation: log the number of wifi access points used to determine location. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use UMA_HISTOGRAM_CUSTOM_COUNTS. Created 7 years, 2 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 | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_CUSTOM_COUNTS("Geolocation.NetworkLocationRequest.AccessPoints",
63 count, 0, 10, 11);
timvolodine 2013/10/10 12:00:43 could we use some constants here, like similar to
Michael van Ouwerkerk 2013/10/16 14:35:30 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
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
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
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698