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

Side by Side Diff: chrome/browser/chromeos/arc/arc_auth_service.cc

Issue 2501013002: Refactor ArcSupportHost and ArcAuthService part2. (Closed)
Patch Set: rebase Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_auth_service.h" 5 #include "chrome/browser/chromeos/arc/arc_auth_service.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_code_fetcher.h" 17 #include "chrome/browser/chromeos/arc/arc_auth_code_fetcher.h"
18 #include "chrome/browser/chromeos/arc/arc_auth_context.h" 18 #include "chrome/browser/chromeos/arc/arc_auth_context.h"
19 #include "chrome/browser/chromeos/arc/arc_optin_uma.h" 19 #include "chrome/browser/chromeos/arc/arc_optin_uma.h"
20 #include "chrome/browser/chromeos/arc/arc_support_host.h" 20 #include "chrome/browser/chromeos/arc/arc_support_host.h"
21 #include "chrome/browser/chromeos/arc/auth/arc_robot_auth.h" 21 #include "chrome/browser/chromeos/arc/auth/arc_robot_auth.h"
22 #include "chrome/browser/chromeos/arc/optin/arc_optin_preference_handler.h" 22 #include "chrome/browser/chromeos/arc/optin/arc_optin_preference_handler.h"
23 #include "chrome/browser/chromeos/arc/policy/arc_android_management_checker.h" 23 #include "chrome/browser/chromeos/arc/policy/arc_android_management_checker.h"
24 #include "chrome/browser/chromeos/arc/policy/arc_policy_util.h" 24 #include "chrome/browser/chromeos/arc/policy/arc_policy_util.h"
25 #include "chrome/browser/chromeos/profiles/profile_helper.h" 25 #include "chrome/browser/chromeos/profiles/profile_helper.h"
26 #include "chrome/browser/extensions/extension_util.h"
27 #include "chrome/browser/lifetime/application_lifetime.h" 26 #include "chrome/browser/lifetime/application_lifetime.h"
28 #include "chrome/browser/policy/profile_policy_connector.h" 27 #include "chrome/browser/policy/profile_policy_connector.h"
29 #include "chrome/browser/policy/profile_policy_connector_factory.h" 28 #include "chrome/browser/policy/profile_policy_connector_factory.h"
30 #include "chrome/browser/prefs/pref_service_syncable_util.h" 29 #include "chrome/browser/prefs/pref_service_syncable_util.h"
31 #include "chrome/browser/profiles/profile.h" 30 #include "chrome/browser/profiles/profile.h"
32 #include "chrome/browser/ui/app_list/arc/arc_app_launcher.h" 31 #include "chrome/browser/ui/app_list/arc/arc_app_launcher.h"
33 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" 32 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
34 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" 33 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
35 #include "chrome/browser/ui/browser_commands.h" 34 #include "chrome/browser/ui/browser_commands.h"
36 #include "chrome/browser/ui/extensions/app_launch_params.h"
37 #include "chrome/browser/ui/extensions/application_launch.h"
38 #include "chrome/common/pref_names.h" 35 #include "chrome/common/pref_names.h"
39 #include "chrome/grit/generated_resources.h" 36 #include "chrome/grit/generated_resources.h"
40 #include "chromeos/chromeos_switches.h" 37 #include "chromeos/chromeos_switches.h"
41 #include "chromeos/cryptohome/cryptohome_parameters.h" 38 #include "chromeos/cryptohome/cryptohome_parameters.h"
42 #include "chromeos/dbus/dbus_thread_manager.h" 39 #include "chromeos/dbus/dbus_thread_manager.h"
43 #include "chromeos/dbus/session_manager_client.h" 40 #include "chromeos/dbus/session_manager_client.h"
44 #include "components/arc/arc_bridge_service.h" 41 #include "components/arc/arc_bridge_service.h"
45 #include "components/pref_registry/pref_registry_syncable.h" 42 #include "components/pref_registry/pref_registry_syncable.h"
46 #include "components/prefs/pref_service.h" 43 #include "components/prefs/pref_service.h"
47 #include "components/sync_preferences/pref_service_syncable.h" 44 #include "components/sync_preferences/pref_service_syncable.h"
48 #include "components/user_manager/user.h" 45 #include "components/user_manager/user.h"
49 #include "content/public/browser/browser_thread.h" 46 #include "content/public/browser/browser_thread.h"
50 #include "extensions/browser/app_window/app_window_registry.h"
51 #include "extensions/browser/extension_prefs.h" 47 #include "extensions/browser/extension_prefs.h"
52 #include "extensions/browser/extension_registry.h"
53 #include "ui/base/l10n/l10n_util.h"
54 48
55 namespace arc { 49 namespace arc {
56 50
57 namespace { 51 namespace {
58 52
59 constexpr size_t kMinVersionForOnAccountInfoReady = 5; 53 constexpr size_t kMinVersionForOnAccountInfoReady = 5;
60 54
61 // Weak pointer. This class is owned by ArcServiceManager. 55 // Weak pointer. This class is owned by ArcServiceManager.
62 ArcAuthService* g_arc_auth_service = nullptr; 56 ArcAuthService* g_arc_auth_service = nullptr;
63 57
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 DCHECK_EQ(state_, State::ACTIVE); 445 DCHECK_EQ(state_, State::ACTIVE);
452 446
453 if (!sign_in_time_.is_null()) { 447 if (!sign_in_time_.is_null()) {
454 arc_sign_in_timer_.Stop(); 448 arc_sign_in_timer_.Stop();
455 UpdateProvisioningTiming(base::Time::Now() - sign_in_time_, true, 449 UpdateProvisioningTiming(base::Time::Now() - sign_in_time_, true,
456 policy_util::IsAccountManaged(profile_)); 450 policy_util::IsAccountManaged(profile_));
457 UpdateProvisioningResultUMA(ProvisioningResult::SUCCESS, 451 UpdateProvisioningResultUMA(ProvisioningResult::SUCCESS,
458 policy_util::IsAccountManaged(profile_)); 452 policy_util::IsAccountManaged(profile_));
459 } 453 }
460 454
461 CloseUI(); 455 if (support_host_)
456 support_host_->Close();
462 457
463 if (profile_->GetPrefs()->GetBoolean(prefs::kArcSignedIn)) 458 if (profile_->GetPrefs()->GetBoolean(prefs::kArcSignedIn))
464 return; 459 return;
465 460
466 profile_->GetPrefs()->SetBoolean(prefs::kArcSignedIn, true); 461 profile_->GetPrefs()->SetBoolean(prefs::kArcSignedIn, true);
467 if (!IsOptInVerificationDisabled()) { 462 if (!IsOptInVerificationDisabled()) {
468 playstore_launcher_.reset( 463 playstore_launcher_.reset(
469 new ArcAppLauncher(profile_, kPlayStoreAppId, true)); 464 new ArcAppLauncher(profile_, kPlayStoreAppId, true));
470 } 465 }
471 466
(...skipping 13 matching lines...) Expand all
485 if (!sign_in_time_.is_null()) { 480 if (!sign_in_time_.is_null()) {
486 arc_sign_in_timer_.Stop(); 481 arc_sign_in_timer_.Stop();
487 482
488 UpdateProvisioningTiming(base::Time::Now() - sign_in_time_, false, 483 UpdateProvisioningTiming(base::Time::Now() - sign_in_time_, false,
489 policy_util::IsAccountManaged(profile_)); 484 policy_util::IsAccountManaged(profile_));
490 UpdateOptInCancelUMA(OptInCancelReason::CLOUD_PROVISION_FLOW_FAIL); 485 UpdateOptInCancelUMA(OptInCancelReason::CLOUD_PROVISION_FLOW_FAIL);
491 UpdateProvisioningResultUMA(result, 486 UpdateProvisioningResultUMA(result,
492 policy_util::IsAccountManaged(profile_)); 487 policy_util::IsAccountManaged(profile_));
493 } 488 }
494 489
495 int error_message_id; 490 ArcSupportHost::Error error;
496 switch (result) { 491 switch (result) {
497 case ProvisioningResult::GMS_NETWORK_ERROR: 492 case ProvisioningResult::GMS_NETWORK_ERROR:
498 error_message_id = IDS_ARC_SIGN_IN_NETWORK_ERROR; 493 error = ArcSupportHost::Error::SIGN_IN_NETWORK_ERROR;
499 break; 494 break;
500 case ProvisioningResult::GMS_SERVICE_UNAVAILABLE: 495 case ProvisioningResult::GMS_SERVICE_UNAVAILABLE:
501 case ProvisioningResult::GMS_SIGN_IN_FAILED: 496 case ProvisioningResult::GMS_SIGN_IN_FAILED:
502 case ProvisioningResult::GMS_SIGN_IN_TIMEOUT: 497 case ProvisioningResult::GMS_SIGN_IN_TIMEOUT:
503 case ProvisioningResult::GMS_SIGN_IN_INTERNAL_ERROR: 498 case ProvisioningResult::GMS_SIGN_IN_INTERNAL_ERROR:
504 error_message_id = IDS_ARC_SIGN_IN_SERVICE_UNAVAILABLE_ERROR; 499 error = ArcSupportHost::Error::SIGN_IN_SERVICE_UNAVAILABLE_ERROR;
505 break; 500 break;
506 case ProvisioningResult::GMS_BAD_AUTHENTICATION: 501 case ProvisioningResult::GMS_BAD_AUTHENTICATION:
507 error_message_id = IDS_ARC_SIGN_IN_BAD_AUTHENTICATION_ERROR; 502 error = ArcSupportHost::Error::SIGN_IN_BAD_AUTHENTICATION_ERROR;
508 break; 503 break;
509 case ProvisioningResult::DEVICE_CHECK_IN_FAILED: 504 case ProvisioningResult::DEVICE_CHECK_IN_FAILED:
510 case ProvisioningResult::DEVICE_CHECK_IN_TIMEOUT: 505 case ProvisioningResult::DEVICE_CHECK_IN_TIMEOUT:
511 case ProvisioningResult::DEVICE_CHECK_IN_INTERNAL_ERROR: 506 case ProvisioningResult::DEVICE_CHECK_IN_INTERNAL_ERROR:
512 error_message_id = IDS_ARC_SIGN_IN_GMS_NOT_AVAILABLE_ERROR; 507 error = ArcSupportHost::Error::SIGN_IN_GMS_NOT_AVAILABLE_ERROR;
513 break; 508 break;
514 case ProvisioningResult::CLOUD_PROVISION_FLOW_FAILED: 509 case ProvisioningResult::CLOUD_PROVISION_FLOW_FAILED:
515 case ProvisioningResult::CLOUD_PROVISION_FLOW_TIMEOUT: 510 case ProvisioningResult::CLOUD_PROVISION_FLOW_TIMEOUT:
516 case ProvisioningResult::CLOUD_PROVISION_FLOW_INTERNAL_ERROR: 511 case ProvisioningResult::CLOUD_PROVISION_FLOW_INTERNAL_ERROR:
517 error_message_id = IDS_ARC_SIGN_IN_CLOUD_PROVISION_FLOW_FAIL_ERROR; 512 error = ArcSupportHost::Error::SIGN_IN_CLOUD_PROVISION_FLOW_FAIL_ERROR;
518 break; 513 break;
519 default: 514 default:
520 error_message_id = IDS_ARC_SIGN_IN_UNKNOWN_ERROR; 515 error = ArcSupportHost::Error::SIGN_IN_UNKNOWN_ERROR;
521 break; 516 break;
522 } 517 }
523 518
524 if (result == ProvisioningResult::ARC_STOPPED) { 519 if (result == ProvisioningResult::ARC_STOPPED) {
525 if (profile_->GetPrefs()->HasPrefPath(prefs::kArcSignedIn)) 520 if (profile_->GetPrefs()->HasPrefPath(prefs::kArcSignedIn))
526 profile_->GetPrefs()->SetBoolean(prefs::kArcSignedIn, false); 521 profile_->GetPrefs()->SetBoolean(prefs::kArcSignedIn, false);
527 ShutdownBridgeAndShowUI(ArcSupportHost::UIPage::ERROR, 522 ShutdownBridge();
528 l10n_util::GetStringUTF16(error_message_id)); 523 if (support_host_)
524 support_host_->ShowError(error, false);
529 return; 525 return;
530 } 526 }
531 527
532 if (result == ProvisioningResult::CLOUD_PROVISION_FLOW_FAILED || 528 if (result == ProvisioningResult::CLOUD_PROVISION_FLOW_FAILED ||
533 result == ProvisioningResult::CLOUD_PROVISION_FLOW_TIMEOUT || 529 result == ProvisioningResult::CLOUD_PROVISION_FLOW_TIMEOUT ||
534 result == ProvisioningResult::CLOUD_PROVISION_FLOW_INTERNAL_ERROR || 530 result == ProvisioningResult::CLOUD_PROVISION_FLOW_INTERNAL_ERROR ||
535 // OVERALL_SIGN_IN_TIMEOUT might be an indication that ARC believes it is 531 // OVERALL_SIGN_IN_TIMEOUT might be an indication that ARC believes it is
536 // fully setup, but Chrome does not. 532 // fully setup, but Chrome does not.
537 result == ProvisioningResult::OVERALL_SIGN_IN_TIMEOUT || 533 result == ProvisioningResult::OVERALL_SIGN_IN_TIMEOUT ||
538 // Just to be safe, remove data if we don't know the cause. 534 // Just to be safe, remove data if we don't know the cause.
539 result == ProvisioningResult::UNKNOWN_ERROR) { 535 result == ProvisioningResult::UNKNOWN_ERROR) {
540 RemoveArcData(); 536 RemoveArcData();
541 } 537 }
542 538
543 // We'll delay shutting down the bridge in this case to allow people to send 539 // We'll delay shutting down the bridge in this case to allow people to send
544 // feedback. 540 // feedback.
545 ShowUI(ArcSupportHost::UIPage::ERROR_WITH_FEEDBACK, 541 if (support_host_)
546 l10n_util::GetStringUTF16(error_message_id)); 542 support_host_->ShowError(error, true /* = show send feedback button */);
547 } 543 }
548 544
549 void ArcAuthService::GetIsAccountManagedDeprecated( 545 void ArcAuthService::GetIsAccountManagedDeprecated(
550 const GetIsAccountManagedDeprecatedCallback& callback) { 546 const GetIsAccountManagedDeprecatedCallback& callback) {
551 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 547 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
552 548
553 callback.Run(policy_util::IsAccountManaged(profile_)); 549 callback.Run(policy_util::IsAccountManaged(profile_));
554 } 550 }
555 551
556 void ArcAuthService::SetState(State state) { 552 void ArcAuthService::SetState(State state) {
(...skipping 15 matching lines...) Expand all
572 return; 568 return;
573 569
574 // TODO(khmel): Move this to IsAllowedForProfile. 570 // TODO(khmel): Move this to IsAllowedForProfile.
575 if (policy_util::IsArcDisabledForEnterprise() && 571 if (policy_util::IsArcDisabledForEnterprise() &&
576 policy_util::IsAccountManaged(profile)) { 572 policy_util::IsAccountManaged(profile)) {
577 VLOG(2) << "Enterprise users are not supported in ARC."; 573 VLOG(2) << "Enterprise users are not supported in ARC.";
578 return; 574 return;
579 } 575 }
580 576
581 profile_ = profile; 577 profile_ = profile;
578
582 // Create the support host at initialization. Note that, practically, 579 // Create the support host at initialization. Note that, practically,
583 // ARC support Chrome app is rarely used (only opt-in and re-auth flow). 580 // ARC support Chrome app is rarely used (only opt-in and re-auth flow).
584 // So, it may be better to initialize it lazily. 581 // So, it may be better to initialize it lazily.
585 // TODO(hidehiko): Revisit to think about lazy initialization. 582 // TODO(hidehiko): Revisit to think about lazy initialization.
586 support_host_.reset(new ArcSupportHost()); 583 //
587 support_host_->AddObserver(this); 584 // Don't show UI for ARC Kiosk because the only one UI in kiosk mode must
588 if (!g_disable_ui_for_testing && !IsOptInVerificationDisabled()) { 585 // be the kiosk app. In case of error the UI will be useless as well, because
586 // in typical use case there will be no one nearby the kiosk device, who can
587 // do some action to solve the problem be means of UI.
588 if (!g_disable_ui_for_testing && !IsOptInVerificationDisabled() &&
589 !IsArcKioskMode()) {
590 support_host_ = base::MakeUnique<ArcSupportHost>(profile_);
591 support_host_->AddObserver(this);
Luis Héctor Chávez 2016/11/16 02:58:53 I just realized we're not calling ->RemoveObserver
hidehiko 2016/11/16 17:52:21 Addressed in crrev.com/2502243002.
592
589 preference_handler_ = base::MakeUnique<arc::ArcOptInPreferenceHandler>( 593 preference_handler_ = base::MakeUnique<arc::ArcOptInPreferenceHandler>(
590 this, profile_->GetPrefs()); 594 this, profile_->GetPrefs());
591 // This automatically updates all preferences. 595 // This automatically updates all preferences.
592 preference_handler_->Start(); 596 preference_handler_->Start();
593 } 597 }
594 598
595 DCHECK_EQ(State::NOT_INITIALIZED, state_); 599 DCHECK_EQ(State::NOT_INITIALIZED, state_);
596 SetState(State::STOPPED); 600 SetState(State::STOPPED);
597 601
598 PrefServiceSyncableFromProfile(profile_)->AddSyncedPrefObserver( 602 PrefServiceSyncableFromProfile(profile_)->AddSyncedPrefObserver(
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 if (!pref_service_syncable->IsSyncing()) 636 if (!pref_service_syncable->IsSyncing())
633 return; 637 return;
634 638
635 pref_service_syncable->RemoveObserver(this); 639 pref_service_syncable->RemoveObserver(this);
636 640
637 if (IsArcEnabled()) 641 if (IsArcEnabled())
638 OnOptInPreferenceChanged(); 642 OnOptInPreferenceChanged();
639 } 643 }
640 644
641 void ArcAuthService::Shutdown() { 645 void ArcAuthService::Shutdown() {
642 ShutdownBridgeAndCloseUI(); 646 ShutdownBridge();
647 if (support_host_)
648 support_host_->Close();
643 if (profile_) { 649 if (profile_) {
644 sync_preferences::PrefServiceSyncable* pref_service_syncable = 650 sync_preferences::PrefServiceSyncable* pref_service_syncable =
645 PrefServiceSyncableFromProfile(profile_); 651 PrefServiceSyncableFromProfile(profile_);
646 pref_service_syncable->RemoveObserver(this); 652 pref_service_syncable->RemoveObserver(this);
647 pref_service_syncable->RemoveSyncedPrefObserver(prefs::kArcEnabled, this); 653 pref_service_syncable->RemoveSyncedPrefObserver(prefs::kArcEnabled, this);
648 } 654 }
649 pref_change_registrar_.RemoveAll(); 655 pref_change_registrar_.RemoveAll();
650 context_.reset(); 656 context_.reset();
651 profile_ = nullptr; 657 profile_ = nullptr;
652 arc_robot_auth_.reset(); 658 arc_robot_auth_.reset();
653 SetState(State::NOT_INITIALIZED); 659 SetState(State::NOT_INITIALIZED);
654 } 660 }
655 661
656 void ArcAuthService::ShowUI(ArcSupportHost::UIPage page,
657 const base::string16& status) {
658 if (g_disable_ui_for_testing || IsOptInVerificationDisabled())
659 return;
660
661 // Don't show UI for ARC Kiosk because the only one UI in kiosk mode must
662 // be the kiosk app. In case of error the UI will be useless as well, because
663 // in typical use case there will be no one nearby the kiosk device, who can
664 // do some action to solve the problem be means of UI.
665 if (IsArcKioskMode())
666 return;
667
668 SetUIPage(page, status);
669 const extensions::AppWindowRegistry* const app_window_registry =
670 extensions::AppWindowRegistry::Get(profile_);
671 DCHECK(app_window_registry);
672 if (app_window_registry->GetCurrentAppWindowForApp(
673 ArcSupportHost::kHostAppId)) {
674 return;
675 }
676
677 const extensions::Extension* extension =
678 extensions::ExtensionRegistry::Get(profile_)->GetInstalledExtension(
679 ArcSupportHost::kHostAppId);
680 CHECK(extension && extensions::util::IsAppLaunchable(
681 ArcSupportHost::kHostAppId, profile_));
682 OpenApplication(CreateAppLaunchParamsUserContainer(
683 profile_, extension, WindowOpenDisposition::NEW_WINDOW,
684 extensions::SOURCE_CHROME_INTERNAL));
685 }
686
687 void ArcAuthService::OnContextReady() { 662 void ArcAuthService::OnContextReady() {
688 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 663 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
689 FetchAuthCode(); 664 FetchAuthCode();
690 } 665 }
691 666
692 void ArcAuthService::OnSyncedPrefChanged(const std::string& path, 667 void ArcAuthService::OnSyncedPrefChanged(const std::string& path,
693 bool from_sync) { 668 bool from_sync) {
694 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 669 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
695 670
696 // Update UMA only for local changes 671 // Update UMA only for local changes
697 if (!from_sync) { 672 if (!from_sync) {
698 const bool arc_enabled = 673 const bool arc_enabled =
699 profile_->GetPrefs()->GetBoolean(prefs::kArcEnabled); 674 profile_->GetPrefs()->GetBoolean(prefs::kArcEnabled);
700 UpdateOptInActionUMA(arc_enabled ? OptInActionType::OPTED_IN 675 UpdateOptInActionUMA(arc_enabled ? OptInActionType::OPTED_IN
701 : OptInActionType::OPTED_OUT); 676 : OptInActionType::OPTED_OUT);
702 677
703 if (!arc_enabled && !IsArcManaged()) { 678 if (!arc_enabled && !IsArcManaged()) {
704 ash::ShelfDelegate* shelf_delegate = GetShelfDelegate(); 679 ash::ShelfDelegate* shelf_delegate = GetShelfDelegate();
705 if (shelf_delegate) 680 if (shelf_delegate)
706 shelf_delegate->UnpinAppWithID(ArcSupportHost::kHostAppId); 681 shelf_delegate->UnpinAppWithID(ArcSupportHost::kHostAppId);
707 } 682 }
708 } 683 }
709 } 684 }
710 685
711 void ArcAuthService::StopArc() { 686 void ArcAuthService::StopArc() {
712 if (state_ != State::STOPPED) { 687 if (state_ != State::STOPPED) {
713 profile_->GetPrefs()->SetBoolean(prefs::kArcSignedIn, false); 688 profile_->GetPrefs()->SetBoolean(prefs::kArcSignedIn, false);
714 profile_->GetPrefs()->SetBoolean(prefs::kArcTermsAccepted, false); 689 profile_->GetPrefs()->SetBoolean(prefs::kArcTermsAccepted, false);
715 } 690 }
716 ShutdownBridgeAndCloseUI(); 691 ShutdownBridge();
692 if (support_host_)
693 support_host_->Close();
717 } 694 }
718 695
719 void ArcAuthService::OnOptInPreferenceChanged() { 696 void ArcAuthService::OnOptInPreferenceChanged() {
720 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 697 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
721 DCHECK(profile_); 698 DCHECK(profile_);
722 699
723 // TODO(dspaid): Move code from OnSyncedPrefChanged into this method. 700 // TODO(dspaid): Move code from OnSyncedPrefChanged into this method.
724 OnSyncedPrefChanged(prefs::kArcEnabled, IsArcManaged()); 701 OnSyncedPrefChanged(prefs::kArcEnabled, IsArcManaged());
725 702
726 const bool arc_enabled = IsArcEnabled(); 703 const bool arc_enabled = IsArcEnabled();
727 for (auto& observer : observer_list_) 704 for (auto& observer : observer_list_)
728 observer.OnOptInEnabled(arc_enabled); 705 observer.OnOptInEnabled(arc_enabled);
729 706
730 if (!arc_enabled) { 707 if (!arc_enabled) {
731 StopArc(); 708 StopArc();
732 RemoveArcData(); 709 RemoveArcData();
733 return; 710 return;
734 } 711 }
735 712
736 if (state_ == State::ACTIVE) 713 if (state_ == State::ACTIVE)
737 return; 714 return;
738 715
716 if (support_host_)
717 support_host_->SetArcManaged(IsArcManaged());
718
739 if (!profile_->GetPrefs()->GetBoolean(prefs::kArcSignedIn)) { 719 if (!profile_->GetPrefs()->GetBoolean(prefs::kArcSignedIn)) {
740 if (profile_->GetPrefs()->GetBoolean(prefs::kArcTermsAccepted)) { 720 if (profile_->GetPrefs()->GetBoolean(prefs::kArcTermsAccepted)) {
741 StartArc(); 721 StartArc();
742 } else { 722 } else {
743 // Need pre-fetch auth code and show OptIn UI if needed. 723 // Need pre-fetch auth code and show OptIn UI if needed.
744 StartUI(); 724 StartUI();
745 } 725 }
746 } else { 726 } else {
747 // Ready to start Arc, but check Android management in parallel. 727 // Ready to start Arc, but check Android management in parallel.
748 StartArc(); 728 StartArc();
(...skipping 19 matching lines...) Expand all
768 account_info_notifier_.reset(); 748 account_info_notifier_.reset();
769 android_management_checker_.reset(); 749 android_management_checker_.reset();
770 auth_code_fetcher_.reset(); 750 auth_code_fetcher_.reset();
771 arc_bridge_service()->RequestStop(); 751 arc_bridge_service()->RequestStop();
772 if (state_ != State::NOT_INITIALIZED) 752 if (state_ != State::NOT_INITIALIZED)
773 SetState(State::STOPPED); 753 SetState(State::STOPPED);
774 for (auto& observer : observer_list_) 754 for (auto& observer : observer_list_)
775 observer.OnShutdownBridge(); 755 observer.OnShutdownBridge();
776 } 756 }
777 757
778 void ArcAuthService::ShutdownBridgeAndCloseUI() {
779 ShutdownBridge();
780 CloseUI();
781 }
782
783 void ArcAuthService::ShutdownBridgeAndShowUI(ArcSupportHost::UIPage page,
784 const base::string16& status) {
785 ShutdownBridge();
786 ShowUI(page, status);
787 }
788
789 void ArcAuthService::AddObserver(Observer* observer) { 758 void ArcAuthService::AddObserver(Observer* observer) {
790 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 759 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
791 observer_list_.AddObserver(observer); 760 observer_list_.AddObserver(observer);
792 } 761 }
793 762
794 void ArcAuthService::RemoveObserver(Observer* observer) { 763 void ArcAuthService::RemoveObserver(Observer* observer) {
795 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 764 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
796 observer_list_.RemoveObserver(observer); 765 observer_list_.RemoveObserver(observer);
797 } 766 }
798 767
799 void ArcAuthService::CloseUI() {
800 ui_page_ = ArcSupportHost::UIPage::NO_PAGE;
801 ui_page_status_.clear();
802
803 if (support_host_)
804 support_host_->Close();
805 }
806
807 void ArcAuthService::SetUIPage(ArcSupportHost::UIPage page,
808 const base::string16& status) {
809 ui_page_ = page;
810 ui_page_status_ = status;
811 if (support_host_)
812 support_host_->ShowPage(ui_page_, ui_page_status_);
813 }
814
815 // This is the special method to support enterprise mojo API. 768 // This is the special method to support enterprise mojo API.
816 // TODO(hidehiko): Remove this. 769 // TODO(hidehiko): Remove this.
817 void ArcAuthService::StopAndEnableArc() { 770 void ArcAuthService::StopAndEnableArc() {
818 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 771 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
819 DCHECK(!arc_bridge_service()->stopped()); 772 DCHECK(!arc_bridge_service()->stopped());
820 reenable_arc_ = true; 773 reenable_arc_ = true;
821 StopArc(); 774 StopArc();
822 } 775 }
823 776
824 void ArcAuthService::StartArc() { 777 void ArcAuthService::StartArc() {
(...skipping 18 matching lines...) Expand all
843 } 796 }
844 797
845 void ArcAuthService::CancelAuthCode() { 798 void ArcAuthService::CancelAuthCode() {
846 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 799 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
847 800
848 if (state_ == State::NOT_INITIALIZED) { 801 if (state_ == State::NOT_INITIALIZED) {
849 NOTREACHED(); 802 NOTREACHED();
850 return; 803 return;
851 } 804 }
852 805
853 // In case |state_| is ACTIVE, |ui_page_| can be START_PROGRESS (which means 806 // In case |state_| is ACTIVE, UI page can be ARC_LOADING (which means normal
Luis Héctor Chávez 2016/11/16 02:58:53 This comment does not seem to agree with the code
hidehiko 2016/11/16 17:52:21 I agree that the condition looks somewhat weird, b
Luis Héctor Chávez 2016/11/16 23:20:30 sgtm
854 // normal Arc booting) or ERROR or ERROR_WITH_FEEDBACK (in case Arc can not 807 // ARC booting) or ERROR (in case ARC can not be started). If ARC is booting
855 // be started). If Arc is booting normally dont't stop it on progress close. 808 // normally don't stop it on progress close.
856 if ((state_ != State::SHOWING_TERMS_OF_SERVICE && 809 if ((state_ != State::SHOWING_TERMS_OF_SERVICE &&
857 state_ != State::CHECKING_ANDROID_MANAGEMENT) && 810 state_ != State::CHECKING_ANDROID_MANAGEMENT) &&
858 ui_page_ != ArcSupportHost::UIPage::ERROR && 811 (!support_host_ ||
859 ui_page_ != ArcSupportHost::UIPage::ERROR_WITH_FEEDBACK) { 812 support_host_->ui_page() != ArcSupportHost::UIPage::ERROR)) {
860 return; 813 return;
861 } 814 }
862 815
863 // Update UMA with user cancel only if error is not currently shown. 816 // Update UMA with user cancel only if error is not currently shown.
864 if (ui_page_ != ArcSupportHost::UIPage::NO_PAGE && 817 if (support_host_ &&
865 ui_page_ != ArcSupportHost::UIPage::ERROR && 818 support_host_->ui_page() != ArcSupportHost::UIPage::NO_PAGE &&
866 ui_page_ != ArcSupportHost::UIPage::ERROR_WITH_FEEDBACK) { 819 support_host_->ui_page() != ArcSupportHost::UIPage::ERROR) {
867 UpdateOptInCancelUMA(OptInCancelReason::USER_CANCEL); 820 UpdateOptInCancelUMA(OptInCancelReason::USER_CANCEL);
868 } 821 }
869 822
870 StopArc(); 823 StopArc();
871 824
872 if (IsArcManaged()) 825 if (IsArcManaged())
873 return; 826 return;
874 827
875 DisableArc(); 828 DisableArc();
876 } 829 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 if (IsAllowed()) 868 if (IsAllowed())
916 UpdateEnabledStateUMA(IsArcEnabled()); 869 UpdateEnabledStateUMA(IsArcEnabled());
917 } 870 }
918 871
919 void ArcAuthService::StartUI() { 872 void ArcAuthService::StartUI() {
920 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 873 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
921 874
922 if (!arc_bridge_service()->stopped()) { 875 if (!arc_bridge_service()->stopped()) {
923 // If the user attempts to re-enable ARC while the bridge is still running 876 // If the user attempts to re-enable ARC while the bridge is still running
924 // the user should not be able to continue until the bridge has stopped. 877 // the user should not be able to continue until the bridge has stopped.
925 ShowUI( 878 if (support_host_) {
926 ArcSupportHost::UIPage::ERROR, 879 support_host_->ShowError(
927 l10n_util::GetStringUTF16(IDS_ARC_SIGN_IN_SERVICE_UNAVAILABLE_ERROR)); 880 ArcSupportHost::Error::SIGN_IN_SERVICE_UNAVAILABLE_ERROR, false);
881 }
928 return; 882 return;
929 } 883 }
930 884
931 SetState(State::SHOWING_TERMS_OF_SERVICE); 885 SetState(State::SHOWING_TERMS_OF_SERVICE);
932 ShowUI(ArcSupportHost::UIPage::TERMS, base::string16()); 886 if (support_host_)
887 support_host_->ShowTermsOfService();
933 } 888 }
934 889
935 void ArcAuthService::OnPrepareContextFailed() { 890 void ArcAuthService::OnPrepareContextFailed() {
936 ShutdownBridgeAndShowUI( 891 ShutdownBridge();
937 ArcSupportHost::UIPage::ERROR, 892 if (support_host_) {
938 l10n_util::GetStringUTF16(IDS_ARC_SERVER_COMMUNICATION_ERROR)); 893 support_host_->ShowError(ArcSupportHost::Error::SERVER_COMMUNICATION_ERROR,
894 false);
895 }
939 UpdateOptInCancelUMA(OptInCancelReason::NETWORK_ERROR); 896 UpdateOptInCancelUMA(OptInCancelReason::NETWORK_ERROR);
940 } 897 }
941 898
942 void ArcAuthService::OnAuthCodeSuccess(const std::string& auth_code) { 899 void ArcAuthService::OnAuthCodeSuccess(const std::string& auth_code) {
943 OnAuthCodeObtained(auth_code); 900 OnAuthCodeObtained(auth_code);
944 } 901 }
945 902
946 void ArcAuthService::OnAuthCodeFailed() { 903 void ArcAuthService::OnAuthCodeFailed() {
947 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 904 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
948 ShutdownBridgeAndShowUI( 905 ShutdownBridge();
949 ArcSupportHost::UIPage::ERROR, 906 if (support_host_) {
950 l10n_util::GetStringUTF16(IDS_ARC_SERVER_COMMUNICATION_ERROR)); 907 support_host_->ShowError(ArcSupportHost::Error::SERVER_COMMUNICATION_ERROR,
908 false);
909 }
951 UpdateOptInCancelUMA(OptInCancelReason::NETWORK_ERROR); 910 UpdateOptInCancelUMA(OptInCancelReason::NETWORK_ERROR);
952 } 911 }
953 912
954 void ArcAuthService::StartArcAndroidManagementCheck() { 913 void ArcAuthService::StartArcAndroidManagementCheck() {
955 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 914 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
956 DCHECK(arc_bridge_service()->stopped()); 915 DCHECK(arc_bridge_service()->stopped());
957 DCHECK(state_ == State::SHOWING_TERMS_OF_SERVICE || 916 DCHECK(state_ == State::SHOWING_TERMS_OF_SERVICE ||
958 state_ == State::CHECKING_ANDROID_MANAGEMENT); 917 state_ == State::CHECKING_ANDROID_MANAGEMENT);
959 SetState(State::CHECKING_ANDROID_MANAGEMENT); 918 SetState(State::CHECKING_ANDROID_MANAGEMENT);
960 919
(...skipping 13 matching lines...) Expand all
974 switch (result) { 933 switch (result) {
975 case policy::AndroidManagementClient::Result::UNMANAGED: 934 case policy::AndroidManagementClient::Result::UNMANAGED:
976 VLOG(1) << "Starting ARC for first sign in."; 935 VLOG(1) << "Starting ARC for first sign in.";
977 sign_in_time_ = base::Time::Now(); 936 sign_in_time_ = base::Time::Now();
978 arc_sign_in_timer_.Start(FROM_HERE, kArcSignInTimeout, 937 arc_sign_in_timer_.Start(FROM_HERE, kArcSignInTimeout,
979 base::Bind(&ArcAuthService::OnArcSignInTimeout, 938 base::Bind(&ArcAuthService::OnArcSignInTimeout,
980 weak_ptr_factory_.GetWeakPtr())); 939 weak_ptr_factory_.GetWeakPtr()));
981 StartArc(); 940 StartArc();
982 break; 941 break;
983 case policy::AndroidManagementClient::Result::MANAGED: 942 case policy::AndroidManagementClient::Result::MANAGED:
984 ShutdownBridgeAndShowUI( 943 ShutdownBridge();
985 ArcSupportHost::UIPage::ERROR, 944 if (support_host_) {
986 l10n_util::GetStringUTF16(IDS_ARC_ANDROID_MANAGEMENT_REQUIRED_ERROR)); 945 support_host_->ShowError(
946 ArcSupportHost::Error::ANDROID_MANAGEMENT_REQUIRED_ERROR, false);
947 }
987 UpdateOptInCancelUMA(OptInCancelReason::ANDROID_MANAGEMENT_REQUIRED); 948 UpdateOptInCancelUMA(OptInCancelReason::ANDROID_MANAGEMENT_REQUIRED);
988 break; 949 break;
989 case policy::AndroidManagementClient::Result::ERROR: 950 case policy::AndroidManagementClient::Result::ERROR:
990 ShutdownBridgeAndShowUI( 951 ShutdownBridge();
991 ArcSupportHost::UIPage::ERROR, 952 if (support_host_) {
992 l10n_util::GetStringUTF16(IDS_ARC_SERVER_COMMUNICATION_ERROR)); 953 support_host_->ShowError(
954 ArcSupportHost::Error::SERVER_COMMUNICATION_ERROR, false);
955 }
993 UpdateOptInCancelUMA(OptInCancelReason::NETWORK_ERROR); 956 UpdateOptInCancelUMA(OptInCancelReason::NETWORK_ERROR);
994 break; 957 break;
995 } 958 }
996 } 959 }
997 960
998 void ArcAuthService::OnBackgroundAndroidManagementChecked( 961 void ArcAuthService::OnBackgroundAndroidManagementChecked(
999 policy::AndroidManagementClient::Result result) { 962 policy::AndroidManagementClient::Result result) {
1000 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 963 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
1001 switch (result) { 964 switch (result) {
1002 case policy::AndroidManagementClient::Result::UNMANAGED: 965 case policy::AndroidManagementClient::Result::UNMANAGED:
(...skipping 17 matching lines...) Expand all
1020 std::string auth_endpoint; 983 std::string auth_endpoint;
1021 if (command_line->HasSwitch(chromeos::switches::kArcUseAuthEndpoint)) { 984 if (command_line->HasSwitch(chromeos::switches::kArcUseAuthEndpoint)) {
1022 auth_endpoint = command_line->GetSwitchValueASCII( 985 auth_endpoint = command_line->GetSwitchValueASCII(
1023 chromeos::switches::kArcUseAuthEndpoint); 986 chromeos::switches::kArcUseAuthEndpoint);
1024 } 987 }
1025 988
1026 if (!auth_endpoint.empty()) { 989 if (!auth_endpoint.empty()) {
1027 auth_code_fetcher_.reset(new ArcAuthCodeFetcher( 990 auth_code_fetcher_.reset(new ArcAuthCodeFetcher(
1028 this, context_->GetURLRequestContext(), profile_, auth_endpoint)); 991 this, context_->GetURLRequestContext(), profile_, auth_endpoint));
1029 } else { 992 } else {
1030 ShowUI(ArcSupportHost::UIPage::LSO_PROGRESS, base::string16()); 993 if (support_host_)
994 support_host_->ShowLso();
1031 } 995 }
1032 } 996 }
1033 997
1034 void ArcAuthService::OnWindowClosed() { 998 void ArcAuthService::OnWindowClosed() {
999 DCHECK(support_host_);
1035 CancelAuthCode(); 1000 CancelAuthCode();
1036 } 1001 }
1037 1002
1038 void ArcAuthService::OnTermsAgreed(bool is_metrics_enabled, 1003 void ArcAuthService::OnTermsAgreed(bool is_metrics_enabled,
1039 bool is_backup_and_restore_enabled, 1004 bool is_backup_and_restore_enabled,
1040 bool is_location_service_enabled) { 1005 bool is_location_service_enabled) {
1006 DCHECK(support_host_);
1007
1041 // Terms were accepted 1008 // Terms were accepted
1042 profile_->GetPrefs()->SetBoolean(prefs::kArcTermsAccepted, true); 1009 profile_->GetPrefs()->SetBoolean(prefs::kArcTermsAccepted, true);
1043 1010
1044 // This is ARC support's UI event callback, so this is called only when 1011 // Since this is ARC support's UI event callback, preference_handler_
1045 // the UI is visible. The condition to open the UI is 1012 // should be always created (see OnPrimaryUserProfilePrepared()).
1046 // !g_disable_ui_for_testing && !IsOptInVerificationDisabled() (see ShowUI())
1047 // and in the case, preference_handler_ should be always created (see
1048 // OnPrimaryUserProfilePrepared()),
1049 // TODO(hidehiko): Simplify the logic with the code restructuring. 1013 // TODO(hidehiko): Simplify the logic with the code restructuring.
1050 DCHECK(preference_handler_); 1014 DCHECK(preference_handler_);
1051 preference_handler_->EnableMetrics(is_metrics_enabled); 1015 preference_handler_->EnableMetrics(is_metrics_enabled);
1052 preference_handler_->EnableBackupRestore(is_backup_and_restore_enabled); 1016 preference_handler_->EnableBackupRestore(is_backup_and_restore_enabled);
1053 preference_handler_->EnableLocationService(is_location_service_enabled); 1017 preference_handler_->EnableLocationService(is_location_service_enabled);
1054 SetUIPage(ArcSupportHost::UIPage::START_PROGRESS, base::string16()); 1018 support_host_->ShowArcLoading();
1055 StartArcAndroidManagementCheck(); 1019 StartArcAndroidManagementCheck();
1056 } 1020 }
1057 1021
1058 void ArcAuthService::OnAuthSucceeded(const std::string& auth_code) { 1022 void ArcAuthService::OnAuthSucceeded(const std::string& auth_code) {
1023 DCHECK(support_host_);
1059 OnAuthCodeObtained(auth_code); 1024 OnAuthCodeObtained(auth_code);
1060 } 1025 }
1061 1026
1062 void ArcAuthService::OnRetryClicked() { 1027 void ArcAuthService::OnRetryClicked() {
1028 DCHECK(support_host_);
1029
1063 UpdateOptInActionUMA(OptInActionType::RETRY); 1030 UpdateOptInActionUMA(OptInActionType::RETRY);
1064 1031
1065 // TODO(hidehiko): Simplify the retry logic. 1032 // TODO(hidehiko): Simplify the retry logic.
1066 if (!profile_->GetPrefs()->GetBoolean(prefs::kArcTermsAccepted)) { 1033 if (!profile_->GetPrefs()->GetBoolean(prefs::kArcTermsAccepted)) {
1067 // If the user has not yet agreed on Terms of Service, then show it. 1034 // If the user has not yet agreed on Terms of Service, then show it.
1068 ShowUI(ArcSupportHost::UIPage::TERMS, base::string16()); 1035 support_host_->ShowTermsOfService();
1069 } else if (ui_page_ == ArcSupportHost::UIPage::ERROR_WITH_FEEDBACK) { 1036 } else if (support_host_->ui_page() == ArcSupportHost::UIPage::ERROR &&
1037 !arc_bridge_service()->stopped()) {
1070 // ERROR_WITH_FEEDBACK is set in OnSignInFailed(). In the case, stopping 1038 // ERROR_WITH_FEEDBACK is set in OnSignInFailed(). In the case, stopping
1071 // ARC was postponed to contain its internal state into the report. 1039 // ARC was postponed to contain its internal state into the report.
1072 // Here, on retry, stop it, then restart. 1040 // Here, on retry, stop it, then restart.
1073 DCHECK_EQ(State::ACTIVE, state_); 1041 DCHECK_EQ(State::ACTIVE, state_);
1074 SetUIPage(ArcSupportHost::UIPage::START_PROGRESS, base::string16()); 1042 support_host_->ShowArcLoading();
1075 ShutdownBridge(); 1043 ShutdownBridge();
1076 reenable_arc_ = true; 1044 reenable_arc_ = true;
1077 } else if (state_ == State::ACTIVE) { 1045 } else if (state_ == State::ACTIVE) {
1078 // This happens when ARC support Chrome app reports an error on "Sign in" 1046 // This happens when ARC support Chrome app reports an error on "Sign in"
1079 // page. 1047 // page.
1080 // TODO(hidehiko): Currently, due to the existing code structure, we need 1048 // TODO(hidehiko): Currently, due to the existing code structure, we need
1081 // to call PrepareContextForAuthCodeRequest() always. However, to fetch 1049 // to call PrepareContextForAuthCodeRequest() always. However, to fetch
1082 // an authtoken via LSO page, it is not necessary to call PrepareContext(). 1050 // an authtoken via LSO page, it is not necessary to call PrepareContext().
1083 // Instead, it is possible to show LSO page, immediately. 1051 // Instead, it is possible to show LSO page, immediately.
1084 SetUIPage(ArcSupportHost::UIPage::START_PROGRESS, base::string16()); 1052 support_host_->ShowArcLoading();
1085 PrepareContextForAuthCodeRequest(); 1053 PrepareContextForAuthCodeRequest();
1086 } else { 1054 } else {
1087 // Otherwise, we restart ARC. Note: this is the first boot case. 1055 // Otherwise, we restart ARC. Note: this is the first boot case.
1088 // For second or later boot, either ERROR_WITH_FEEDBACK case or ACTIVE 1056 // For second or later boot, either ERROR_WITH_FEEDBACK case or ACTIVE
1089 // case must hit. 1057 // case must hit.
1090 SetUIPage(ArcSupportHost::UIPage::START_PROGRESS, base::string16()); 1058 support_host_->ShowArcLoading();
1091 StartArcAndroidManagementCheck(); 1059 StartArcAndroidManagementCheck();
1092 } 1060 }
1093 } 1061 }
1094 1062
1095 void ArcAuthService::OnSendFeedbackClicked() { 1063 void ArcAuthService::OnSendFeedbackClicked() {
1064 DCHECK(support_host_);
1096 chrome::OpenFeedbackDialog(nullptr); 1065 chrome::OpenFeedbackDialog(nullptr);
1097 } 1066 }
1098 1067
1099 void ArcAuthService::OnMetricsModeChanged(bool enabled, bool managed) { 1068 void ArcAuthService::OnMetricsModeChanged(bool enabled, bool managed) {
1100 if (!support_host_) 1069 if (!support_host_)
1101 return; 1070 return;
1102 support_host_->SetMetricsPreferenceCheckbox(enabled, managed); 1071 support_host_->SetMetricsPreferenceCheckbox(enabled, managed);
1103 } 1072 }
1104 1073
1105 void ArcAuthService::OnBackupAndRestoreModeChanged(bool enabled, bool managed) { 1074 void ArcAuthService::OnBackupAndRestoreModeChanged(bool enabled, bool managed) {
(...skipping 22 matching lines...) Expand all
1128 return os << "ACTIVE"; 1097 return os << "ACTIVE";
1129 } 1098 }
1130 1099
1131 // Some compiler reports an error even if all values of an enum-class are 1100 // Some compiler reports an error even if all values of an enum-class are
1132 // covered indivisually in a switch statement. 1101 // covered indivisually in a switch statement.
1133 NOTREACHED(); 1102 NOTREACHED();
1134 return os; 1103 return os;
1135 } 1104 }
1136 1105
1137 } // namespace arc 1106 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698