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" |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/callback_helpers.h" | 12 #include "base/callback_helpers.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "chrome/browser/chromeos/arc/arc_auth_context.h" | 17 #include "chrome/browser/chromeos/arc/arc_auth_context.h" |
| 18 #include "chrome/browser/chromeos/arc/arc_optin_uma.h" | 18 #include "chrome/browser/chromeos/arc/arc_optin_uma.h" |
| 19 #include "chrome/browser/chromeos/arc/arc_support_host.h" | 19 #include "chrome/browser/chromeos/arc/arc_support_host.h" |
| 20 #include "chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator.h" | 20 #include "chrome/browser/chromeos/arc/optin/arc_terms_of_service_default_negotia tor.h" |
| 21 #include "chrome/browser/chromeos/arc/optin/arc_terms_of_service_oobe_negotiator .h" | |
| 21 #include "chrome/browser/chromeos/arc/policy/arc_android_management_checker.h" | 22 #include "chrome/browser/chromeos/arc/policy/arc_android_management_checker.h" |
| 22 #include "chrome/browser/chromeos/arc/policy/arc_policy_util.h" | 23 #include "chrome/browser/chromeos/arc/policy/arc_policy_util.h" |
| 23 #include "chrome/browser/chromeos/login/user_flow.h" | 24 #include "chrome/browser/chromeos/login/user_flow.h" |
| 24 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 25 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
| 25 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 26 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 26 #include "chrome/browser/lifetime/application_lifetime.h" | 27 #include "chrome/browser/lifetime/application_lifetime.h" |
| 27 #include "chrome/browser/policy/profile_policy_connector.h" | 28 #include "chrome/browser/policy/profile_policy_connector.h" |
| 28 #include "chrome/browser/policy/profile_policy_connector_factory.h" | 29 #include "chrome/browser/policy/profile_policy_connector_factory.h" |
| 29 #include "chrome/browser/prefs/pref_service_syncable_util.h" | 30 #include "chrome/browser/prefs/pref_service_syncable_util.h" |
| 30 #include "chrome/browser/profiles/profile.h" | 31 #include "chrome/browser/profiles/profile.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 ash::ShelfDelegate* GetShelfDelegate() { | 72 ash::ShelfDelegate* GetShelfDelegate() { |
| 72 if (g_shelf_delegate_for_testing) | 73 if (g_shelf_delegate_for_testing) |
| 73 return g_shelf_delegate_for_testing; | 74 return g_shelf_delegate_for_testing; |
| 74 if (ash::WmShell::HasInstance()) { | 75 if (ash::WmShell::HasInstance()) { |
| 75 DCHECK(ash::WmShell::Get()->shelf_delegate()); | 76 DCHECK(ash::WmShell::Get()->shelf_delegate()); |
| 76 return ash::WmShell::Get()->shelf_delegate(); | 77 return ash::WmShell::Get()->shelf_delegate(); |
| 77 } | 78 } |
| 78 return nullptr; | 79 return nullptr; |
| 79 } | 80 } |
| 80 | 81 |
| 82 bool IsFirstRunForOobeEnabledUser() { | |
| 83 // ARC OOBE OptIn is optional for now. Test if it exists and current user is | |
| 84 // first time user. | |
| 85 return user_manager::UserManager::Get()->IsCurrentUserNew() && | |
| 86 base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 87 chromeos::switches::kEnableArcOOBEOptIn); | |
| 88 } | |
| 89 | |
| 81 } // namespace | 90 } // namespace |
| 82 | 91 |
| 83 ArcSessionManager::ArcSessionManager(ArcBridgeService* bridge_service) | 92 ArcSessionManager::ArcSessionManager(ArcBridgeService* bridge_service) |
| 84 : ArcService(bridge_service), | 93 : ArcService(bridge_service), |
| 85 attempt_user_exit_callback_(base::Bind(chrome::AttemptUserExit)), | 94 attempt_user_exit_callback_(base::Bind(chrome::AttemptUserExit)), |
| 86 weak_ptr_factory_(this) { | 95 weak_ptr_factory_(this) { |
| 87 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 96 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 88 DCHECK(!g_arc_session_manager); | 97 DCHECK(!g_arc_session_manager); |
| 89 g_arc_session_manager = this; | 98 g_arc_session_manager = this; |
| 90 | 99 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 264 // Restart ARC anyway. Let the enterprise reporting instance decide whether | 273 // Restart ARC anyway. Let the enterprise reporting instance decide whether |
| 265 // the ARC user data wipe is still required or not. | 274 // the ARC user data wipe is still required or not. |
| 266 reenable_arc_ = false; | 275 reenable_arc_ = false; |
| 267 VLOG(1) << "Reenable ARC"; | 276 VLOG(1) << "Reenable ARC"; |
| 268 EnableArc(); | 277 EnableArc(); |
| 269 } | 278 } |
| 270 | 279 |
| 271 void ArcSessionManager::OnProvisioningFinished(ProvisioningResult result) { | 280 void ArcSessionManager::OnProvisioningFinished(ProvisioningResult result) { |
| 272 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 281 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 273 | 282 |
| 274 // Due asynchronous nature of stopping Arc bridge, OnProvisioningFinished may | 283 // Due asynchronous nature of stopping ARC bridge, OnProvisioningFinished may |
| 275 // arrive after setting the |State::STOPPED| state and |State::Active| is not | 284 // arrive after setting the |State::STOPPED| state and |State::Active| is not |
| 276 // guaranty set here. prefs::kArcDataRemoveRequested is also can be active | 285 // guaranty set here. prefs::kArcDataRemoveRequested is also can be active |
| 277 // for now. | 286 // for now. |
| 278 | 287 |
| 279 if (provisioning_reported_) { | 288 if (provisioning_reported_) { |
| 280 // We don't expect ProvisioningResult::SUCCESS is reported twice or reported | 289 // We don't expect ProvisioningResult::SUCCESS is reported twice or reported |
| 281 // after an error. | 290 // after an error. |
| 282 DCHECK_NE(result, ProvisioningResult::SUCCESS); | 291 DCHECK_NE(result, ProvisioningResult::SUCCESS); |
| 283 // TODO (khmel): Consider changing LOG to NOTREACHED once we guaranty that | 292 // TODO (khmel): Consider changing LOG to NOTREACHED once we guaranty that |
| 284 // no double message can happen in production. | 293 // no double message can happen in production. |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 439 | 448 |
| 440 PrefServiceSyncableFromProfile(profile_)->AddSyncedPrefObserver( | 449 PrefServiceSyncableFromProfile(profile_)->AddSyncedPrefObserver( |
| 441 prefs::kArcEnabled, this); | 450 prefs::kArcEnabled, this); |
| 442 | 451 |
| 443 context_.reset(new ArcAuthContext(profile_)); | 452 context_.reset(new ArcAuthContext(profile_)); |
| 444 | 453 |
| 445 if (!g_disable_ui_for_testing || | 454 if (!g_disable_ui_for_testing || |
| 446 g_enable_check_android_management_for_testing) { | 455 g_enable_check_android_management_for_testing) { |
| 447 ArcAndroidManagementChecker::StartClient(); | 456 ArcAndroidManagementChecker::StartClient(); |
| 448 } | 457 } |
| 458 | |
| 459 const bool first_run_oobe_enabled_user = IsFirstRunForOobeEnabledUser(); | |
| 460 if (first_run_oobe_enabled_user) | |
| 461 StartTermsOfServiceNegotiation(NegotiatorType::OOBE); | |
|
hidehiko
2016/12/15 03:04:07
For the record;
As we discussed offline, could yo
khmel
2016/12/16 01:43:34
Done.
| |
| 462 | |
| 449 pref_change_registrar_.Init(profile_->GetPrefs()); | 463 pref_change_registrar_.Init(profile_->GetPrefs()); |
| 450 pref_change_registrar_.Add( | 464 pref_change_registrar_.Add( |
| 451 prefs::kArcEnabled, | 465 prefs::kArcEnabled, |
| 452 base::Bind(&ArcSessionManager::OnOptInPreferenceChanged, | 466 base::Bind(&ArcSessionManager::OnOptInPreferenceChanged, |
| 453 weak_ptr_factory_.GetWeakPtr())); | 467 weak_ptr_factory_.GetWeakPtr())); |
| 454 if (profile_->GetPrefs()->GetBoolean(prefs::kArcEnabled)) { | 468 if (profile_->GetPrefs()->GetBoolean(prefs::kArcEnabled)) { |
| 455 // Don't start ARC if there is a pending request to remove the data. Restart | 469 // Don't start ARC if there is a pending request to remove the data. Restart |
| 456 // ARC once data removal finishes. | 470 // ARC once data removal finishes. |
| 457 if (profile_->GetPrefs()->GetBoolean(prefs::kArcDataRemoveRequested)) { | 471 if (profile_->GetPrefs()->GetBoolean(prefs::kArcDataRemoveRequested)) { |
| 458 reenable_arc_ = true; | 472 reenable_arc_ = true; |
| 459 RemoveArcData(); | 473 RemoveArcData(); |
| 460 } else { | 474 } else { |
| 461 OnOptInPreferenceChanged(); | 475 OnOptInPreferenceChanged(); |
| 462 } | 476 } |
| 463 } else { | 477 } else { |
| 464 RemoveArcData(); | 478 if (!first_run_oobe_enabled_user) |
|
khmel
2016/12/14 01:27:59
It is quite tricky to sync two processes which cha
| |
| 479 RemoveArcData(); | |
| 465 PrefServiceSyncableFromProfile(profile_)->AddObserver(this); | 480 PrefServiceSyncableFromProfile(profile_)->AddObserver(this); |
| 466 OnIsSyncingChanged(); | 481 OnIsSyncingChanged(); |
| 467 } | 482 } |
| 468 } | 483 } |
| 469 | 484 |
| 470 void ArcSessionManager::OnIsSyncingChanged() { | 485 void ArcSessionManager::OnIsSyncingChanged() { |
| 471 sync_preferences::PrefServiceSyncable* const pref_service_syncable = | 486 sync_preferences::PrefServiceSyncable* const pref_service_syncable = |
| 472 PrefServiceSyncableFromProfile(profile_); | 487 PrefServiceSyncableFromProfile(profile_); |
| 473 if (!pref_service_syncable->IsSyncing()) | 488 if (!pref_service_syncable->IsSyncing()) |
| 474 return; | 489 return; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 543 reenable_arc_ = false; | 558 reenable_arc_ = false; |
| 544 StopArc(); | 559 StopArc(); |
| 545 RemoveArcData(); | 560 RemoveArcData(); |
| 546 return; | 561 return; |
| 547 } | 562 } |
| 548 | 563 |
| 549 if (state_ == State::ACTIVE) | 564 if (state_ == State::ACTIVE) |
| 550 return; | 565 return; |
| 551 | 566 |
| 552 if (state_ == State::REMOVING_DATA_DIR) { | 567 if (state_ == State::REMOVING_DATA_DIR) { |
| 553 // Data removal request is in progress. Set flag to re-enable Arc once it is | 568 // Data removal request is in progress. Set flag to re-enable ARC once it is |
| 554 // finished. | 569 // finished. |
| 555 reenable_arc_ = true; | 570 reenable_arc_ = true; |
| 556 return; | 571 return; |
| 557 } | 572 } |
| 558 | 573 |
| 559 if (support_host_) | 574 if (support_host_) |
| 560 support_host_->SetArcManaged(IsArcManaged()); | 575 support_host_->SetArcManaged(IsArcManaged()); |
| 561 | 576 |
| 562 // For ARC Kiosk we skip ToS because it is very likely that near the device | 577 // For ARC Kiosk we skip ToS because it is very likely that near the device |
| 563 // there will be no one who is eligible to accept them. | 578 // there will be no one who is eligible to accept them. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 598 } | 613 } |
| 599 | 614 |
| 600 // If it is marked that the Terms of service is accepted already, | 615 // If it is marked that the Terms of service is accepted already, |
| 601 // just skip the negotiation with user, and start Android management | 616 // just skip the negotiation with user, and start Android management |
| 602 // check directly. | 617 // check directly. |
| 603 // This happens, e.g., when; | 618 // This happens, e.g., when; |
| 604 // 1) User accepted the Terms of service on OOBE flow. | 619 // 1) User accepted the Terms of service on OOBE flow. |
| 605 // 2) User accepted the Terms of service on Opt-in flow, but logged out | 620 // 2) User accepted the Terms of service on Opt-in flow, but logged out |
| 606 // before ARC sign in procedure was done. Then, logs in again. | 621 // before ARC sign in procedure was done. Then, logs in again. |
| 607 if (profile_->GetPrefs()->GetBoolean(prefs::kArcTermsAccepted)) { | 622 if (profile_->GetPrefs()->GetBoolean(prefs::kArcTermsAccepted)) { |
| 608 support_host_->ShowArcLoading(); | 623 // Don't show UI for this progress if it was not shown. |
| 624 if (support_host_->has_message_host()) | |
| 625 support_host_->ShowArcLoading(); | |
| 609 StartArcAndroidManagementCheck(); | 626 StartArcAndroidManagementCheck(); |
| 610 return; | 627 return; |
| 611 } | 628 } |
| 612 | 629 |
| 613 // Need user's explicit Terms Of Service agreement. | 630 // Need user's explicit Terms Of Service agreement. There is the case when Arc |
| 614 StartTermsOfServiceNegotiation(); | 631 // is managed on and we have OOBE negotiator already set. |
| 632 if (!terms_of_service_negotiator_) | |
| 633 StartTermsOfServiceNegotiation(NegotiatorType::DEFAULT); | |
| 615 } | 634 } |
| 616 | 635 |
| 617 void ArcSessionManager::ShutdownBridge() { | 636 void ArcSessionManager::ShutdownBridge() { |
| 618 arc_sign_in_timer_.Stop(); | 637 arc_sign_in_timer_.Stop(); |
| 619 playstore_launcher_.reset(); | 638 playstore_launcher_.reset(); |
| 620 terms_of_service_negotiator_.reset(); | 639 terms_of_service_negotiator_.reset(); |
| 621 android_management_checker_.reset(); | 640 android_management_checker_.reset(); |
| 622 arc_bridge_service()->RequestStop(); | 641 arc_bridge_service()->RequestStop(); |
| 623 if (state_ != State::NOT_INITIALIZED && state_ != State::REMOVING_DATA_DIR) | 642 if (state_ != State::NOT_INITIALIZED && state_ != State::REMOVING_DATA_DIR) |
| 624 SetState(State::STOPPED); | 643 SetState(State::STOPPED); |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 641 void ArcSessionManager::StopAndEnableArc() { | 660 void ArcSessionManager::StopAndEnableArc() { |
| 642 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 661 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 643 DCHECK(!arc_bridge_service()->stopped()); | 662 DCHECK(!arc_bridge_service()->stopped()); |
| 644 reenable_arc_ = true; | 663 reenable_arc_ = true; |
| 645 StopArc(); | 664 StopArc(); |
| 646 } | 665 } |
| 647 | 666 |
| 648 void ArcSessionManager::StartArc() { | 667 void ArcSessionManager::StartArc() { |
| 649 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 668 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 650 | 669 |
| 651 // Arc must be started only if no pending data removal request exists. | 670 // ARC must be started only if no pending data removal request exists. |
| 652 DCHECK(!profile_->GetPrefs()->GetBoolean(prefs::kArcDataRemoveRequested)); | 671 DCHECK(!profile_->GetPrefs()->GetBoolean(prefs::kArcDataRemoveRequested)); |
| 653 | 672 |
| 654 provisioning_reported_ = false; | 673 provisioning_reported_ = false; |
| 655 | 674 |
| 656 arc_bridge_service()->RequestStart(); | 675 arc_bridge_service()->RequestStart(); |
| 657 SetState(State::ACTIVE); | 676 SetState(State::ACTIVE); |
| 658 } | 677 } |
| 659 | 678 |
| 660 void ArcSessionManager::OnArcSignInTimeout() { | 679 void ArcSessionManager::OnArcSignInTimeout() { |
| 661 LOG(ERROR) << "Timed out waiting for first sign in."; | 680 LOG(ERROR) << "Timed out waiting for first sign in."; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 729 profile_->GetPrefs()->SetBoolean(prefs::kArcEnabled, false); | 748 profile_->GetPrefs()->SetBoolean(prefs::kArcEnabled, false); |
| 730 } | 749 } |
| 731 | 750 |
| 732 void ArcSessionManager::RecordArcState() { | 751 void ArcSessionManager::RecordArcState() { |
| 733 // Only record Enabled state if ARC is allowed in the first place, so we do | 752 // Only record Enabled state if ARC is allowed in the first place, so we do |
| 734 // not split the ARC population by devices that cannot run ARC. | 753 // not split the ARC population by devices that cannot run ARC. |
| 735 if (IsAllowed()) | 754 if (IsAllowed()) |
| 736 UpdateEnabledStateUMA(IsArcEnabled()); | 755 UpdateEnabledStateUMA(IsArcEnabled()); |
| 737 } | 756 } |
| 738 | 757 |
| 739 void ArcSessionManager::StartTermsOfServiceNegotiation() { | 758 void ArcSessionManager::StartTermsOfServiceNegotiation(NegotiatorType type) { |
| 740 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 759 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 741 DCHECK(!terms_of_service_negotiator_); | 760 DCHECK(!terms_of_service_negotiator_); |
| 742 | 761 |
| 743 if (!arc_bridge_service()->stopped()) { | 762 if (!arc_bridge_service()->stopped()) { |
| 744 // If the user attempts to re-enable ARC while the bridge is still running | 763 // If the user attempts to re-enable ARC while the bridge is still running |
| 745 // the user should not be able to continue until the bridge has stopped. | 764 // the user should not be able to continue until the bridge has stopped. |
| 746 if (support_host_) { | 765 if (support_host_) { |
| 747 support_host_->ShowError( | 766 support_host_->ShowError( |
| 748 ArcSupportHost::Error::SIGN_IN_SERVICE_UNAVAILABLE_ERROR, false); | 767 ArcSupportHost::Error::SIGN_IN_SERVICE_UNAVAILABLE_ERROR, false); |
| 749 } | 768 } |
| 750 return; | 769 return; |
| 751 } | 770 } |
| 752 | 771 |
| 753 SetState(State::SHOWING_TERMS_OF_SERVICE); | 772 SetState(State::SHOWING_TERMS_OF_SERVICE); |
| 754 if (support_host_) { | 773 if (support_host_) { |
| 755 terms_of_service_negotiator_ = | 774 switch (type) { |
| 756 base::MakeUnique<ArcTermsOfServiceNegotiator>(profile_->GetPrefs(), | 775 case NegotiatorType::DEFAULT: |
| 757 support_host_.get()); | 776 terms_of_service_negotiator_ = |
| 777 base::MakeUnique<ArcTermsOfServiceDefaultNegotiator>( | |
| 778 profile_->GetPrefs(), support_host_.get()); | |
| 779 break; | |
| 780 case NegotiatorType::OOBE: | |
| 781 terms_of_service_negotiator_ = | |
| 782 base::MakeUnique<ArcTermsOfServiceOOBENegotiator>( | |
| 783 profile_->GetPrefs()); | |
| 784 break; | |
| 785 default: | |
| 786 NOTREACHED(); | |
| 787 return; | |
| 788 } | |
| 758 terms_of_service_negotiator_->StartNegotiation( | 789 terms_of_service_negotiator_->StartNegotiation( |
| 759 base::Bind(&ArcSessionManager::OnTermsOfServiceNegotiated, | 790 base::Bind(&ArcSessionManager::OnTermsOfServiceNegotiated, |
| 760 weak_ptr_factory_.GetWeakPtr())); | 791 weak_ptr_factory_.GetWeakPtr())); |
| 761 } | 792 } |
| 762 } | 793 } |
| 763 | 794 |
| 764 void ArcSessionManager::OnTermsOfServiceNegotiated(bool accepted) { | 795 void ArcSessionManager::OnTermsOfServiceNegotiated(bool accepted) { |
| 765 DCHECK(terms_of_service_negotiator_); | 796 DCHECK(terms_of_service_negotiator_); |
| 766 terms_of_service_negotiator_.reset(); | 797 terms_of_service_negotiator_.reset(); |
| 767 | 798 |
| 768 if (!accepted) { | 799 if (!accepted) { |
| 769 // To cancel, user needs to close the window. Note that clicking "Cancel" | 800 // To cancel, user needs to close the window. Note that clicking "Cancel" |
| 770 // button effectively just closes the window. | 801 // button effectively just closes the window. |
| 771 CancelAuthCode(); | 802 CancelAuthCode(); |
| 772 return; | 803 return; |
| 773 } | 804 } |
| 774 | 805 |
| 775 // Terms were accepted. | 806 // Terms were accepted. |
| 776 profile_->GetPrefs()->SetBoolean(prefs::kArcTermsAccepted, true); | 807 profile_->GetPrefs()->SetBoolean(prefs::kArcTermsAccepted, true); |
| 777 | 808 |
| 778 support_host_->ShowArcLoading(); | 809 // Don't show UI for this progress if it was not shown. |
| 810 if (support_host_->has_message_host()) | |
| 811 support_host_->ShowArcLoading(); | |
| 779 StartArcAndroidManagementCheck(); | 812 StartArcAndroidManagementCheck(); |
| 780 } | 813 } |
| 781 | 814 |
| 782 void ArcSessionManager::StartArcAndroidManagementCheck() { | 815 void ArcSessionManager::StartArcAndroidManagementCheck() { |
| 783 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 816 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 784 DCHECK(arc_bridge_service()->stopped()); | 817 DCHECK(arc_bridge_service()->stopped()); |
| 785 DCHECK(state_ == State::SHOWING_TERMS_OF_SERVICE || | 818 DCHECK(state_ == State::SHOWING_TERMS_OF_SERVICE || |
| 786 state_ == State::CHECKING_ANDROID_MANAGEMENT); | 819 state_ == State::CHECKING_ANDROID_MANAGEMENT || |
| 820 (state_ == State::STOPPED && | |
| 821 profile_->GetPrefs()->GetBoolean(prefs::kArcTermsAccepted))); | |
| 787 SetState(State::CHECKING_ANDROID_MANAGEMENT); | 822 SetState(State::CHECKING_ANDROID_MANAGEMENT); |
| 788 | 823 |
| 789 android_management_checker_.reset(new ArcAndroidManagementChecker( | 824 android_management_checker_.reset(new ArcAndroidManagementChecker( |
| 790 profile_, context_->token_service(), context_->account_id(), | 825 profile_, context_->token_service(), context_->account_id(), |
| 791 false /* retry_on_error */)); | 826 false /* retry_on_error */)); |
| 792 android_management_checker_->StartCheck( | 827 android_management_checker_->StartCheck( |
| 793 base::Bind(&ArcSessionManager::OnAndroidManagementChecked, | 828 base::Bind(&ArcSessionManager::OnAndroidManagementChecked, |
| 794 weak_ptr_factory_.GetWeakPtr())); | 829 weak_ptr_factory_.GetWeakPtr())); |
| 795 } | 830 } |
| 796 | 831 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 866 void ArcSessionManager::OnRetryClicked() { | 901 void ArcSessionManager::OnRetryClicked() { |
| 867 DCHECK(support_host_); | 902 DCHECK(support_host_); |
| 868 | 903 |
| 869 UpdateOptInActionUMA(OptInActionType::RETRY); | 904 UpdateOptInActionUMA(OptInActionType::RETRY); |
| 870 | 905 |
| 871 // TODO(hidehiko): Simplify the retry logic. | 906 // TODO(hidehiko): Simplify the retry logic. |
| 872 if (terms_of_service_negotiator_) { | 907 if (terms_of_service_negotiator_) { |
| 873 // Currently Terms of service is shown. ArcTermsOfServiceNegotiator should | 908 // Currently Terms of service is shown. ArcTermsOfServiceNegotiator should |
| 874 // handle this. | 909 // handle this. |
| 875 } else if (!profile_->GetPrefs()->GetBoolean(prefs::kArcTermsAccepted)) { | 910 } else if (!profile_->GetPrefs()->GetBoolean(prefs::kArcTermsAccepted)) { |
| 876 StartTermsOfServiceNegotiation(); | 911 StartTermsOfServiceNegotiation(NegotiatorType::DEFAULT); |
| 877 } else if (support_host_->ui_page() == ArcSupportHost::UIPage::ERROR && | 912 } else if (support_host_->ui_page() == ArcSupportHost::UIPage::ERROR && |
| 878 !arc_bridge_service()->stopped()) { | 913 !arc_bridge_service()->stopped()) { |
| 879 // ERROR_WITH_FEEDBACK is set in OnSignInFailed(). In the case, stopping | 914 // ERROR_WITH_FEEDBACK is set in OnSignInFailed(). In the case, stopping |
| 880 // ARC was postponed to contain its internal state into the report. | 915 // ARC was postponed to contain its internal state into the report. |
| 881 // Here, on retry, stop it, then restart. | 916 // Here, on retry, stop it, then restart. |
| 882 DCHECK_EQ(State::ACTIVE, state_); | 917 DCHECK_EQ(State::ACTIVE, state_); |
| 883 support_host_->ShowArcLoading(); | 918 support_host_->ShowArcLoading(); |
| 884 ShutdownBridge(); | 919 ShutdownBridge(); |
| 885 reenable_arc_ = true; | 920 reenable_arc_ = true; |
| 886 } else if (state_ == State::ACTIVE) { | 921 } else if (state_ == State::ACTIVE) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 923 return os << "ACTIVE"; | 958 return os << "ACTIVE"; |
| 924 } | 959 } |
| 925 | 960 |
| 926 // Some compiler reports an error even if all values of an enum-class are | 961 // Some compiler reports an error even if all values of an enum-class are |
| 927 // covered indivisually in a switch statement. | 962 // covered indivisually in a switch statement. |
| 928 NOTREACHED(); | 963 NOTREACHED(); |
| 929 return os; | 964 return os; |
| 930 } | 965 } |
| 931 | 966 |
| 932 } // namespace arc | 967 } // namespace arc |
| OLD | NEW |