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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 119 |
120 // This function writes | 120 // This function writes |
121 // (a) the number of screens, | 121 // (a) the number of screens, |
122 // (b) the primary display's screen size, | 122 // (b) the primary display's screen size, |
123 // (c) the screen's color depth, and | 123 // (c) the screen's color depth, and |
124 // (d) the size of the screen unavailable to web page content, | 124 // (d) the size of the screen unavailable to web page content, |
125 // i.e. the Taskbar size on Windows | 125 // i.e. the Taskbar size on Windows |
126 // into the |machine|. | 126 // into the |machine|. |
127 void AddScreenInfoToFingerprint(const WebScreenInfo& screen_info, | 127 void AddScreenInfoToFingerprint(const WebScreenInfo& screen_info, |
128 Fingerprint::MachineCharacteristics* machine) { | 128 Fingerprint::MachineCharacteristics* machine) { |
129 // TODO(scottmg): NativeScreen maybe wrong. http://crbug.com/133312 | 129 machine->set_screen_count(gfx::Screen::GetScreen()->GetNumDisplays()); |
130 machine->set_screen_count( | |
131 gfx::Screen::GetNativeScreen()->GetNumDisplays()); | |
132 | 130 |
133 const gfx::Size screen_size = | 131 const gfx::Size screen_size = |
134 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().GetSizeInPixel(); | 132 gfx::Screen::GetScreen()->GetPrimaryDisplay().GetSizeInPixel(); |
135 machine->mutable_screen_size()->set_width(screen_size.width()); | 133 machine->mutable_screen_size()->set_width(screen_size.width()); |
136 machine->mutable_screen_size()->set_height(screen_size.height()); | 134 machine->mutable_screen_size()->set_height(screen_size.height()); |
137 | 135 |
138 machine->set_screen_color_depth(screen_info.depth); | 136 machine->set_screen_color_depth(screen_info.depth); |
139 | 137 |
140 const gfx::Rect screen_rect(screen_info.rect); | 138 const gfx::Rect screen_rect(screen_info.rect); |
141 const gfx::Rect available_rect(screen_info.availableRect); | 139 const gfx::Rect available_rect(screen_info.availableRect); |
142 const gfx::Rect unavailable_rect = | 140 const gfx::Rect unavailable_rect = |
143 gfx::SubtractRects(screen_rect, available_rect); | 141 gfx::SubtractRects(screen_rect, available_rect); |
144 machine->mutable_unavailable_screen_size()->set_width( | 142 machine->mutable_unavailable_screen_size()->set_width( |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 host_view->GetRenderWidgetHost()->GetWebScreenInfo(&screen_info); | 472 host_view->GetRenderWidgetHost()->GetWebScreenInfo(&screen_info); |
475 | 473 |
476 internal::GetFingerprintInternal( | 474 internal::GetFingerprintInternal( |
477 obfuscated_gaia_id, window_bounds, content_bounds, screen_info, version, | 475 obfuscated_gaia_id, window_bounds, content_bounds, screen_info, version, |
478 charset, accept_languages, install_time, app_locale, user_agent, | 476 charset, accept_languages, install_time, app_locale, user_agent, |
479 base::TimeDelta::FromSeconds(kTimeoutSeconds), callback); | 477 base::TimeDelta::FromSeconds(kTimeoutSeconds), callback); |
480 } | 478 } |
481 | 479 |
482 } // namespace risk | 480 } // namespace risk |
483 } // namespace autofill | 481 } // namespace autofill |
OLD | NEW |