| 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.h" | 5 #include "chrome/browser/profile_resetter/automatic_profile_resetter.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 const uint32 kCombinedStatusMaskMaximumValue = | 100 const uint32 kCombinedStatusMaskMaximumValue = |
| 101 (1u << kCombinedStatusMaskNumberOfBits); | 101 (1u << kCombinedStatusMaskNumberOfBits); |
| 102 | 102 |
| 103 COMPILE_ASSERT( | 103 COMPILE_ASSERT( |
| 104 arraysize(kSatisfiedCriteriaMaskKeys) == kSatisfiedCriteriaMaskNumberOfBits, | 104 arraysize(kSatisfiedCriteriaMaskKeys) == kSatisfiedCriteriaMaskNumberOfBits, |
| 105 satisfied_criteria_mask_bits_mismatch); | 105 satisfied_criteria_mask_bits_mismatch); |
| 106 COMPILE_ASSERT( | 106 COMPILE_ASSERT( |
| 107 arraysize(kCombinedStatusMaskKeys) == kCombinedStatusMaskNumberOfBits, | 107 arraysize(kCombinedStatusMaskKeys) == kCombinedStatusMaskNumberOfBits, |
| 108 combined_status_mask_bits_mismatch); | 108 combined_status_mask_bits_mismatch); |
| 109 | 109 |
| 110 // Enumeration of the possible outcomes of showing the profile reset prompt. | |
| 111 enum PromptResult { | |
| 112 // Prompt was not shown because only a dry-run was performed. | |
| 113 PROMPT_NOT_SHOWN, | |
| 114 PROMPT_ACTION_RESET, | |
| 115 PROMPT_ACTION_NO_RESET, | |
| 116 PROMPT_DISMISSED, | |
| 117 // Prompt was still shown (not dismissed by the user) when Chrome was closed. | |
| 118 PROMPT_IGNORED, | |
| 119 PROMPT_RESULT_MAX | |
| 120 }; | |
| 121 | |
| 122 // Returns whether or not a dry-run shall be performed. | 110 // Returns whether or not a dry-run shall be performed. |
| 123 bool ShouldPerformDryRun() { | 111 bool ShouldPerformDryRun() { |
| 124 return StartsWithASCII( | 112 return StartsWithASCII( |
| 125 base::FieldTrialList::FindFullName(kAutomaticProfileResetStudyName), | 113 base::FieldTrialList::FindFullName(kAutomaticProfileResetStudyName), |
| 126 kAutomaticProfileResetStudyDryRunGroupName, true); | 114 kAutomaticProfileResetStudyDryRunGroupName, true); |
| 127 } | 115 } |
| 128 | 116 |
| 129 // Returns whether or not a live-run shall be performed. | 117 // Returns whether or not a live-run shall be performed. |
| 130 bool ShouldPerformLiveRun() { | 118 bool ShouldPerformLiveRun() { |
| 131 return StartsWithASCII( | 119 return StartsWithASCII( |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 } // namespace | 172 } // namespace |
| 185 | 173 |
| 186 | 174 |
| 187 // AutomaticProfileResetter -------------------------------------------------- | 175 // AutomaticProfileResetter -------------------------------------------------- |
| 188 | 176 |
| 189 AutomaticProfileResetter::AutomaticProfileResetter(Profile* profile) | 177 AutomaticProfileResetter::AutomaticProfileResetter(Profile* profile) |
| 190 : profile_(profile), | 178 : profile_(profile), |
| 191 state_(STATE_UNINITIALIZED), | 179 state_(STATE_UNINITIALIZED), |
| 192 enumeration_of_loaded_modules_ready_(false), | 180 enumeration_of_loaded_modules_ready_(false), |
| 193 template_url_service_ready_(false), | 181 template_url_service_ready_(false), |
| 182 has_shown_bubble_(false), |
| 194 memento_in_prefs_(profile_), | 183 memento_in_prefs_(profile_), |
| 195 memento_in_local_state_(profile_), | 184 memento_in_local_state_(profile_), |
| 196 memento_in_file_(profile_), | 185 memento_in_file_(profile_), |
| 197 weak_ptr_factory_(this) { | 186 weak_ptr_factory_(this) { |
| 198 DCHECK(profile_); | 187 DCHECK(profile_); |
| 199 } | 188 } |
| 200 | 189 |
| 201 AutomaticProfileResetter::~AutomaticProfileResetter() {} | 190 AutomaticProfileResetter::~AutomaticProfileResetter() {} |
| 202 | 191 |
| 203 void AutomaticProfileResetter::Initialize() { | 192 void AutomaticProfileResetter::Initialize() { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 223 hash_seed_ = resources.GetRawDataResource( | 212 hash_seed_ = resources.GetRawDataResource( |
| 224 IDR_AUTOMATIC_PROFILE_RESET_HASH_SEED).as_string(); | 213 IDR_AUTOMATIC_PROFILE_RESET_HASH_SEED).as_string(); |
| 225 } else { // ShouldPerformDryRun() | 214 } else { // ShouldPerformDryRun() |
| 226 program_ = resources.GetRawDataResource( | 215 program_ = resources.GetRawDataResource( |
| 227 IDR_AUTOMATIC_PROFILE_RESET_RULES_DRY).as_string(); | 216 IDR_AUTOMATIC_PROFILE_RESET_RULES_DRY).as_string(); |
| 228 hash_seed_ = resources.GetRawDataResource( | 217 hash_seed_ = resources.GetRawDataResource( |
| 229 IDR_AUTOMATIC_PROFILE_RESET_HASH_SEED_DRY).as_string(); | 218 IDR_AUTOMATIC_PROFILE_RESET_HASH_SEED_DRY).as_string(); |
| 230 } | 219 } |
| 231 | 220 |
| 232 delegate_.reset(new AutomaticProfileResetterDelegateImpl( | 221 delegate_.reset(new AutomaticProfileResetterDelegateImpl( |
| 233 TemplateURLServiceFactory::GetForProfile(profile_))); | 222 profile_, ProfileResetter::ALL)); |
| 234 task_runner_for_waiting_ = | 223 task_runner_for_waiting_ = |
| 235 content::BrowserThread::GetMessageLoopProxyForThread( | 224 content::BrowserThread::GetMessageLoopProxyForThread( |
| 236 content::BrowserThread::UI); | 225 content::BrowserThread::UI); |
| 237 | 226 |
| 238 state_ = STATE_INITIALIZED; | 227 state_ = STATE_INITIALIZED; |
| 239 } | 228 } |
| 240 | 229 |
| 241 void AutomaticProfileResetter::Activate() { | 230 void AutomaticProfileResetter::Activate() { |
| 242 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 231 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 243 DCHECK(state_ == STATE_INITIALIZED || state_ == STATE_DISABLED); | 232 DCHECK(state_ == STATE_INITIALIZED || state_ == STATE_DISABLED); |
| 244 | 233 |
| 245 if (state_ == STATE_INITIALIZED) { | 234 if (state_ == STATE_INITIALIZED) { |
| 246 if (!program_.empty()) { | 235 if (!program_.empty()) { |
| 247 // Some steps in the flow (e.g. loaded modules, file-based memento) are | 236 // Some steps in the flow (e.g. loaded modules, file-based memento) are |
| 248 // IO-intensive, so defer execution until some time later. | 237 // IO-intensive, so defer execution until some time later. |
| 249 task_runner_for_waiting_->PostDelayedTask( | 238 task_runner_for_waiting_->PostDelayedTask( |
| 250 FROM_HERE, | 239 FROM_HERE, |
| 251 base::Bind(&AutomaticProfileResetter::PrepareEvaluationFlow, | 240 base::Bind(&AutomaticProfileResetter::PrepareEvaluationFlow, |
| 252 weak_ptr_factory_.GetWeakPtr()), | 241 weak_ptr_factory_.GetWeakPtr()), |
| 253 base::TimeDelta::FromSeconds(kEvaluationFlowDelayInSeconds)); | 242 base::TimeDelta::FromSeconds(kEvaluationFlowDelayInSeconds)); |
| 254 } else { | 243 } else { |
| 255 // Terminate early if there is no program included (nor set by tests). | 244 // Terminate early if there is no program included (nor set by tests). |
| 256 state_ = STATE_DISABLED; | 245 state_ = STATE_DISABLED; |
| 257 } | 246 } |
| 258 } | 247 } |
| 259 } | 248 } |
| 260 | 249 |
| 250 void AutomaticProfileResetter::TriggerProfileReset(bool send_feedback) { |
| 251 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 252 DCHECK(state_ == STATE_AWAITING_USER_CHOICE || state_ == STATE_DONE); |
| 253 |
| 254 if (state_ == STATE_AWAITING_USER_CHOICE) { |
| 255 state_ = STATE_PERFORMING_RESET; |
| 256 delegate_->TriggerProfileSettingsReset( |
| 257 send_feedback, |
| 258 base::Bind(&AutomaticProfileResetter::OnProfileSettingsResetCompleted, |
| 259 weak_ptr_factory_.GetWeakPtr())); |
| 260 } |
| 261 } |
| 262 |
| 263 void AutomaticProfileResetter::SkipProfileReset() { |
| 264 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 265 DCHECK(state_ == STATE_AWAITING_USER_CHOICE || state_ == STATE_DONE); |
| 266 |
| 267 if (state_ == STATE_AWAITING_USER_CHOICE) { |
| 268 delegate_->DismissPrompt(); |
| 269 FinishResetPromptFlow(PROMPT_ACTION_NO_RESET); |
| 270 } |
| 271 } |
| 272 |
| 273 bool AutomaticProfileResetter::IsResetPromptActive() const { |
| 274 return state_ == STATE_AWAITING_USER_CHOICE; |
| 275 } |
| 276 |
| 277 void AutomaticProfileResetter::NotifyDidShowResetBubble() { |
| 278 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 279 DCHECK(state_ == STATE_AWAITING_USER_CHOICE || state_ == STATE_DONE); |
| 280 |
| 281 if (state_ == STATE_AWAITING_USER_CHOICE) |
| 282 has_shown_bubble_ = true; |
| 283 } |
| 284 |
| 285 void AutomaticProfileResetter::NotifyDidOpenWebUIResetDialog() { |
| 286 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 287 |
| 288 if (state_ == STATE_AWAITING_USER_CHOICE) { |
| 289 delegate_->DismissPrompt(); |
| 290 } |
| 291 } |
| 292 |
| 293 void AutomaticProfileResetter::NotifyDidCloseWebUIResetDialog( |
| 294 bool performed_reset) { |
| 295 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 296 |
| 297 if (state_ == STATE_AWAITING_USER_CHOICE) { |
| 298 FinishResetPromptFlow(has_shown_bubble_ ? |
| 299 (performed_reset ? |
| 300 PROMPT_FOLLOWED_BY_WEBUI_RESET : |
| 301 PROMPT_FOLLOWED_BY_WEBUI_NO_RESET) : |
| 302 (performed_reset ? |
| 303 PROMPT_SUPPRESSED_BUT_HAD_WEBUI_RESET : |
| 304 PROMPT_SUPPRESSED_BUT_HAD_WEBUI_NO_RESET)); |
| 305 } |
| 306 } |
| 307 |
| 308 void AutomaticProfileResetter::Shutdown() { |
| 309 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 310 |
| 311 // Conclude the flow in case the bubble was shown, so as to prevent showing |
| 312 // the prompt on next start-up. |
| 313 if (state_ == STATE_AWAITING_USER_CHOICE && has_shown_bubble_) |
| 314 FinishResetPromptFlow(PROMPT_IGNORED); |
| 315 |
| 316 state_ = STATE_DISABLED; |
| 317 delegate_.reset(); |
| 318 weak_ptr_factory_.InvalidateWeakPtrs(); |
| 319 } |
| 320 |
| 261 void AutomaticProfileResetter::SetProgramForTesting( | 321 void AutomaticProfileResetter::SetProgramForTesting( |
| 262 const std::string& program) { | 322 const std::string& program) { |
| 263 program_ = program; | 323 program_ = program; |
| 264 } | 324 } |
| 265 | 325 |
| 266 void AutomaticProfileResetter::SetHashSeedForTesting( | 326 void AutomaticProfileResetter::SetHashSeedForTesting( |
| 267 const std::string& hash_key) { | 327 const std::string& hash_key) { |
| 268 hash_seed_ = hash_key; | 328 hash_seed_ = hash_key; |
| 269 } | 329 } |
| 270 | 330 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 base::Bind(&AutomaticProfileResetter::BeginEvaluationFlow, | 376 base::Bind(&AutomaticProfileResetter::BeginEvaluationFlow, |
| 317 weak_ptr_factory_.GetWeakPtr())); | 377 weak_ptr_factory_.GetWeakPtr())); |
| 318 } | 378 } |
| 319 } | 379 } |
| 320 | 380 |
| 321 void AutomaticProfileResetter::BeginEvaluationFlow() { | 381 void AutomaticProfileResetter::BeginEvaluationFlow() { |
| 322 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 382 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 323 DCHECK_EQ(state_, STATE_READY); | 383 DCHECK_EQ(state_, STATE_READY); |
| 324 DCHECK(!program_.empty()); | 384 DCHECK(!program_.empty()); |
| 325 | 385 |
| 326 state_ = STATE_WORKING; | 386 state_ = STATE_EVALUATING_CONDITIONS; |
| 327 memento_in_file_.ReadValue( | 387 memento_in_file_.ReadValue( |
| 328 base::Bind(&AutomaticProfileResetter::ContinueWithEvaluationFlow, | 388 base::Bind(&AutomaticProfileResetter::ContinueWithEvaluationFlow, |
| 329 weak_ptr_factory_.GetWeakPtr())); | 389 weak_ptr_factory_.GetWeakPtr())); |
| 330 } | 390 } |
| 331 | 391 |
| 332 scoped_ptr<base::DictionaryValue> | 392 scoped_ptr<base::DictionaryValue> |
| 333 AutomaticProfileResetter::BuildEvaluatorProgramInput( | 393 AutomaticProfileResetter::BuildEvaluatorProgramInput( |
| 334 const std::string& memento_value_in_file) { | 394 const std::string& memento_value_in_file) { |
| 335 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 395 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 336 | 396 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 scoped_ptr<base::ListValue> loaded_module_digests( | 435 scoped_ptr<base::ListValue> loaded_module_digests( |
| 376 delegate_->GetLoadedModuleNameDigests()); | 436 delegate_->GetLoadedModuleNameDigests()); |
| 377 input->Set(kLoadedModuleDigestsKey, loaded_module_digests.release()); | 437 input->Set(kLoadedModuleDigestsKey, loaded_module_digests.release()); |
| 378 | 438 |
| 379 return input.Pass(); | 439 return input.Pass(); |
| 380 } | 440 } |
| 381 | 441 |
| 382 void AutomaticProfileResetter::ContinueWithEvaluationFlow( | 442 void AutomaticProfileResetter::ContinueWithEvaluationFlow( |
| 383 const std::string& memento_value_in_file) { | 443 const std::string& memento_value_in_file) { |
| 384 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 444 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 385 DCHECK_EQ(state_, STATE_WORKING); | 445 DCHECK_EQ(state_, STATE_EVALUATING_CONDITIONS); |
| 386 PrefService* prefs = profile_->GetPrefs(); | 446 PrefService* prefs = profile_->GetPrefs(); |
| 387 DCHECK(prefs); | 447 DCHECK(prefs); |
| 388 | 448 |
| 389 scoped_ptr<base::DictionaryValue> input( | 449 scoped_ptr<base::DictionaryValue> input( |
| 390 BuildEvaluatorProgramInput(memento_value_in_file)); | 450 BuildEvaluatorProgramInput(memento_value_in_file)); |
| 391 | 451 |
| 392 base::SequencedWorkerPool* blocking_pool = | 452 base::SequencedWorkerPool* blocking_pool = |
| 393 content::BrowserThread::GetBlockingPool(); | 453 content::BrowserThread::GetBlockingPool(); |
| 394 scoped_refptr<base::TaskRunner> task_runner = | 454 scoped_refptr<base::TaskRunner> task_runner = |
| 395 blocking_pool->GetTaskRunnerWithShutdownBehavior( | 455 blocking_pool->GetTaskRunnerWithShutdownBehavior( |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 } | 496 } |
| 437 for (size_t i = 0; i < arraysize(kSatisfiedCriteriaMaskKeys); ++i) { | 497 for (size_t i = 0; i < arraysize(kSatisfiedCriteriaMaskKeys); ++i) { |
| 438 bool flag = false; | 498 bool flag = false; |
| 439 if (interpreter.GetOutputBoolean(kSatisfiedCriteriaMaskKeys[i], &flag) && | 499 if (interpreter.GetOutputBoolean(kSatisfiedCriteriaMaskKeys[i], &flag) && |
| 440 flag) | 500 flag) |
| 441 results->satisfied_criteria_mask |= (1 << i); | 501 results->satisfied_criteria_mask |= (1 << i); |
| 442 } | 502 } |
| 443 return results.Pass(); | 503 return results.Pass(); |
| 444 } | 504 } |
| 445 | 505 |
| 446 void AutomaticProfileResetter::FinishEvaluationFlow( | |
| 447 scoped_ptr<EvaluationResults> results) { | |
| 448 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | |
| 449 DCHECK_EQ(state_, STATE_WORKING); | |
| 450 | |
| 451 ReportStatistics(results->satisfied_criteria_mask, | |
| 452 results->combined_status_mask); | |
| 453 | |
| 454 if (results->satisfied_criteria_mask != 0 && !results->had_prompted_already) { | |
| 455 memento_in_prefs_.StoreValue(results->memento_value_in_prefs); | |
| 456 memento_in_local_state_.StoreValue(results->memento_value_in_local_state); | |
| 457 memento_in_file_.StoreValue(results->memento_value_in_file); | |
| 458 | |
| 459 if (ShouldPerformLiveRun()) { | |
| 460 delegate_->ShowPrompt(); | |
| 461 } else { | |
| 462 UMA_HISTOGRAM_ENUMERATION("AutomaticProfileReset.PromptResult", | |
| 463 PROMPT_NOT_SHOWN, | |
| 464 PROMPT_RESULT_MAX); | |
| 465 } | |
| 466 } | |
| 467 | |
| 468 state_ = STATE_DONE; | |
| 469 } | |
| 470 | |
| 471 void AutomaticProfileResetter::ReportStatistics(uint32 satisfied_criteria_mask, | 506 void AutomaticProfileResetter::ReportStatistics(uint32 satisfied_criteria_mask, |
| 472 uint32 combined_status_mask) { | 507 uint32 combined_status_mask) { |
| 473 UMA_HISTOGRAM_ENUMERATION("AutomaticProfileReset.SatisfiedCriteriaMask", | 508 UMA_HISTOGRAM_ENUMERATION("AutomaticProfileReset.SatisfiedCriteriaMask", |
| 474 satisfied_criteria_mask, | 509 satisfied_criteria_mask, |
| 475 kSatisfiedCriteriaMaskMaximumValue); | 510 kSatisfiedCriteriaMaskMaximumValue); |
| 476 UMA_HISTOGRAM_ENUMERATION("AutomaticProfileReset.CombinedStatusMask", | 511 UMA_HISTOGRAM_ENUMERATION("AutomaticProfileReset.CombinedStatusMask", |
| 477 combined_status_mask, | 512 combined_status_mask, |
| 478 kCombinedStatusMaskMaximumValue); | 513 kCombinedStatusMaskMaximumValue); |
| 479 } | 514 } |
| 480 | 515 |
| 481 void AutomaticProfileResetter::Shutdown() { | 516 void AutomaticProfileResetter::FinishEvaluationFlow( |
| 517 scoped_ptr<EvaluationResults> results) { |
| 482 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 518 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 519 DCHECK_EQ(state_, STATE_EVALUATING_CONDITIONS); |
| 483 | 520 |
| 484 state_ = STATE_DISABLED; | 521 evaluation_results_ = results.Pass(); |
| 485 delegate_.reset(); | 522 |
| 486 weak_ptr_factory_.InvalidateWeakPtrs(); | 523 ReportStatistics(evaluation_results_->satisfied_criteria_mask, |
| 524 evaluation_results_->combined_status_mask); |
| 525 |
| 526 if (evaluation_results_->satisfied_criteria_mask != 0 && |
| 527 !evaluation_results_->had_prompted_already) { |
| 528 BeginResetPromptFlow(); |
| 529 } else { |
| 530 state_ = STATE_DONE; |
| 531 } |
| 487 } | 532 } |
| 533 |
| 534 void AutomaticProfileResetter::BeginResetPromptFlow() { |
| 535 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 536 DCHECK_EQ(state_, STATE_EVALUATING_CONDITIONS); |
| 537 |
| 538 state_ = STATE_AWAITING_USER_CHOICE; |
| 539 |
| 540 if (ShouldPerformLiveRun()) { |
| 541 delegate_->ShowPrompt(); |
| 542 // Start fetching brandcode config in the background speculatively. |
| 543 delegate_->FetchBrandcodedDefaultSettingsIfNeeded(); |
| 544 } else { |
| 545 FinishResetPromptFlow(PROMPT_NOT_SHOWN); |
| 546 } |
| 547 } |
| 548 |
| 549 void AutomaticProfileResetter::OnProfileSettingsResetCompleted() { |
| 550 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 551 DCHECK_EQ(state_, STATE_PERFORMING_RESET); |
| 552 |
| 553 delegate_->DismissPrompt(); |
| 554 FinishResetPromptFlow(PROMPT_ACTION_RESET); |
| 555 } |
| 556 |
| 557 void AutomaticProfileResetter::ReportPromptResult(PromptResult result) { |
| 558 UMA_HISTOGRAM_ENUMERATION( |
| 559 "AutomaticProfileReset.PromptResult", result, PROMPT_RESULT_MAX); |
| 560 } |
| 561 |
| 562 void AutomaticProfileResetter::FinishResetPromptFlow(PromptResult result) { |
| 563 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 564 DCHECK(state_ == STATE_PERFORMING_RESET || |
| 565 state_ == STATE_AWAITING_USER_CHOICE); |
| 566 |
| 567 memento_in_prefs_.StoreValue(evaluation_results_->memento_value_in_prefs); |
| 568 memento_in_local_state_.StoreValue( |
| 569 evaluation_results_->memento_value_in_local_state); |
| 570 memento_in_file_.StoreValue(evaluation_results_->memento_value_in_file); |
| 571 |
| 572 ReportPromptResult(result); |
| 573 |
| 574 state_ = STATE_DONE; |
| 575 } |
| OLD | NEW |