| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/autofill/risk/fingerprint.h" | 5 #include "chrome/browser/autofill/risk/fingerprint.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/cpu.h" | 9 #include "base/cpu.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
| 12 #include "base/string_split.h" | 12 #include "base/string_split.h" |
| 13 #include "base/sys_info.h" | 13 #include "base/sys_info.h" |
| 14 #include "base/time.h" | 14 #include "base/time.h" |
| 15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 16 #include "chrome/browser/autofill/risk/proto/fingerprint.pb.h" | 16 #include "chrome/browser/autofill/risk/proto/fingerprint.pb.h" |
| 17 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
| 18 #include "chrome/common/chrome_version_info.h" | 18 #include "chrome/common/chrome_version_info.h" |
| 19 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
| 20 #include "content/public/browser/content_browser_client.h" | 20 #include "content/public/browser/content_browser_client.h" |
| 21 #include "content/public/browser/font_list_async.h" | 21 #include "content/public/browser/font_list_async.h" |
| 22 #include "content/public/browser/gpu_data_manager.h" | 22 #include "content/public/browser/gpu_data_manager.h" |
| 23 #include "content/public/browser/gpu_data_manager_observer.h" | 23 #include "content/public/browser/gpu_data_manager_observer.h" |
| 24 #include "content/public/browser/plugin_service.h" | 24 #include "content/public/browser/plugin_service.h" |
| 25 #include "content/public/browser/render_widget_host.h" |
| 26 #include "content/public/browser/render_widget_host_view.h" |
| 27 #include "content/public/browser/web_contents.h" |
| 28 #include "content/public/browser/web_contents_view.h" |
| 25 #include "content/public/common/content_client.h" | 29 #include "content/public/common/content_client.h" |
| 26 #include "content/public/common/gpu_info.h" | 30 #include "content/public/common/gpu_info.h" |
| 27 #include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h" | 31 #include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h" |
| 28 #include "third_party/WebKit/Source/Platform/chromium/public/WebScreenInfo.h" | 32 #include "third_party/WebKit/Source/Platform/chromium/public/WebScreenInfo.h" |
| 29 #include "ui/gfx/rect.h" | 33 #include "ui/gfx/rect.h" |
| 30 #include "ui/gfx/screen.h" | 34 #include "ui/gfx/screen.h" |
| 31 #include "webkit/plugins/webplugininfo.h" | 35 #include "webkit/plugins/webplugininfo.h" |
| 32 | 36 |
| 33 using WebKit::WebScreenInfo; | 37 using WebKit::WebScreenInfo; |
| 34 | 38 |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 metadata->set_fingerprinter_version(kFingerprinterVersion); | 377 metadata->set_fingerprinter_version(kFingerprinterVersion); |
| 374 | 378 |
| 375 callback_.Run(fingerprint.Pass()); | 379 callback_.Run(fingerprint.Pass()); |
| 376 } | 380 } |
| 377 | 381 |
| 378 } // namespace | 382 } // namespace |
| 379 | 383 |
| 380 void GetFingerprint( | 384 void GetFingerprint( |
| 381 int64 gaia_id, | 385 int64 gaia_id, |
| 382 const gfx::Rect& window_bounds, | 386 const gfx::Rect& window_bounds, |
| 383 const gfx::Rect& content_bounds, | 387 const content::WebContents& web_contents, |
| 384 const WebKit::WebScreenInfo& screen_info, | |
| 385 const PrefService& prefs, | 388 const PrefService& prefs, |
| 386 const base::Callback<void(scoped_ptr<Fingerprint>)>& callback) { | 389 const base::Callback<void(scoped_ptr<Fingerprint>)>& callback) { |
| 387 // TODO(isherman): Add a DCHECK that the ToS have been accepted prior to | 390 gfx::Rect content_bounds; |
| 388 // calling into this method. Also, ensure that the UI contains a clear | 391 web_contents.GetView()->GetContainerBounds(&content_bounds); |
| 389 // indication to the user as to what data will be collected. Until then, this | |
| 390 // code should not be called. | |
| 391 | 392 |
| 392 // TODO(isherman): In order to actually be able to pass in the WebScreenInfo | 393 WebKit::WebScreenInfo screen_info; |
| 393 // that's used here, we'll need to expose RenderWidgetHostImpl's | 394 content::RenderWidgetHostView* host_view = |
| 394 // GetWebScreenInfo() as part of the public RenderWidgetHost interface. | 395 web_contents.GetRenderWidgetHostView(); |
| 395 // We can then access it via the dialog's WebContents pointer. | 396 if (host_view) |
| 397 host_view->GetRenderWidgetHost()->GetWebScreenInfo(&screen_info); |
| 396 | 398 |
| 397 // Begin loading all of the data that we need to load asynchronously. | 399 // Begin loading all of the data that we need to load asynchronously. |
| 398 // This class is responsible for freeing its own memory. | 400 // This class is responsible for freeing its own memory. |
| 399 new FingerprintDataLoader(gaia_id, window_bounds, content_bounds, | 401 new FingerprintDataLoader(gaia_id, window_bounds, content_bounds, screen_info, |
| 400 screen_info, prefs, callback); | 402 prefs, callback); |
| 401 } | 403 } |
| 402 | 404 |
| 403 } // namespace risk | 405 } // namespace risk |
| 404 } // namespace autofill | 406 } // namespace autofill |
| OLD | NEW |