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

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: rebased 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
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // Maximum amount of time, in seconds, to wait for loading asynchronous 58 // Maximum amount of time, in seconds, to wait for loading asynchronous
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 base::Time out_time;
69 return base::Time::FromUTCExploded(local) - utc; 69 // |out_time| is set to Time(0) on failure.
70 if (!base::Time::FromUTCExploded(local, &out_time)) {
vabr (Chromium) 2016/06/28 14:34:12 Given that the exploded value comes from the resul
maksims (do not use this acc) 2016/06/29 05:48:59 Correct, it will never fail in this case.
71 // TODO(maksims): implement error handling.
72 // |out_time| is Time(0) here.
73 NOTIMPLEMENTED();
74 }
75 return out_time - utc;
70 } 76 }
71 77
72 // Returns the concatenation of the operating system name and version, e.g. 78 // Returns the concatenation of the operating system name and version, e.g.
73 // "Mac OS X 10.6.8". 79 // "Mac OS X 10.6.8".
74 std::string GetOperatingSystemVersion() { 80 std::string GetOperatingSystemVersion() {
75 return base::SysInfo::OperatingSystemName() + " " + 81 return base::SysInfo::OperatingSystemName() + " " +
76 base::SysInfo::OperatingSystemVersion(); 82 base::SysInfo::OperatingSystemVersion();
77 } 83 }
78 84
79 // Adds the list of |fonts| to the |machine|. 85 // 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); 479 host_view->GetRenderWidgetHost()->GetWebScreenInfo(&screen_info);
474 480
475 internal::GetFingerprintInternal( 481 internal::GetFingerprintInternal(
476 obfuscated_gaia_id, window_bounds, content_bounds, screen_info, version, 482 obfuscated_gaia_id, window_bounds, content_bounds, screen_info, version,
477 charset, accept_languages, install_time, app_locale, user_agent, 483 charset, accept_languages, install_time, app_locale, user_agent,
478 base::TimeDelta::FromSeconds(kTimeoutSeconds), callback); 484 base::TimeDelta::FromSeconds(kTimeoutSeconds), callback);
479 } 485 }
480 486
481 } // namespace risk 487 } // namespace risk
482 } // namespace autofill 488 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698