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

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

Issue 14904002: Load and send Wallet Risk params after user has agreed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 7 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 "components/autofill/browser/risk/fingerprint.h" 5 #include "components/autofill/browser/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"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 gpu_performance->set_graphics_score(gpu_info.performance_stats.graphics); 172 gpu_performance->set_graphics_score(gpu_info.performance_stats.graphics);
173 gpu_performance->set_gaming_score(gpu_info.performance_stats.gaming); 173 gpu_performance->set_gaming_score(gpu_info.performance_stats.gaming);
174 gpu_performance->set_overall_score(gpu_info.performance_stats.overall); 174 gpu_performance->set_overall_score(gpu_info.performance_stats.overall);
175 } 175 }
176 176
177 // Waits for all asynchronous data required for the fingerprint to be loaded; 177 // Waits for all asynchronous data required for the fingerprint to be loaded;
178 // then fills out the fingerprint. 178 // then fills out the fingerprint.
179 class FingerprintDataLoader : public content::GpuDataManagerObserver { 179 class FingerprintDataLoader : public content::GpuDataManagerObserver {
180 public: 180 public:
181 FingerprintDataLoader( 181 FingerprintDataLoader(
182 int64 gaia_id, 182 uint64 obfuscated_gaia_id,
183 const gfx::Rect& window_bounds, 183 const gfx::Rect& window_bounds,
184 const gfx::Rect& content_bounds, 184 const gfx::Rect& content_bounds,
185 const WebScreenInfo& screen_info, 185 const WebScreenInfo& screen_info,
186 const std::string& version, 186 const std::string& version,
187 const std::string& charset, 187 const std::string& charset,
188 const std::string& accept_languages, 188 const std::string& accept_languages,
189 const base::Time& install_time, 189 const base::Time& install_time,
190 DialogType dialog_type, 190 DialogType dialog_type,
191 const std::string& app_locale, 191 const std::string& app_locale,
192 const base::Callback<void(scoped_ptr<Fingerprint>)>& callback); 192 const base::Callback<void(scoped_ptr<Fingerprint>)>& callback);
(...skipping 12 matching lines...) Expand all
205 // the fingerprint data. 205 // the fingerprint data.
206 void MaybeFillFingerprint(); 206 void MaybeFillFingerprint();
207 207
208 // Calls |callback_| with the fingerprint data. 208 // Calls |callback_| with the fingerprint data.
209 void FillFingerprint(); 209 void FillFingerprint();
210 210
211 // The GPU data provider. 211 // The GPU data provider.
212 content::GpuDataManager* const gpu_data_manager_; 212 content::GpuDataManager* const gpu_data_manager_;
213 213
214 // Data that will be passed on to the next loading phase. 214 // Data that will be passed on to the next loading phase.
215 const int64 gaia_id_; 215 const uint64 obfuscated_gaia_id_;
216 const gfx::Rect window_bounds_; 216 const gfx::Rect window_bounds_;
217 const gfx::Rect content_bounds_; 217 const gfx::Rect content_bounds_;
218 const WebScreenInfo screen_info_; 218 const WebScreenInfo screen_info_;
219 const std::string version_; 219 const std::string version_;
220 const std::string charset_; 220 const std::string charset_;
221 const std::string accept_languages_; 221 const std::string accept_languages_;
222 const base::Time install_time_; 222 const base::Time install_time_;
223 DialogType dialog_type_; 223 DialogType dialog_type_;
224 224
225 // Data that will be loaded asynchronously. 225 // Data that will be loaded asynchronously.
226 scoped_ptr<base::ListValue> fonts_; 226 scoped_ptr<base::ListValue> fonts_;
227 std::vector<webkit::WebPluginInfo> plugins_; 227 std::vector<webkit::WebPluginInfo> plugins_;
228 bool has_loaded_plugins_; 228 bool has_loaded_plugins_;
229 229
230 // The current application locale. 230 // The current application locale.
231 std::string app_locale_; 231 std::string app_locale_;
232 232
233 // The callback that will be called once all the data is available. 233 // The callback that will be called once all the data is available.
234 base::Callback<void(scoped_ptr<Fingerprint>)> callback_; 234 base::Callback<void(scoped_ptr<Fingerprint>)> callback_;
235 235
236 DISALLOW_COPY_AND_ASSIGN(FingerprintDataLoader); 236 DISALLOW_COPY_AND_ASSIGN(FingerprintDataLoader);
237 }; 237 };
238 238
239 FingerprintDataLoader::FingerprintDataLoader( 239 FingerprintDataLoader::FingerprintDataLoader(
240 int64 gaia_id, 240 uint64 obfuscated_gaia_id,
241 const gfx::Rect& window_bounds, 241 const gfx::Rect& window_bounds,
242 const gfx::Rect& content_bounds, 242 const gfx::Rect& content_bounds,
243 const WebScreenInfo& screen_info, 243 const WebScreenInfo& screen_info,
244 const std::string& version, 244 const std::string& version,
245 const std::string& charset, 245 const std::string& charset,
246 const std::string& accept_languages, 246 const std::string& accept_languages,
247 const base::Time& install_time, 247 const base::Time& install_time,
248 DialogType dialog_type, 248 DialogType dialog_type,
249 const std::string& app_locale, 249 const std::string& app_locale,
250 const base::Callback<void(scoped_ptr<Fingerprint>)>& callback) 250 const base::Callback<void(scoped_ptr<Fingerprint>)>& callback)
251 : gpu_data_manager_(content::GpuDataManager::GetInstance()), 251 : gpu_data_manager_(content::GpuDataManager::GetInstance()),
252 gaia_id_(gaia_id), 252 obfuscated_gaia_id_(obfuscated_gaia_id),
253 window_bounds_(window_bounds), 253 window_bounds_(window_bounds),
254 content_bounds_(content_bounds), 254 content_bounds_(content_bounds),
255 screen_info_(screen_info), 255 screen_info_(screen_info),
256 version_(version), 256 version_(version),
257 charset_(charset), 257 charset_(charset),
258 accept_languages_(accept_languages), 258 accept_languages_(accept_languages),
259 install_time_(install_time), 259 install_time_(install_time),
260 dialog_type_(dialog_type), 260 dialog_type_(dialog_type),
261 has_loaded_plugins_(false), 261 has_loaded_plugins_(false),
262 callback_(callback) { 262 callback_(callback) {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 outer_window_size->set_height(window_bounds_.height()); 350 outer_window_size->set_height(window_bounds_.height());
351 351
352 // TODO(isherman): Record network performance data, which is theoretically 352 // TODO(isherman): Record network performance data, which is theoretically
353 // available to JS. 353 // available to JS.
354 354
355 // TODO(isherman): Record user behavior data. 355 // TODO(isherman): Record user behavior data.
356 356
357 Fingerprint_Metadata* metadata = fingerprint->mutable_metadata(); 357 Fingerprint_Metadata* metadata = fingerprint->mutable_metadata();
358 metadata->set_timestamp_ms( 358 metadata->set_timestamp_ms(
359 (base::Time::Now() - base::Time::UnixEpoch()).InMilliseconds()); 359 (base::Time::Now() - base::Time::UnixEpoch()).InMilliseconds());
360 metadata->set_gaia_id(gaia_id_); 360 metadata->set_obfuscated_gaia_id(obfuscated_gaia_id_);
361 metadata->set_fingerprinter_version(kFingerprinterVersion); 361 metadata->set_fingerprinter_version(kFingerprinterVersion);
362 362
363 callback_.Run(fingerprint.Pass()); 363 callback_.Run(fingerprint.Pass());
364 } 364 }
365 365
366 } // namespace 366 } // namespace
367 367
368 void GetFingerprint( 368 void GetFingerprint(
369 int64 gaia_id, 369 uint64 obfuscated_gaia_id,
370 const gfx::Rect& window_bounds, 370 const gfx::Rect& window_bounds,
371 const content::WebContents& web_contents, 371 const content::WebContents& web_contents,
372 const std::string& version, 372 const std::string& version,
373 const std::string& charset, 373 const std::string& charset,
374 const std::string& accept_languages, 374 const std::string& accept_languages,
375 const base::Time& install_time, 375 const base::Time& install_time,
376 DialogType dialog_type, 376 DialogType dialog_type,
377 const std::string& app_locale, 377 const std::string& app_locale,
378 const base::Callback<void(scoped_ptr<Fingerprint>)>& callback) { 378 const base::Callback<void(scoped_ptr<Fingerprint>)>& callback) {
379 gfx::Rect content_bounds; 379 gfx::Rect content_bounds;
380 web_contents.GetView()->GetContainerBounds(&content_bounds); 380 web_contents.GetView()->GetContainerBounds(&content_bounds);
381 381
382 WebKit::WebScreenInfo screen_info; 382 WebKit::WebScreenInfo screen_info;
383 content::RenderWidgetHostView* host_view = 383 content::RenderWidgetHostView* host_view =
384 web_contents.GetRenderWidgetHostView(); 384 web_contents.GetRenderWidgetHostView();
385 if (host_view) 385 if (host_view)
386 host_view->GetRenderWidgetHost()->GetWebScreenInfo(&screen_info); 386 host_view->GetRenderWidgetHost()->GetWebScreenInfo(&screen_info);
387 387
388 internal::GetFingerprintInternal( 388 internal::GetFingerprintInternal(
389 gaia_id, window_bounds, content_bounds, screen_info, version, charset, 389 obfuscated_gaia_id, window_bounds, content_bounds, screen_info, version,
390 accept_languages, install_time, dialog_type, app_locale, callback); 390 charset, accept_languages, install_time, dialog_type, app_locale,
391 callback);
391 } 392 }
392 393
393 namespace internal { 394 namespace internal {
394 395
395 void GetFingerprintInternal( 396 void GetFingerprintInternal(
396 int64 gaia_id, 397 uint64 obfuscated_gaia_id,
397 const gfx::Rect& window_bounds, 398 const gfx::Rect& window_bounds,
398 const gfx::Rect& content_bounds, 399 const gfx::Rect& content_bounds,
399 const WebKit::WebScreenInfo& screen_info, 400 const WebKit::WebScreenInfo& screen_info,
400 const std::string& version, 401 const std::string& version,
401 const std::string& charset, 402 const std::string& charset,
402 const std::string& accept_languages, 403 const std::string& accept_languages,
403 const base::Time& install_time, 404 const base::Time& install_time,
404 DialogType dialog_type, 405 DialogType dialog_type,
405 const std::string& app_locale, 406 const std::string& app_locale,
406 const base::Callback<void(scoped_ptr<Fingerprint>)>& callback) { 407 const base::Callback<void(scoped_ptr<Fingerprint>)>& callback) {
407 // Begin loading all of the data that we need to load asynchronously. 408 // Begin loading all of the data that we need to load asynchronously.
408 // This class is responsible for freeing its own memory. 409 // This class is responsible for freeing its own memory.
409 new FingerprintDataLoader(gaia_id, window_bounds, content_bounds, screen_info, 410 new FingerprintDataLoader(obfuscated_gaia_id, window_bounds, content_bounds,
410 version, charset, accept_languages, install_time, 411 screen_info, version, charset, accept_languages,
411 dialog_type, app_locale, callback); 412 install_time, dialog_type, app_locale, callback);
412 } 413 }
413 414
414 } // namespace internal 415 } // namespace internal
415 416
416 } // namespace risk 417 } // namespace risk
417 } // namespace autofill 418 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698