Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/chromeos/arc/arc_session_manager.h" | 5 #include "chrome/browser/chromeos/arc/arc_session_manager.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/common/shelf/shelf_delegate.h" | 9 #include "ash/common/shelf/shelf_delegate.h" |
| 10 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 224 | 224 |
| 225 MaybeReenableArc(); | 225 MaybeReenableArc(); |
| 226 } | 226 } |
| 227 | 227 |
| 228 void ArcSessionManager::MaybeReenableArc() { | 228 void ArcSessionManager::MaybeReenableArc() { |
| 229 // Here check if |reenable_arc_| is marked or not. | 229 // Here check if |reenable_arc_| is marked or not. |
| 230 // The only case this happens should be in the special case for enterprise | 230 // The only case this happens should be in the special case for enterprise |
| 231 // "on managed lost" case. In that case, OnSessionStopped() should trigger | 231 // "on managed lost" case. In that case, OnSessionStopped() should trigger |
| 232 // the RemoveArcData(), then this. | 232 // the RemoveArcData(), then this. |
| 233 // TODO(hidehiko): It looks necessary to reset |reenable_arc_| regardless of | 233 // TODO(hidehiko): It looks necessary to reset |reenable_arc_| regardless of |
| 234 // IsArcPlayStoreEnabled(). Fix it. | 234 // |enabled_|. Fix it. |
| 235 if (!reenable_arc_ || !IsArcPlayStoreEnabled()) | 235 if (!reenable_arc_ || !enabled_) |
| 236 return; | 236 return; |
| 237 | 237 |
| 238 // Restart ARC anyway. Let the enterprise reporting instance decide whether | 238 // Restart ARC anyway. Let the enterprise reporting instance decide whether |
| 239 // the ARC user data wipe is still required or not. | 239 // the ARC user data wipe is still required or not. |
| 240 reenable_arc_ = false; | 240 reenable_arc_ = false; |
| 241 VLOG(1) << "Reenable ARC"; | 241 VLOG(1) << "Reenable ARC"; |
| 242 OnOptInPreferenceChanged(); | 242 EnableImpl(); |
| 243 } | 243 } |
| 244 | 244 |
| 245 void ArcSessionManager::OnProvisioningFinished(ProvisioningResult result) { | 245 void ArcSessionManager::OnProvisioningFinished(ProvisioningResult result) { |
| 246 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 246 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 247 | 247 |
| 248 // If the Mojo message to notify finishing the provisioning is already sent | 248 // If the Mojo message to notify finishing the provisioning is already sent |
| 249 // from the container, it will be processed even after requesting to stop the | 249 // from the container, it will be processed even after requesting to stop the |
| 250 // container. Ignore all |result|s arriving while ARC is disabled, in order to | 250 // container. Ignore all |result|s arriving while ARC is disabled, in order to |
| 251 // avoid popping up an error message triggered below. This code intentionally | 251 // avoid popping up an error message triggered below. This code intentionally |
| 252 // does not support the case of reenabling. | 252 // does not support the case of reenabling. |
| 253 if (!IsArcPlayStoreEnabled()) { | 253 if (!enabled_) { |
| 254 LOG(WARNING) << "Provisioning result received after ARC was disabled. " | 254 LOG(WARNING) << "Provisioning result received after ARC was disabled. " |
| 255 << "Ignoring result " << static_cast<int>(result) << "."; | 255 << "Ignoring result " << static_cast<int>(result) << "."; |
| 256 return; | 256 return; |
| 257 } | 257 } |
| 258 | 258 |
| 259 // Due asynchronous nature of stopping the ARC instance, | 259 // Due asynchronous nature of stopping the ARC instance, |
| 260 // OnProvisioningFinished may arrive after setting the |State::STOPPED| state | 260 // OnProvisioningFinished may arrive after setting the |State::STOPPED| state |
| 261 // and |State::Active| is not guaranteed to be set here. | 261 // and |State::Active| is not guaranteed to be set here. |
| 262 // prefs::kArcDataRemoveRequested also can be active for now. | 262 // prefs::kArcDataRemoveRequested also can be active for now. |
| 263 | 263 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 411 // TODO(hidehiko): Revisit to think about lazy initialization. | 411 // TODO(hidehiko): Revisit to think about lazy initialization. |
| 412 // | 412 // |
| 413 // Don't show UI for ARC Kiosk because the only one UI in kiosk mode must | 413 // Don't show UI for ARC Kiosk because the only one UI in kiosk mode must |
| 414 // be the kiosk app. In case of error the UI will be useless as well, because | 414 // be the kiosk app. In case of error the UI will be useless as well, because |
| 415 // in typical use case there will be no one nearby the kiosk device, who can | 415 // in typical use case there will be no one nearby the kiosk device, who can |
| 416 // do some action to solve the problem be means of UI. | 416 // do some action to solve the problem be means of UI. |
| 417 if (!g_disable_ui_for_testing && !IsArcOptInVerificationDisabled() && | 417 if (!g_disable_ui_for_testing && !IsArcOptInVerificationDisabled() && |
| 418 !IsArcKioskMode()) { | 418 !IsArcKioskMode()) { |
| 419 DCHECK(!support_host_); | 419 DCHECK(!support_host_); |
| 420 support_host_ = base::MakeUnique<ArcSupportHost>(profile_); | 420 support_host_ = base::MakeUnique<ArcSupportHost>(profile_); |
| 421 support_host_->SetArcManaged(IsArcManaged()); | |
| 421 support_host_->AddObserver(this); | 422 support_host_->AddObserver(this); |
| 422 } | 423 } |
| 423 | 424 |
| 424 DCHECK_EQ(State::NOT_INITIALIZED, state_); | 425 DCHECK_EQ(State::NOT_INITIALIZED, state_); |
| 425 SetState(State::STOPPED); | 426 SetState(State::STOPPED); |
| 426 | 427 |
| 427 context_.reset(new ArcAuthContext(profile_)); | 428 context_.reset(new ArcAuthContext(profile_)); |
| 428 | 429 |
| 429 if (!g_disable_ui_for_testing || | 430 if (!g_disable_ui_for_testing || |
| 430 g_enable_check_android_management_for_testing) { | 431 g_enable_check_android_management_for_testing) { |
| 431 ArcAndroidManagementChecker::StartClient(); | 432 ArcAndroidManagementChecker::StartClient(); |
| 432 } | 433 } |
| 434 | |
| 433 pref_change_registrar_.Init(profile_->GetPrefs()); | 435 pref_change_registrar_.Init(profile_->GetPrefs()); |
| 434 pref_change_registrar_.Add( | 436 pref_change_registrar_.Add( |
| 435 prefs::kArcEnabled, | 437 prefs::kArcEnabled, |
| 436 base::Bind(&ArcSessionManager::OnOptInPreferenceChanged, | 438 base::Bind(&ArcSessionManager::OnOptInPreferenceChanged, |
| 437 weak_ptr_factory_.GetWeakPtr())); | 439 weak_ptr_factory_.GetWeakPtr())); |
| 438 if (profile_->GetPrefs()->GetBoolean(prefs::kArcEnabled)) { | 440 |
| 439 // Don't start ARC if there is a pending request to remove the data. Restart | 441 // Chrome may be shut down before completing ARC data removal. |
| 440 // ARC once data removal finishes. | 442 // In such a case, start removing the data now. |
| 441 if (profile_->GetPrefs()->GetBoolean(prefs::kArcDataRemoveRequested)) { | 443 if (profile_->GetPrefs()->GetBoolean(prefs::kArcDataRemoveRequested)) { |
| 442 reenable_arc_ = true; | 444 VLOG(1) << "ARC data removal requested in previous session."; |
| 443 VLOG(1) << "ARC previously requested to remove data."; | 445 RemoveArcData(); |
| 444 RemoveArcData(); | 446 } |
| 445 } else { | 447 |
| 446 OnOptInPreferenceChanged(); | 448 if (IsArcPlayStoreEnabled()) { |
| 447 } | 449 VLOG(1) << "ARC is already enabled."; |
| 450 DCHECK(!enabled_); | |
| 451 Enable(); | |
| 448 } else { | 452 } else { |
| 449 VLOG(1) << "ARC disabled on profile. Removing data."; | 453 VLOG(1) << "ARC is initially disabled. Removing data."; |
| 450 RemoveArcData(); | 454 RemoveArcData(); |
| 451 PrefServiceSyncableFromProfile(profile_)->AddObserver(this); | 455 PrefServiceSyncableFromProfile(profile_)->AddObserver(this); |
| 452 OnIsSyncingChanged(); | 456 OnIsSyncingChanged(); |
| 453 } | 457 } |
| 454 } | 458 } |
| 455 | 459 |
| 456 void ArcSessionManager::OnIsSyncingChanged() { | 460 void ArcSessionManager::OnIsSyncingChanged() { |
| 457 sync_preferences::PrefServiceSyncable* const pref_service_syncable = | 461 sync_preferences::PrefServiceSyncable* const pref_service_syncable = |
| 458 PrefServiceSyncableFromProfile(profile_); | 462 PrefServiceSyncableFromProfile(profile_); |
| 459 if (!pref_service_syncable->IsSyncing()) | 463 if (!pref_service_syncable->IsSyncing()) |
| 460 return; | 464 return; |
| 461 | 465 |
| 462 pref_service_syncable->RemoveObserver(this); | 466 pref_service_syncable->RemoveObserver(this); |
| 463 if (!g_disable_ui_for_testing && | 467 if (!g_disable_ui_for_testing && |
| 464 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 468 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 465 chromeos::switches::kEnableArcOOBEOptIn) && | 469 chromeos::switches::kEnableArcOOBEOptIn) && |
| 466 profile_->IsNewProfile() && | 470 profile_->IsNewProfile() && |
| 467 !profile_->GetPrefs()->HasPrefPath(prefs::kArcEnabled)) { | 471 !profile_->GetPrefs()->HasPrefPath(prefs::kArcEnabled)) { |
| 468 ArcAuthNotification::Show(profile_); | 472 ArcAuthNotification::Show(profile_); |
| 469 } | 473 } |
| 470 } | 474 } |
| 471 | 475 |
| 472 void ArcSessionManager::Shutdown() { | 476 void ArcSessionManager::Shutdown() { |
| 473 if (!g_disable_ui_for_testing) | 477 if (!g_disable_ui_for_testing) |
| 474 ArcAuthNotification::Hide(); | 478 ArcAuthNotification::Hide(); |
| 475 | 479 |
| 480 enabled_ = false; | |
|
Luis Héctor Chávez
2017/02/15 21:54:43
Ah so this is what makes |enabled_| different from
hidehiko
2017/02/16 02:44:28
Acknowledged.
| |
| 476 ShutdownSession(); | 481 ShutdownSession(); |
| 477 if (support_host_) { | 482 if (support_host_) { |
| 478 support_host_->Close(); | 483 support_host_->Close(); |
| 479 support_host_->RemoveObserver(this); | 484 support_host_->RemoveObserver(this); |
| 480 support_host_.reset(); | 485 support_host_.reset(); |
| 481 } | 486 } |
| 482 if (profile_) { | 487 if (profile_) { |
| 483 sync_preferences::PrefServiceSyncable* pref_service_syncable = | 488 sync_preferences::PrefServiceSyncable* pref_service_syncable = |
| 484 PrefServiceSyncableFromProfile(profile_); | 489 PrefServiceSyncableFromProfile(profile_); |
| 485 pref_service_syncable->RemoveObserver(this); | 490 pref_service_syncable->RemoveObserver(this); |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 513 if (!arc_enabled) { | 518 if (!arc_enabled) { |
| 514 // Remove the pinned Play Store icon launcher in Shelf. | 519 // Remove the pinned Play Store icon launcher in Shelf. |
| 515 // This is only for non-Managed cases. In managed cases, it is expected | 520 // This is only for non-Managed cases. In managed cases, it is expected |
| 516 // to be "disabled" rather than "removed", so keep it here. | 521 // to be "disabled" rather than "removed", so keep it here. |
| 517 ash::ShelfDelegate* shelf_delegate = GetShelfDelegate(); | 522 ash::ShelfDelegate* shelf_delegate = GetShelfDelegate(); |
| 518 if (shelf_delegate) | 523 if (shelf_delegate) |
| 519 shelf_delegate->UnpinAppWithID(ArcSupportHost::kHostAppId); | 524 shelf_delegate->UnpinAppWithID(ArcSupportHost::kHostAppId); |
| 520 } | 525 } |
| 521 } | 526 } |
| 522 | 527 |
| 523 for (auto& observer : observer_list_) | 528 if (support_host_) |
| 524 observer.OnArcPlayStoreEnabledChanged(arc_enabled); | 529 support_host_->SetArcManaged(IsArcManaged()); |
| 525 | 530 |
| 526 // Hide auth notification if it was opened before and arc.enabled pref was | 531 // Hide auth notification if it was opened before and arc.enabled pref was |
| 527 // explicitly set to true or false. | 532 // explicitly set to true or false. |
| 528 if (!g_disable_ui_for_testing && | 533 if (!g_disable_ui_for_testing && |
| 529 profile_->GetPrefs()->HasPrefPath(prefs::kArcEnabled)) { | 534 profile_->GetPrefs()->HasPrefPath(prefs::kArcEnabled)) { |
| 530 ArcAuthNotification::Hide(); | 535 ArcAuthNotification::Hide(); |
| 531 } | 536 } |
| 532 | 537 |
| 533 if (!arc_enabled) { | 538 if (arc_enabled) |
| 534 // Reset any pending request to re-enable ARC. | 539 Enable(); |
| 535 VLOG(1) << "ARC opt-out. Removing user data."; | 540 else |
| 536 reenable_arc_ = false; | 541 Disable(); |
| 537 StopArc(); | |
| 538 RemoveArcData(); | |
| 539 return; | |
| 540 } | |
| 541 | 542 |
| 542 if (state_ == State::ACTIVE) | 543 for (auto& observer : observer_list_) |
| 543 return; | 544 observer.OnArcPlayStoreEnabledChanged(arc_enabled); |
| 544 | |
| 545 if (state_ == State::REMOVING_DATA_DIR) { | |
| 546 // Data removal request is in progress. Set flag to re-enable Arc once it is | |
| 547 // finished. | |
| 548 reenable_arc_ = true; | |
| 549 return; | |
| 550 } | |
| 551 | |
| 552 if (support_host_) | |
| 553 support_host_->SetArcManaged(IsArcManaged()); | |
| 554 | |
| 555 // For ARC Kiosk we skip ToS because it is very likely that near the device | |
| 556 // there will be no one who is eligible to accept them. | |
| 557 // TODO(poromov): Move to more Kiosk dedicated set-up phase. | |
| 558 if (IsArcKioskMode()) | |
| 559 profile_->GetPrefs()->SetBoolean(prefs::kArcTermsAccepted, true); | |
| 560 | |
| 561 // If it is marked that sign in has been successfully done, then directly | |
| 562 // start ARC. | |
| 563 // For testing, and for Kisok mode, we also skip ToS negotiation procedure. | |
| 564 // For backward compatibility, this check needs to be prior to the | |
| 565 // kArcTermsAccepted check below. | |
| 566 if (profile_->GetPrefs()->GetBoolean(prefs::kArcSignedIn) || | |
| 567 IsArcOptInVerificationDisabled() || IsArcKioskMode()) { | |
| 568 StartArc(); | |
| 569 | |
| 570 // Skip Android management check for testing. | |
| 571 // We also skip if Android management check for Kiosk mode, | |
| 572 // because there are no managed human users for Kiosk exist. | |
| 573 if (IsArcOptInVerificationDisabled() || IsArcKioskMode() || | |
| 574 (g_disable_ui_for_testing && | |
| 575 !g_enable_check_android_management_for_testing)) { | |
| 576 return; | |
| 577 } | |
| 578 | |
| 579 // Check Android management in parallel. | |
| 580 // Note: Because the callback may be called in synchronous way (i.e. called | |
| 581 // on the same stack), StartCheck() needs to be called *after* StartArc(). | |
| 582 // Otherwise, SetArcPlayStoreEnabled() which may be called in | |
| 583 // OnBackgroundAndroidManagementChecked() could be ignored. | |
| 584 android_management_checker_ = base::MakeUnique<ArcAndroidManagementChecker>( | |
| 585 profile_, context_->token_service(), context_->account_id(), | |
| 586 true /* retry_on_error */); | |
| 587 android_management_checker_->StartCheck( | |
| 588 base::Bind(&ArcSessionManager::OnBackgroundAndroidManagementChecked, | |
| 589 weak_ptr_factory_.GetWeakPtr())); | |
| 590 return; | |
| 591 } | |
| 592 | |
| 593 // If it is marked that the Terms of service is accepted already, | |
| 594 // just skip the negotiation with user, and start Android management | |
| 595 // check directly. | |
| 596 // This happens, e.g., when; | |
| 597 // 1) User accepted the Terms of service on OOBE flow. | |
| 598 // 2) User accepted the Terms of service on Opt-in flow, but logged out | |
| 599 // before ARC sign in procedure was done. Then, logs in again. | |
| 600 if (profile_->GetPrefs()->GetBoolean(prefs::kArcTermsAccepted)) { | |
| 601 // Don't show UI for this progress if it was not shown. | |
| 602 if (support_host_->ui_page() != ArcSupportHost::UIPage::NO_PAGE) | |
| 603 support_host_->ShowArcLoading(); | |
| 604 StartArcAndroidManagementCheck(); | |
| 605 return; | |
| 606 } | |
| 607 | |
| 608 // Need user's explicit Terms Of Service agreement. Prevent race condition | |
| 609 // when ARC can be enabled before profile is synced. In last case | |
| 610 // OnOptInPreferenceChanged is called twice. | |
| 611 // TODO(crbug.com/687185): Remove the condition. | |
| 612 if (state_ != State::SHOWING_TERMS_OF_SERVICE) | |
| 613 StartTermsOfServiceNegotiation(); | |
| 614 } | 545 } |
| 615 | 546 |
| 616 void ArcSessionManager::ShutdownSession() { | 547 void ArcSessionManager::ShutdownSession() { |
| 617 arc_sign_in_timer_.Stop(); | 548 arc_sign_in_timer_.Stop(); |
| 618 playstore_launcher_.reset(); | 549 playstore_launcher_.reset(); |
| 619 terms_of_service_negotiator_.reset(); | 550 terms_of_service_negotiator_.reset(); |
| 620 android_management_checker_.reset(); | 551 android_management_checker_.reset(); |
| 621 arc_session_runner_->RequestStop(); | 552 arc_session_runner_->RequestStop(); |
| 622 // TODO(hidehiko): The ARC instance's stopping is asynchronous, so it might | 553 // TODO(hidehiko): The ARC instance's stopping is asynchronous, so it might |
| 623 // still be running when we return from this function. Do not set the | 554 // still be running when we return from this function. Do not set the |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 741 return; | 672 return; |
| 742 } | 673 } |
| 743 | 674 |
| 744 profile_->GetPrefs()->SetBoolean(prefs::kArcEnabled, enabled); | 675 profile_->GetPrefs()->SetBoolean(prefs::kArcEnabled, enabled); |
| 745 } | 676 } |
| 746 | 677 |
| 747 void ArcSessionManager::RecordArcState() { | 678 void ArcSessionManager::RecordArcState() { |
| 748 // Only record Enabled state if ARC is allowed in the first place, so we do | 679 // Only record Enabled state if ARC is allowed in the first place, so we do |
| 749 // not split the ARC population by devices that cannot run ARC. | 680 // not split the ARC population by devices that cannot run ARC. |
| 750 if (IsAllowed()) | 681 if (IsAllowed()) |
| 751 UpdateEnabledStateUMA(IsArcPlayStoreEnabled()); | 682 UpdateEnabledStateUMA(enabled_); |
| 683 } | |
| 684 | |
| 685 void ArcSessionManager::Enable() { | |
| 686 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | |
| 687 DCHECK(profile_); | |
| 688 | |
| 689 if (enabled_) { | |
| 690 VLOG(1) << "ARC is already enabled. Do nothing."; | |
| 691 return; | |
| 692 } | |
| 693 enabled_ = true; | |
| 694 | |
| 695 VLOG(1) << "ARC opt-in. Starting ARC session."; | |
| 696 EnableImpl(); | |
| 697 } | |
| 698 | |
| 699 void ArcSessionManager::EnableImpl() { | |
| 700 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | |
| 701 DCHECK(profile_); | |
| 702 DCHECK_NE(state_, State::ACTIVE); | |
| 703 | |
| 704 if (state_ == State::REMOVING_DATA_DIR) { | |
| 705 // Data removal request is in progress. Set flag to re-enable ARC once it | |
| 706 // is finished. | |
| 707 reenable_arc_ = true; | |
| 708 return; | |
| 709 } | |
| 710 | |
| 711 // For ARC Kiosk we skip ToS because it is very likely that near the device | |
| 712 // there will be no one who is eligible to accept them. | |
| 713 // TODO(poromov): Move to more Kiosk dedicated set-up phase. | |
| 714 if (IsArcKioskMode()) | |
| 715 profile_->GetPrefs()->SetBoolean(prefs::kArcTermsAccepted, true); | |
| 716 | |
| 717 // If it is marked that sign in has been successfully done, then directly | |
| 718 // start ARC. | |
| 719 // For testing, and for Kisok mode, we also skip ToS negotiation procedure. | |
| 720 // For backward compatibility, this check needs to be prior to the | |
| 721 // kArcTermsAccepted check below. | |
| 722 if (profile_->GetPrefs()->GetBoolean(prefs::kArcSignedIn) || | |
| 723 IsArcOptInVerificationDisabled() || IsArcKioskMode()) { | |
| 724 StartArc(); | |
| 725 | |
| 726 // Skip Android management check for testing. | |
| 727 // We also skip if Android management check for Kiosk mode, | |
| 728 // because there are no managed human users for Kiosk exist. | |
| 729 if (IsArcOptInVerificationDisabled() || IsArcKioskMode() || | |
| 730 (g_disable_ui_for_testing && | |
| 731 !g_enable_check_android_management_for_testing)) { | |
| 732 return; | |
| 733 } | |
| 734 | |
| 735 // Check Android management in parallel. | |
| 736 // Note: Because the callback may be called in synchronous way (i.e. called | |
| 737 // on the same stack), StartCheck() needs to be called *after* StartArc(). | |
| 738 // Otherwise, SetArcPlayStoreEnabled() which may be called in | |
| 739 // OnBackgroundAndroidManagementChecked() could be ignored. | |
| 740 android_management_checker_ = base::MakeUnique<ArcAndroidManagementChecker>( | |
| 741 profile_, context_->token_service(), context_->account_id(), | |
| 742 true /* retry_on_error */); | |
| 743 android_management_checker_->StartCheck( | |
| 744 base::Bind(&ArcSessionManager::OnBackgroundAndroidManagementChecked, | |
| 745 weak_ptr_factory_.GetWeakPtr())); | |
| 746 return; | |
| 747 } | |
| 748 | |
| 749 // If it is marked that the Terms of service is accepted already, | |
| 750 // just skip the negotiation with user, and start Android management | |
| 751 // check directly. | |
| 752 // This happens, e.g., when; | |
| 753 // 1) User accepted the Terms of service on OOBE flow. | |
| 754 // 2) User accepted the Terms of service on Opt-in flow, but logged out | |
| 755 // before ARC sign in procedure was done. Then, logs in again. | |
| 756 if (profile_->GetPrefs()->GetBoolean(prefs::kArcTermsAccepted)) { | |
| 757 // Don't show UI for this progress if it was not shown. | |
| 758 if (support_host_->ui_page() != ArcSupportHost::UIPage::NO_PAGE) | |
| 759 support_host_->ShowArcLoading(); | |
| 760 StartArcAndroidManagementCheck(); | |
| 761 return; | |
| 762 } | |
| 763 | |
| 764 StartTermsOfServiceNegotiation(); | |
| 765 } | |
| 766 | |
| 767 void ArcSessionManager::Disable() { | |
| 768 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | |
| 769 DCHECK(profile_); | |
| 770 | |
| 771 if (!enabled_) { | |
| 772 VLOG(1) << "ARC is already disabled. Do nothing."; | |
| 773 return; | |
| 774 } | |
| 775 enabled_ = false; | |
| 776 | |
| 777 // Reset any pending request to re-enable ARC. | |
| 778 VLOG(1) << "ARC opt-out. Removing user data."; | |
| 779 reenable_arc_ = false; | |
| 780 StopArc(); | |
| 781 RemoveArcData(); | |
| 752 } | 782 } |
| 753 | 783 |
| 754 void ArcSessionManager::StartTermsOfServiceNegotiation() { | 784 void ArcSessionManager::StartTermsOfServiceNegotiation() { |
| 755 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 785 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 756 DCHECK(!terms_of_service_negotiator_); | 786 DCHECK(!terms_of_service_negotiator_); |
| 757 | 787 |
| 758 if (!arc_session_runner_->IsStopped()) { | 788 if (!arc_session_runner_->IsStopped()) { |
| 759 // If the user attempts to re-enable ARC while the ARC instance is still | 789 // If the user attempts to re-enable ARC while the ARC instance is still |
| 760 // running the user should not be able to continue until the ARC instance | 790 // running the user should not be able to continue until the ARC instance |
| 761 // has stopped. | 791 // has stopped. |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 962 | 992 |
| 963 #undef MAP_STATE | 993 #undef MAP_STATE |
| 964 | 994 |
| 965 // Some compilers report an error even if all values of an enum-class are | 995 // Some compilers report an error even if all values of an enum-class are |
| 966 // covered exhaustively in a switch statement. | 996 // covered exhaustively in a switch statement. |
| 967 NOTREACHED() << "Invalid value " << static_cast<int>(state); | 997 NOTREACHED() << "Invalid value " << static_cast<int>(state); |
| 968 return os; | 998 return os; |
| 969 } | 999 } |
| 970 | 1000 |
| 971 } // namespace arc | 1001 } // namespace arc |
| OLD | NEW |