| OLD | NEW |
| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 plugin->add_mime_type(mime_type->mime_type); | 106 plugin->add_mime_type(mime_type->mime_type); |
| 107 } | 107 } |
| 108 plugin->set_version(base::UTF16ToUTF8(it->version)); | 108 plugin->set_version(base::UTF16ToUTF8(it->version)); |
| 109 } | 109 } |
| 110 } | 110 } |
| 111 | 111 |
| 112 // Adds the list of HTTP accept languages to the |machine|. | 112 // Adds the list of HTTP accept languages to the |machine|. |
| 113 void AddAcceptLanguagesToFingerprint( | 113 void AddAcceptLanguagesToFingerprint( |
| 114 const std::string& accept_languages_str, | 114 const std::string& accept_languages_str, |
| 115 Fingerprint::MachineCharacteristics* machine) { | 115 Fingerprint::MachineCharacteristics* machine) { |
| 116 std::vector<std::string> accept_languages; | 116 for (const std::string& lang : |
| 117 base::SplitString(accept_languages_str, ',', &accept_languages); | 117 base::SplitString(accept_languages_str, ",", base::TRIM_WHITESPACE, |
| 118 for (std::vector<std::string>::const_iterator it = accept_languages.begin(); | 118 base::SPLIT_WANT_ALL)) |
| 119 it != accept_languages.end(); ++it) { | 119 machine->add_requested_language(lang); |
| 120 machine->add_requested_language(*it); | |
| 121 } | |
| 122 } | 120 } |
| 123 | 121 |
| 124 // This function writes | 122 // This function writes |
| 125 // (a) the number of screens, | 123 // (a) the number of screens, |
| 126 // (b) the primary display's screen size, | 124 // (b) the primary display's screen size, |
| 127 // (c) the screen's color depth, and | 125 // (c) the screen's color depth, and |
| 128 // (d) the size of the screen unavailable to web page content, | 126 // (d) the size of the screen unavailable to web page content, |
| 129 // i.e. the Taskbar size on Windows | 127 // i.e. the Taskbar size on Windows |
| 130 // into the |machine|. | 128 // into the |machine|. |
| 131 void AddScreenInfoToFingerprint(const WebScreenInfo& screen_info, | 129 void AddScreenInfoToFingerprint(const WebScreenInfo& screen_info, |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 host_view->GetRenderWidgetHost()->GetWebScreenInfo(&screen_info); | 476 host_view->GetRenderWidgetHost()->GetWebScreenInfo(&screen_info); |
| 479 | 477 |
| 480 internal::GetFingerprintInternal( | 478 internal::GetFingerprintInternal( |
| 481 obfuscated_gaia_id, window_bounds, content_bounds, screen_info, version, | 479 obfuscated_gaia_id, window_bounds, content_bounds, screen_info, version, |
| 482 charset, accept_languages, install_time, app_locale, user_agent, | 480 charset, accept_languages, install_time, app_locale, user_agent, |
| 483 base::TimeDelta::FromSeconds(kTimeoutSeconds), callback); | 481 base::TimeDelta::FromSeconds(kTimeoutSeconds), callback); |
| 484 } | 482 } |
| 485 | 483 |
| 486 } // namespace risk | 484 } // namespace risk |
| 487 } // namespace autofill | 485 } // namespace autofill |
| OLD | NEW |