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

Side by Side Diff: components/autofill/content/browser/risk/fingerprint.cc

Issue 2095553002: Make callers of FromUTC(Local)Exploded in components/ use new time API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fukino's comments Created 4 years, 5 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 | components/data_reduction_proxy/core/browser/data_usage_store.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 // Generating a fingerprint consists of two major steps: 5 // Generating a fingerprint consists of two major steps:
6 // (1) Gather all the necessary data. 6 // (1) Gather all the necessary data.
7 // (2) Write it into a protocol buffer. 7 // (2) Write it into a protocol buffer.
8 // 8 //
9 // Step (2) is as simple as it sounds -- it's really just a matter of copying 9 // Step (2) is as simple as it sounds -- it's really just a matter of copying
10 // data. Step (1) requires waiting on several asynchronous callbacks, which are 10 // data. Step (1) requires waiting on several asynchronous callbacks, which are
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // fingerprint data. 59 // fingerprint data.
60 const int kTimeoutSeconds = 4; 60 const int kTimeoutSeconds = 4;
61 61
62 // Returns the delta between the local timezone and UTC. 62 // Returns the delta between the local timezone and UTC.
63 base::TimeDelta GetTimezoneOffset() { 63 base::TimeDelta GetTimezoneOffset() {
64 const base::Time utc = base::Time::Now(); 64 const base::Time utc = base::Time::Now();
65 65
66 base::Time::Exploded local; 66 base::Time::Exploded local;
67 utc.LocalExplode(&local); 67 utc.LocalExplode(&local);
68 68
69 return base::Time::FromUTCExploded(local) - utc; 69 base::Time out_time;
70 bool conversion_success = base::Time::FromUTCExploded(local, &out_time);
71 DCHECK(conversion_success);
72
73 return out_time - utc;
70 } 74 }
71 75
72 // Returns the concatenation of the operating system name and version, e.g. 76 // Returns the concatenation of the operating system name and version, e.g.
73 // "Mac OS X 10.6.8". 77 // "Mac OS X 10.6.8".
74 std::string GetOperatingSystemVersion() { 78 std::string GetOperatingSystemVersion() {
75 return base::SysInfo::OperatingSystemName() + " " + 79 return base::SysInfo::OperatingSystemName() + " " +
76 base::SysInfo::OperatingSystemVersion(); 80 base::SysInfo::OperatingSystemVersion();
77 } 81 }
78 82
79 // Adds the list of |fonts| to the |machine|. 83 // Adds the list of |fonts| to the |machine|.
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 host_view->GetRenderWidgetHost()->GetWebScreenInfo(&screen_info); 477 host_view->GetRenderWidgetHost()->GetWebScreenInfo(&screen_info);
474 478
475 internal::GetFingerprintInternal( 479 internal::GetFingerprintInternal(
476 obfuscated_gaia_id, window_bounds, content_bounds, screen_info, version, 480 obfuscated_gaia_id, window_bounds, content_bounds, screen_info, version,
477 charset, accept_languages, install_time, app_locale, user_agent, 481 charset, accept_languages, install_time, app_locale, user_agent,
478 base::TimeDelta::FromSeconds(kTimeoutSeconds), callback); 482 base::TimeDelta::FromSeconds(kTimeoutSeconds), callback);
479 } 483 }
480 484
481 } // namespace risk 485 } // namespace risk
482 } // namespace autofill 486 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | components/data_reduction_proxy/core/browser/data_usage_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698