| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 | 95 |
| 96 // Adds the list of |plugins| to the |machine|. | 96 // Adds the list of |plugins| to the |machine|. |
| 97 void AddPluginsToFingerprint(const std::vector<content::WebPluginInfo>& plugins, | 97 void AddPluginsToFingerprint(const std::vector<content::WebPluginInfo>& plugins, |
| 98 Fingerprint::MachineCharacteristics* machine) { | 98 Fingerprint::MachineCharacteristics* machine) { |
| 99 for (std::vector<content::WebPluginInfo>::const_iterator it = plugins.begin(); | 99 for (std::vector<content::WebPluginInfo>::const_iterator it = plugins.begin(); |
| 100 it != plugins.end(); ++it) { | 100 it != plugins.end(); ++it) { |
| 101 Fingerprint::MachineCharacteristics::Plugin* plugin = | 101 Fingerprint::MachineCharacteristics::Plugin* plugin = |
| 102 machine->add_plugin(); | 102 machine->add_plugin(); |
| 103 plugin->set_name(UTF16ToUTF8(it->name)); | 103 plugin->set_name(base::UTF16ToUTF8(it->name)); |
| 104 plugin->set_description(UTF16ToUTF8(it->desc)); | 104 plugin->set_description(base::UTF16ToUTF8(it->desc)); |
| 105 for (std::vector<content::WebPluginMimeType>::const_iterator mime_type = | 105 for (std::vector<content::WebPluginMimeType>::const_iterator mime_type = |
| 106 it->mime_types.begin(); | 106 it->mime_types.begin(); |
| 107 mime_type != it->mime_types.end(); ++mime_type) { | 107 mime_type != it->mime_types.end(); ++mime_type) { |
| 108 plugin->add_mime_type(mime_type->mime_type); | 108 plugin->add_mime_type(mime_type->mime_type); |
| 109 } | 109 } |
| 110 plugin->set_version(UTF16ToUTF8(it->version)); | 110 plugin->set_version(base::UTF16ToUTF8(it->version)); |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 | 113 |
| 114 // Adds the list of HTTP accept languages to the |machine|. | 114 // Adds the list of HTTP accept languages to the |machine|. |
| 115 void AddAcceptLanguagesToFingerprint( | 115 void AddAcceptLanguagesToFingerprint( |
| 116 const std::string& accept_languages_str, | 116 const std::string& accept_languages_str, |
| 117 Fingerprint::MachineCharacteristics* machine) { | 117 Fingerprint::MachineCharacteristics* machine) { |
| 118 std::vector<std::string> accept_languages; | 118 std::vector<std::string> accept_languages; |
| 119 base::SplitString(accept_languages_str, ',', &accept_languages); | 119 base::SplitString(accept_languages_str, ',', &accept_languages); |
| 120 for (std::vector<std::string>::const_iterator it = accept_languages.begin(); | 120 for (std::vector<std::string>::const_iterator it = accept_languages.begin(); |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 host_view->GetRenderWidgetHost()->GetWebScreenInfo(&screen_info); | 542 host_view->GetRenderWidgetHost()->GetWebScreenInfo(&screen_info); |
| 543 | 543 |
| 544 internal::GetFingerprintInternal( | 544 internal::GetFingerprintInternal( |
| 545 obfuscated_gaia_id, window_bounds, content_bounds, screen_info, version, | 545 obfuscated_gaia_id, window_bounds, content_bounds, screen_info, version, |
| 546 charset, accept_languages, install_time, app_locale, | 546 charset, accept_languages, install_time, app_locale, |
| 547 base::TimeDelta::FromSeconds(kTimeoutSeconds), callback); | 547 base::TimeDelta::FromSeconds(kTimeoutSeconds), callback); |
| 548 } | 548 } |
| 549 | 549 |
| 550 } // namespace risk | 550 } // namespace risk |
| 551 } // namespace autofill | 551 } // namespace autofill |
| OLD | NEW |