| 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 26 matching lines...) Expand all Loading... |
| 37 #include "content/public/browser/web_contents_view.h" | 37 #include "content/public/browser/web_contents_view.h" |
| 38 #include "content/public/common/content_client.h" | 38 #include "content/public/common/content_client.h" |
| 39 #include "content/public/common/geoposition.h" | 39 #include "content/public/common/geoposition.h" |
| 40 #include "content/public/common/webplugininfo.h" | 40 #include "content/public/common/webplugininfo.h" |
| 41 #include "gpu/config/gpu_info.h" | 41 #include "gpu/config/gpu_info.h" |
| 42 #include "third_party/WebKit/public/platform/WebRect.h" | 42 #include "third_party/WebKit/public/platform/WebRect.h" |
| 43 #include "third_party/WebKit/public/platform/WebScreenInfo.h" | 43 #include "third_party/WebKit/public/platform/WebScreenInfo.h" |
| 44 #include "ui/gfx/rect.h" | 44 #include "ui/gfx/rect.h" |
| 45 #include "ui/gfx/screen.h" | 45 #include "ui/gfx/screen.h" |
| 46 | 46 |
| 47 using WebKit::WebScreenInfo; | 47 using blink::WebScreenInfo; |
| 48 | 48 |
| 49 namespace autofill { | 49 namespace autofill { |
| 50 namespace risk { | 50 namespace risk { |
| 51 | 51 |
| 52 namespace { | 52 namespace { |
| 53 | 53 |
| 54 const int32 kFingerprinterVersion = 1; | 54 const int32 kFingerprinterVersion = 1; |
| 55 | 55 |
| 56 // Maximum amount of time, in seconds, to wait for loading asynchronous | 56 // Maximum amount of time, in seconds, to wait for loading asynchronous |
| 57 // fingerprint data. | 57 // fingerprint data. |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 } | 498 } |
| 499 | 499 |
| 500 } // namespace | 500 } // namespace |
| 501 | 501 |
| 502 namespace internal { | 502 namespace internal { |
| 503 | 503 |
| 504 void GetFingerprintInternal( | 504 void GetFingerprintInternal( |
| 505 uint64 obfuscated_gaia_id, | 505 uint64 obfuscated_gaia_id, |
| 506 const gfx::Rect& window_bounds, | 506 const gfx::Rect& window_bounds, |
| 507 const gfx::Rect& content_bounds, | 507 const gfx::Rect& content_bounds, |
| 508 const WebKit::WebScreenInfo& screen_info, | 508 const blink::WebScreenInfo& screen_info, |
| 509 const std::string& version, | 509 const std::string& version, |
| 510 const std::string& charset, | 510 const std::string& charset, |
| 511 const std::string& accept_languages, | 511 const std::string& accept_languages, |
| 512 const base::Time& install_time, | 512 const base::Time& install_time, |
| 513 const std::string& app_locale, | 513 const std::string& app_locale, |
| 514 const base::TimeDelta& timeout, | 514 const base::TimeDelta& timeout, |
| 515 const base::Callback<void(scoped_ptr<Fingerprint>)>& callback) { | 515 const base::Callback<void(scoped_ptr<Fingerprint>)>& callback) { |
| 516 // Begin loading all of the data that we need to load asynchronously. | 516 // Begin loading all of the data that we need to load asynchronously. |
| 517 // This class is responsible for freeing its own memory. | 517 // This class is responsible for freeing its own memory. |
| 518 new FingerprintDataLoader(obfuscated_gaia_id, window_bounds, content_bounds, | 518 new FingerprintDataLoader(obfuscated_gaia_id, window_bounds, content_bounds, |
| 519 screen_info, version, charset, accept_languages, | 519 screen_info, version, charset, accept_languages, |
| 520 install_time, app_locale, timeout, callback); | 520 install_time, app_locale, timeout, callback); |
| 521 } | 521 } |
| 522 | 522 |
| 523 } // namespace internal | 523 } // namespace internal |
| 524 | 524 |
| 525 void GetFingerprint( | 525 void GetFingerprint( |
| 526 uint64 obfuscated_gaia_id, | 526 uint64 obfuscated_gaia_id, |
| 527 const gfx::Rect& window_bounds, | 527 const gfx::Rect& window_bounds, |
| 528 const content::WebContents& web_contents, | 528 const content::WebContents& web_contents, |
| 529 const std::string& version, | 529 const std::string& version, |
| 530 const std::string& charset, | 530 const std::string& charset, |
| 531 const std::string& accept_languages, | 531 const std::string& accept_languages, |
| 532 const base::Time& install_time, | 532 const base::Time& install_time, |
| 533 const std::string& app_locale, | 533 const std::string& app_locale, |
| 534 const base::Callback<void(scoped_ptr<Fingerprint>)>& callback) { | 534 const base::Callback<void(scoped_ptr<Fingerprint>)>& callback) { |
| 535 gfx::Rect content_bounds; | 535 gfx::Rect content_bounds; |
| 536 web_contents.GetView()->GetContainerBounds(&content_bounds); | 536 web_contents.GetView()->GetContainerBounds(&content_bounds); |
| 537 | 537 |
| 538 WebKit::WebScreenInfo screen_info; | 538 blink::WebScreenInfo screen_info; |
| 539 content::RenderWidgetHostView* host_view = | 539 content::RenderWidgetHostView* host_view = |
| 540 web_contents.GetRenderWidgetHostView(); | 540 web_contents.GetRenderWidgetHostView(); |
| 541 if (host_view) | 541 if (host_view) |
| 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 |