Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(449)

Side by Side Diff: chrome/browser/autofill/risk/fingerprint.cc

Issue 12212057: [Autofill] Add ability to load Risk fingerprint data in AutofillDialogControllerImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/prefs/public/pref_service_base.h" 12 #include "base/prefs/public/pref_service_base.h"
13 #include "base/string_split.h" 13 #include "base/string_split.h"
14 #include "base/sys_info.h" 14 #include "base/sys_info.h"
15 #include "base/time.h" 15 #include "base/time.h"
16 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
17 #include "chrome/browser/autofill/risk/proto/fingerprint.pb.h" 17 #include "chrome/browser/autofill/risk/proto/fingerprint.pb.h"
18 #include "chrome/browser/browser_process.h" 18 #include "chrome/browser/browser_process.h"
19 #include "chrome/common/chrome_version_info.h" 19 #include "chrome/common/chrome_version_info.h"
20 #include "chrome/common/pref_names.h" 20 #include "chrome/common/pref_names.h"
21 #include "content/public/browser/content_browser_client.h" 21 #include "content/public/browser/content_browser_client.h"
22 #include "content/public/browser/font_list_async.h" 22 #include "content/public/browser/font_list_async.h"
23 #include "content/public/browser/gpu_data_manager.h" 23 #include "content/public/browser/gpu_data_manager.h"
24 #include "content/public/browser/gpu_data_manager_observer.h" 24 #include "content/public/browser/gpu_data_manager_observer.h"
25 #include "content/public/browser/plugin_service.h" 25 #include "content/public/browser/plugin_service.h"
26 #include "content/public/browser/render_widget_host.h"
27 #include "content/public/browser/render_widget_host_view.h"
28 #include "content/public/browser/web_contents.h"
29 #include "content/public/browser/web_contents_view.h"
26 #include "content/public/common/content_client.h" 30 #include "content/public/common/content_client.h"
27 #include "content/public/common/gpu_info.h" 31 #include "content/public/common/gpu_info.h"
28 #include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h" 32 #include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h"
29 #include "third_party/WebKit/Source/Platform/chromium/public/WebScreenInfo.h" 33 #include "third_party/WebKit/Source/Platform/chromium/public/WebScreenInfo.h"
30 #include "ui/gfx/rect.h" 34 #include "ui/gfx/rect.h"
31 #include "ui/gfx/screen.h" 35 #include "ui/gfx/screen.h"
32 #include "webkit/plugins/webplugininfo.h" 36 #include "webkit/plugins/webplugininfo.h"
33 37
34 using WebKit::WebScreenInfo; 38 using WebKit::WebScreenInfo;
35 39
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 metadata->set_fingerprinter_version(kFingerprinterVersion); 359 metadata->set_fingerprinter_version(kFingerprinterVersion);
356 360
357 callback_.Run(fingerprint.Pass()); 361 callback_.Run(fingerprint.Pass());
358 } 362 }
359 363
360 } // namespace 364 } // namespace
361 365
362 void GetFingerprint( 366 void GetFingerprint(
363 int64 gaia_id, 367 int64 gaia_id,
364 const gfx::Rect& window_bounds, 368 const gfx::Rect& window_bounds,
365 const gfx::Rect& content_bounds, 369 const content::WebContents& web_contents,
366 const WebKit::WebScreenInfo& screen_info,
367 const PrefServiceBase& prefs, 370 const PrefServiceBase& prefs,
368 const base::Callback<void(scoped_ptr<Fingerprint>)>& callback) { 371 const base::Callback<void(scoped_ptr<Fingerprint>)>& callback) {
369 // TODO(isherman): Add a DCHECK that the ToS have been accepted prior to 372 gfx::Rect content_bounds;
370 // calling into this method. Also, ensure that the UI contains a clear 373 web_contents.GetView()->GetContainerBounds(&content_bounds);
371 // indication to the user as to what data will be collected. Until then, this
372 // code should not be called.
373 374
374 // TODO(isherman): In order to actually be able to pass in the WebScreenInfo 375 WebKit::WebScreenInfo screen_info;
375 // that's used here, we'll need to expose RenderWidgetHostImpl's 376 content::RenderWidgetHostView* host_view =
376 // GetWebScreenInfo() as part of the public RenderWidgetHost interface. 377 web_contents.GetRenderWidgetHostView();
377 // We can then access it via the dialog's WebContents pointer. 378 if (host_view)
379 host_view->GetRenderWidgetHost()->GetWebScreenInfo(&screen_info);
378 380
379 // Begin loading all of the data that we need to load asynchronously. 381 // Begin loading all of the data that we need to load asynchronously.
380 // This class is responsible for freeing its own memory. 382 // This class is responsible for freeing its own memory.
381 new FingerprintDataLoader(gaia_id, window_bounds, content_bounds, 383 new FingerprintDataLoader(gaia_id, window_bounds, content_bounds, screen_info,
382 screen_info, prefs, callback); 384 prefs, callback);
383 } 385 }
384 386
385 } // namespace risk 387 } // namespace risk
386 } // namespace autofill 388 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698