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

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

Issue 630983003: Declaring the weak_ptr_factory in proper order in src/components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « AUTHORS ('k') | components/autofill/core/browser/autofill_external_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 // Data that will be loaded asynchronously. 240 // Data that will be loaded asynchronously.
241 scoped_ptr<base::ListValue> fonts_; 241 scoped_ptr<base::ListValue> fonts_;
242 std::vector<content::WebPluginInfo> plugins_; 242 std::vector<content::WebPluginInfo> plugins_;
243 bool waiting_on_plugins_; 243 bool waiting_on_plugins_;
244 content::Geoposition geoposition_; 244 content::Geoposition geoposition_;
245 245
246 // Timer to enforce a maximum timeout before the |callback_| is called, even 246 // Timer to enforce a maximum timeout before the |callback_| is called, even
247 // if not all asynchronous data has been loaded. 247 // if not all asynchronous data has been loaded.
248 base::OneShotTimer<FingerprintDataLoader> timeout_timer_; 248 base::OneShotTimer<FingerprintDataLoader> timeout_timer_;
249 249
250 // For invalidating asynchronous callbacks that might arrive after |this|
251 // instance is destroyed.
252 base::WeakPtrFactory<FingerprintDataLoader> weak_ptr_factory_;
253
254 // The callback that will be called once all the data is available. 250 // The callback that will be called once all the data is available.
255 base::Callback<void(scoped_ptr<Fingerprint>)> callback_; 251 base::Callback<void(scoped_ptr<Fingerprint>)> callback_;
256 252
257 // The callback used as an "observer" of the GeolocationProvider. 253 // The callback used as an "observer" of the GeolocationProvider.
258 scoped_ptr<content::GeolocationProvider::Subscription> 254 scoped_ptr<content::GeolocationProvider::Subscription>
259 geolocation_subscription_; 255 geolocation_subscription_;
260 256
257 // For invalidating asynchronous callbacks that might arrive after |this|
258 // instance is destroyed.
259 base::WeakPtrFactory<FingerprintDataLoader> weak_ptr_factory_;
260
261 DISALLOW_COPY_AND_ASSIGN(FingerprintDataLoader); 261 DISALLOW_COPY_AND_ASSIGN(FingerprintDataLoader);
262 }; 262 };
263 263
264 FingerprintDataLoader::FingerprintDataLoader( 264 FingerprintDataLoader::FingerprintDataLoader(
265 uint64 obfuscated_gaia_id, 265 uint64 obfuscated_gaia_id,
266 const gfx::Rect& window_bounds, 266 const gfx::Rect& window_bounds,
267 const gfx::Rect& content_bounds, 267 const gfx::Rect& content_bounds,
268 const WebScreenInfo& screen_info, 268 const WebScreenInfo& screen_info,
269 const std::string& version, 269 const std::string& version,
270 const std::string& charset, 270 const std::string& charset,
271 const std::string& accept_languages, 271 const std::string& accept_languages,
272 const base::Time& install_time, 272 const base::Time& install_time,
273 const std::string& app_locale, 273 const std::string& app_locale,
274 const std::string& user_agent, 274 const std::string& user_agent,
275 const base::TimeDelta& timeout, 275 const base::TimeDelta& timeout,
276 const base::Callback<void(scoped_ptr<Fingerprint>)>& callback) 276 const base::Callback<void(scoped_ptr<Fingerprint>)>& callback)
277 : gpu_data_manager_(content::GpuDataManager::GetInstance()), 277 : gpu_data_manager_(content::GpuDataManager::GetInstance()),
278 gpu_observer_(this), 278 gpu_observer_(this),
279 obfuscated_gaia_id_(obfuscated_gaia_id), 279 obfuscated_gaia_id_(obfuscated_gaia_id),
280 window_bounds_(window_bounds), 280 window_bounds_(window_bounds),
281 content_bounds_(content_bounds), 281 content_bounds_(content_bounds),
282 screen_info_(screen_info), 282 screen_info_(screen_info),
283 version_(version), 283 version_(version),
284 charset_(charset), 284 charset_(charset),
285 accept_languages_(accept_languages), 285 accept_languages_(accept_languages),
286 app_locale_(app_locale), 286 app_locale_(app_locale),
287 user_agent_(user_agent), 287 user_agent_(user_agent),
288 install_time_(install_time), 288 install_time_(install_time),
289 waiting_on_plugins_(true), 289 waiting_on_plugins_(true),
290 weak_ptr_factory_(this), 290 callback_(callback),
291 callback_(callback) { 291 weak_ptr_factory_(this) {
292 DCHECK(!install_time_.is_null()); 292 DCHECK(!install_time_.is_null());
293 293
294 timeout_timer_.Start(FROM_HERE, timeout, 294 timeout_timer_.Start(FROM_HERE, timeout,
295 base::Bind(&FingerprintDataLoader::MaybeFillFingerprint, 295 base::Bind(&FingerprintDataLoader::MaybeFillFingerprint,
296 weak_ptr_factory_.GetWeakPtr())); 296 weak_ptr_factory_.GetWeakPtr()));
297 297
298 // Load GPU data if needed. 298 // Load GPU data if needed.
299 if (gpu_data_manager_->GpuAccessAllowed(NULL) && 299 if (gpu_data_manager_->GpuAccessAllowed(NULL) &&
300 !gpu_data_manager_->IsEssentialGpuInfoAvailable()) { 300 !gpu_data_manager_->IsEssentialGpuInfoAvailable()) {
301 gpu_observer_.Add(gpu_data_manager_); 301 gpu_observer_.Add(gpu_data_manager_);
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 host_view->GetRenderWidgetHost()->GetWebScreenInfo(&screen_info); 484 host_view->GetRenderWidgetHost()->GetWebScreenInfo(&screen_info);
485 485
486 internal::GetFingerprintInternal( 486 internal::GetFingerprintInternal(
487 obfuscated_gaia_id, window_bounds, content_bounds, screen_info, version, 487 obfuscated_gaia_id, window_bounds, content_bounds, screen_info, version,
488 charset, accept_languages, install_time, app_locale, user_agent, 488 charset, accept_languages, install_time, app_locale, user_agent,
489 base::TimeDelta::FromSeconds(kTimeoutSeconds), callback); 489 base::TimeDelta::FromSeconds(kTimeoutSeconds), callback);
490 } 490 }
491 491
492 } // namespace risk 492 } // namespace risk
493 } // namespace autofill 493 } // namespace autofill
OLDNEW
« no previous file with comments | « AUTHORS ('k') | components/autofill/core/browser/autofill_external_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698