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

Side by Side Diff: chromeos/timezone/timezone_request.cc

Issue 790793008: chromeos: Remove unused private data members (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | « chromeos/timezone/timezone_request.h ('k') | chromeos/timezone/timezone_unittest.cc » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chromeos/timezone/timezone_request.h" 5 #include "chromeos/timezone/timezone_request.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 110 }
111 } 111 }
112 112
113 void RecordUmaResult(TimeZoneRequestResult result, unsigned retries) { 113 void RecordUmaResult(TimeZoneRequestResult result, unsigned retries) {
114 UMA_HISTOGRAM_ENUMERATION( 114 UMA_HISTOGRAM_ENUMERATION(
115 "TimeZone.TimeZoneRequest.Result", result, TIMEZONE_REQUEST_RESULT_COUNT); 115 "TimeZone.TimeZoneRequest.Result", result, TIMEZONE_REQUEST_RESULT_COUNT);
116 UMA_HISTOGRAM_SPARSE_SLOWLY("TimeZone.TimeZoneRequest.Retries", retries); 116 UMA_HISTOGRAM_SPARSE_SLOWLY("TimeZone.TimeZoneRequest.Retries", retries);
117 } 117 }
118 118
119 // Creates the request url to send to the server. 119 // Creates the request url to send to the server.
120 // |sensor| if this location was determined using hardware sensor.
120 GURL TimeZoneRequestURL(const GURL& url, 121 GURL TimeZoneRequestURL(const GURL& url,
121 const Geoposition& geoposition, 122 const Geoposition& geoposition,
122 bool sensor) { 123 bool sensor) {
123 std::string query(url.query()); 124 std::string query(url.query());
124 query += base::StringPrintf( 125 query += base::StringPrintf(
125 "%s=%f,%f", kLocationString, geoposition.latitude, geoposition.longitude); 126 "%s=%f,%f", kLocationString, geoposition.latitude, geoposition.longitude);
126 if (url == DefaultTimezoneProviderURL()) { 127 if (url == DefaultTimezoneProviderURL()) {
127 std::string api_key = google_apis::GetAPIKey(); 128 std::string api_key = google_apis::GetAPIKey();
128 if (!api_key.empty()) { 129 if (!api_key.empty()) {
129 query += "&"; 130 query += "&";
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 } 299 }
299 300
300 GURL DefaultTimezoneProviderURL() { 301 GURL DefaultTimezoneProviderURL() {
301 return GURL(kDefaultTimezoneProviderUrl); 302 return GURL(kDefaultTimezoneProviderUrl);
302 } 303 }
303 304
304 TimeZoneRequest::TimeZoneRequest( 305 TimeZoneRequest::TimeZoneRequest(
305 net::URLRequestContextGetter* url_context_getter, 306 net::URLRequestContextGetter* url_context_getter,
306 const GURL& service_url, 307 const GURL& service_url,
307 const Geoposition& geoposition, 308 const Geoposition& geoposition,
308 bool sensor,
309 base::TimeDelta retry_timeout) 309 base::TimeDelta retry_timeout)
310 : url_context_getter_(url_context_getter), 310 : url_context_getter_(url_context_getter),
311 service_url_(service_url), 311 service_url_(service_url),
312 geoposition_(geoposition), 312 geoposition_(geoposition),
313 sensor_(sensor),
314 retry_timeout_abs_(base::Time::Now() + retry_timeout), 313 retry_timeout_abs_(base::Time::Now() + retry_timeout),
315 retry_sleep_on_server_error_(base::TimeDelta::FromSeconds( 314 retry_sleep_on_server_error_(base::TimeDelta::FromSeconds(
316 kResolveTimeZoneRetrySleepOnServerErrorSeconds)), 315 kResolveTimeZoneRetrySleepOnServerErrorSeconds)),
317 retry_sleep_on_bad_response_(base::TimeDelta::FromSeconds( 316 retry_sleep_on_bad_response_(base::TimeDelta::FromSeconds(
318 kResolveTimeZoneRetrySleepBadResponseSeconds)), 317 kResolveTimeZoneRetrySleepBadResponseSeconds)),
319 retries_(0) { 318 retries_(0) {
320 } 319 }
321 320
322 TimeZoneRequest::~TimeZoneRequest() { 321 TimeZoneRequest::~TimeZoneRequest() {
323 DCHECK(thread_checker_.CalledOnValidThread()); 322 DCHECK(thread_checker_.CalledOnValidThread());
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 dstOffset, 421 dstOffset,
423 rawOffset, 422 rawOffset,
424 timeZoneId.c_str(), 423 timeZoneId.c_str(),
425 timeZoneName.c_str(), 424 timeZoneName.c_str(),
426 error_message.c_str(), 425 error_message.c_str(),
427 (unsigned)status, 426 (unsigned)status,
428 (status < arraysize(status2string) ? status2string[status] : "unknown")); 427 (status < arraysize(status2string) ? status2string[status] : "unknown"));
429 } 428 }
430 429
431 } // namespace chromeos 430 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/timezone/timezone_request.h ('k') | chromeos/timezone/timezone_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698