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 "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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 content_bounds_(content_bounds), | 234 content_bounds_(content_bounds), |
235 screen_info_(screen_info), | 235 screen_info_(screen_info), |
236 version_(version), | 236 version_(version), |
237 charset_(charset), | 237 charset_(charset), |
238 accept_languages_(accept_languages), | 238 accept_languages_(accept_languages), |
239 install_time_(install_time), | 239 install_time_(install_time), |
240 has_loaded_plugins_(false), | 240 has_loaded_plugins_(false), |
241 callback_(callback) { | 241 callback_(callback) { |
242 DCHECK(!install_time_.is_null()); | 242 DCHECK(!install_time_.is_null()); |
243 | 243 |
244 // TODO(isherman): Investigating http://crbug.com/174296 | |
245 LOG(WARNING) << "Loading fingerprint data."; | |
246 | |
247 // Load GPU data if needed. | 244 // Load GPU data if needed. |
248 if (!gpu_data_manager_->IsCompleteGpuInfoAvailable()) { | 245 if (!gpu_data_manager_->IsCompleteGpuInfoAvailable()) { |
249 // TODO(isherman): Investigating http://crbug.com/174296 | |
250 LOG(WARNING) << "Loading GPU data."; | |
251 | |
252 gpu_data_manager_->AddObserver(this); | 246 gpu_data_manager_->AddObserver(this); |
253 gpu_data_manager_->RequestCompleteGpuInfoIfNeeded(); | 247 gpu_data_manager_->RequestCompleteGpuInfoIfNeeded(); |
254 } else { | |
255 // TODO(isherman): Investigating http://crbug.com/174296 | |
256 LOG(WARNING) << "GPU data already loaded."; | |
257 } | 248 } |
258 | 249 |
259 // Load plugin data. | 250 // Load plugin data. |
260 content::PluginService::GetInstance()->GetPlugins( | 251 content::PluginService::GetInstance()->GetPlugins( |
261 base::Bind(&FingerprintDataLoader::OnGotPlugins, base::Unretained(this))); | 252 base::Bind(&FingerprintDataLoader::OnGotPlugins, base::Unretained(this))); |
262 | 253 |
263 // Load font data. | 254 // Load font data. |
264 content::GetFontListAsync( | 255 content::GetFontListAsync( |
265 base::Bind(&FingerprintDataLoader::OnGotFonts, base::Unretained(this))); | 256 base::Bind(&FingerprintDataLoader::OnGotFonts, base::Unretained(this))); |
266 } | 257 } |
267 | 258 |
268 FingerprintDataLoader::~FingerprintDataLoader() { | 259 FingerprintDataLoader::~FingerprintDataLoader() { |
269 } | 260 } |
270 | 261 |
271 void FingerprintDataLoader::OnGpuInfoUpdate() { | 262 void FingerprintDataLoader::OnGpuInfoUpdate() { |
272 if (!gpu_data_manager_->IsCompleteGpuInfoAvailable()) { | 263 if (!gpu_data_manager_->IsCompleteGpuInfoAvailable()) |
273 // TODO(isherman): Investigating http://crbug.com/174296 | |
274 LOG(WARNING) << "OnGpuInfoUpdate() called without complete GPU info."; | |
275 return; | 264 return; |
276 } | |
277 | |
278 // TODO(isherman): Investigating http://crbug.com/174296 | |
279 LOG(WARNING) << "Loaded GPU data."; | |
280 | 265 |
281 gpu_data_manager_->RemoveObserver(this); | 266 gpu_data_manager_->RemoveObserver(this); |
282 MaybeFillFingerprint(); | 267 MaybeFillFingerprint(); |
283 } | 268 } |
284 | 269 |
285 void FingerprintDataLoader::OnGotFonts(scoped_ptr<base::ListValue> fonts) { | 270 void FingerprintDataLoader::OnGotFonts(scoped_ptr<base::ListValue> fonts) { |
286 // TODO(isherman): Investigating http://crbug.com/174296 | |
287 LOG(WARNING) << "Loaded fonts."; | |
288 | |
289 DCHECK(!fonts_); | 271 DCHECK(!fonts_); |
290 fonts_.reset(fonts.release()); | 272 fonts_.reset(fonts.release()); |
291 MaybeFillFingerprint(); | 273 MaybeFillFingerprint(); |
292 } | 274 } |
293 | 275 |
294 void FingerprintDataLoader::OnGotPlugins( | 276 void FingerprintDataLoader::OnGotPlugins( |
295 const std::vector<webkit::WebPluginInfo>& plugins) { | 277 const std::vector<webkit::WebPluginInfo>& plugins) { |
296 // TODO(isherman): Investigating http://crbug.com/174296 | |
297 LOG(WARNING) << "Loaded plugins."; | |
298 | |
299 DCHECK(!has_loaded_plugins_); | 278 DCHECK(!has_loaded_plugins_); |
300 has_loaded_plugins_ = true; | 279 has_loaded_plugins_ = true; |
301 plugins_ = plugins; | 280 plugins_ = plugins; |
302 MaybeFillFingerprint(); | 281 MaybeFillFingerprint(); |
303 } | 282 } |
304 | 283 |
305 void FingerprintDataLoader::MaybeFillFingerprint() { | 284 void FingerprintDataLoader::MaybeFillFingerprint() { |
306 // TODO(isherman): Investigating http://crbug.com/174296 | |
307 LOG(WARNING) << "GPU data: " | |
308 << (gpu_data_manager_->IsCompleteGpuInfoAvailable() ? | |
309 "loaded" : | |
310 "waiting"); | |
311 LOG(WARNING) << "Fonts: " | |
312 << (fonts_ ? "loaded" : "waiting"); | |
313 LOG(WARNING) << "Plugins: " | |
314 << (has_loaded_plugins_ ? "loaded" : "waiting"); | |
315 | |
316 // If all of the data has been loaded, fill the fingerprint and clean up. | 285 // If all of the data has been loaded, fill the fingerprint and clean up. |
317 if (gpu_data_manager_->IsCompleteGpuInfoAvailable() && | 286 if (gpu_data_manager_->IsCompleteGpuInfoAvailable() && |
318 fonts_ && | 287 fonts_ && |
319 has_loaded_plugins_) { | 288 has_loaded_plugins_) { |
320 FillFingerprint(); | 289 FillFingerprint(); |
321 delete this; | 290 delete this; |
322 } | 291 } |
323 } | 292 } |
324 | 293 |
325 void FingerprintDataLoader::FillFingerprint() { | 294 void FingerprintDataLoader::FillFingerprint() { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 // This class is responsible for freeing its own memory. | 382 // This class is responsible for freeing its own memory. |
414 new FingerprintDataLoader(gaia_id, window_bounds, content_bounds, screen_info, | 383 new FingerprintDataLoader(gaia_id, window_bounds, content_bounds, screen_info, |
415 version, charset, accept_languages, install_time, | 384 version, charset, accept_languages, install_time, |
416 callback); | 385 callback); |
417 } | 386 } |
418 | 387 |
419 } // namespace internal | 388 } // namespace internal |
420 | 389 |
421 } // namespace risk | 390 } // namespace risk |
422 } // namespace autofill | 391 } // namespace autofill |
OLD | NEW |