OLD | NEW |
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 #include "chrome/browser/profile_resetter/automatic_profile_resetter_delegate.h" | 5 #include "chrome/browser/profile_resetter/automatic_profile_resetter_delegate.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 | 349 |
350 void AutomaticProfileResetterDelegateImpl::RunProfileSettingsReset( | 350 void AutomaticProfileResetterDelegateImpl::RunProfileSettingsReset( |
351 bool send_feedback, | 351 bool send_feedback, |
352 const base::Closure& completion) { | 352 const base::Closure& completion) { |
353 DCHECK(brandcoded_defaults_); | 353 DCHECK(brandcoded_defaults_); |
354 scoped_ptr<ResettableSettingsSnapshot> old_settings_snapshot; | 354 scoped_ptr<ResettableSettingsSnapshot> old_settings_snapshot; |
355 if (send_feedback) { | 355 if (send_feedback) { |
356 old_settings_snapshot.reset(new ResettableSettingsSnapshot(profile_)); | 356 old_settings_snapshot.reset(new ResettableSettingsSnapshot(profile_)); |
357 old_settings_snapshot->RequestShortcuts(base::Closure()); | 357 old_settings_snapshot->RequestShortcuts(base::Closure()); |
358 } | 358 } |
359 profile_resetter_->Reset( | 359 profile_resetter_->Reset(resettable_aspects_, |
360 resettable_aspects_, | 360 brandcoded_defaults_.Pass(), |
361 brandcoded_defaults_.Pass(), | 361 send_feedback, |
362 base::Bind(&AutomaticProfileResetterDelegateImpl:: | 362 base::Bind(&AutomaticProfileResetterDelegateImpl:: |
363 OnProfileSettingsResetCompleted, | 363 OnProfileSettingsResetCompleted, |
364 AsWeakPtr(), | 364 AsWeakPtr(), |
365 completion, | 365 completion, |
366 base::Passed(&old_settings_snapshot))); | 366 base::Passed(&old_settings_snapshot))); |
367 } | 367 } |
368 | 368 |
369 void AutomaticProfileResetterDelegateImpl:: | 369 void AutomaticProfileResetterDelegateImpl:: |
370 OnBrandcodedDefaultsFetched() { | 370 OnBrandcodedDefaultsFetched() { |
371 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 371 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
372 DCHECK(brandcoded_config_fetcher_); | 372 DCHECK(brandcoded_config_fetcher_); |
373 DCHECK(!brandcoded_config_fetcher_->IsActive()); | 373 DCHECK(!brandcoded_config_fetcher_->IsActive()); |
374 brandcoded_defaults_ = brandcoded_config_fetcher_->GetSettings(); | 374 brandcoded_defaults_ = brandcoded_config_fetcher_->GetSettings(); |
375 if (!brandcoded_defaults_) | 375 if (!brandcoded_defaults_) |
376 brandcoded_defaults_.reset(new BrandcodedDefaultSettings); | 376 brandcoded_defaults_.reset(new BrandcodedDefaultSettings); |
(...skipping 11 matching lines...) Expand all Loading... |
388 if (difference) { | 388 if (difference) { |
389 old_settings_snapshot->Subtract(new_settings_snapshot); | 389 old_settings_snapshot->Subtract(new_settings_snapshot); |
390 std::string report = | 390 std::string report = |
391 SerializeSettingsReport(*old_settings_snapshot, difference); | 391 SerializeSettingsReport(*old_settings_snapshot, difference); |
392 SendFeedback(report); | 392 SendFeedback(report); |
393 } | 393 } |
394 } | 394 } |
395 content::BrowserThread::PostTask( | 395 content::BrowserThread::PostTask( |
396 content::BrowserThread::UI, FROM_HERE, user_callback); | 396 content::BrowserThread::UI, FROM_HERE, user_callback); |
397 } | 397 } |
OLD | NEW |