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

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

Issue 2707133006: Start ARC and sign in after Chrome OS login (Closed)
Patch Set: rebase + a few comment change per review Created 3 years, 9 months 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 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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 base::Bind(&ArcSessionManager::OnOptInPreferenceChanged, 489 base::Bind(&ArcSessionManager::OnOptInPreferenceChanged,
490 weak_ptr_factory_.GetWeakPtr())); 490 weak_ptr_factory_.GetWeakPtr()));
491 491
492 // Set initial managed state to ArcSupportHost to update the message. 492 // Set initial managed state to ArcSupportHost to update the message.
493 if (support_host_) { 493 if (support_host_) {
494 support_host_->SetArcManaged( 494 support_host_->SetArcManaged(
495 IsArcPlayStoreEnabledPreferenceManagedForProfile(profile_)); 495 IsArcPlayStoreEnabledPreferenceManagedForProfile(profile_));
496 } 496 }
497 497
498 // Update the state based on the initial Google Play Store enabled value. 498 // Update the state based on the initial Google Play Store enabled value.
499 if (IsArcPlayStoreEnabledForProfile(profile_)) { 499 if (ShouldArcAlwaysStart() || IsArcPlayStoreEnabledForProfile(profile_)) {
500 VLOG(1) << "ARC is already enabled."; 500 VLOG(1) << "ARC is already enabled.";
501 DCHECK(!enable_requested_); 501 DCHECK(!enable_requested_);
502 RequestEnable(); 502 RequestEnable();
503 } else { 503 } else {
504 if (IsArcPlayStoreEnabledPreferenceManagedForProfile(profile_)) { 504 if (IsArcPlayStoreEnabledPreferenceManagedForProfile(profile_)) {
505 // All users that can disable ARC by themselves will have the 505 // All users that can disable ARC by themselves will have the
506 // |kARcDataRemoveRequested| pref set, so we don't need to eagerly remove 506 // |kARcDataRemoveRequested| pref set, so we don't need to eagerly remove
507 // the data for that case. 507 // the data for that case.
508 // For managed users, the preference can change when the Profile object is 508 // For managed users, the preference can change when the Profile object is
509 // not alive, so we still need to check it here in case it was disabled to 509 // not alive, so we still need to check it here in case it was disabled to
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 } 543 }
544 544
545 if (support_host_) 545 if (support_host_)
546 support_host_->SetArcManaged(is_play_store_managed); 546 support_host_->SetArcManaged(is_play_store_managed);
547 547
548 // Hide auth notification if it was opened before and arc.enabled pref was 548 // Hide auth notification if it was opened before and arc.enabled pref was
549 // explicitly set to true or false. 549 // explicitly set to true or false.
550 if (profile_->GetPrefs()->HasPrefPath(prefs::kArcEnabled)) 550 if (profile_->GetPrefs()->HasPrefPath(prefs::kArcEnabled))
551 ArcAuthNotification::Hide(); 551 ArcAuthNotification::Hide();
552 552
553 if (is_play_store_enabled) 553 if (ShouldArcAlwaysStart()) {
554 RequestEnable(); 554 // TODO(victorhsieh): Implement opt-in and opt-out flow. For now, do
555 else 555 // nothing but keep the existing ARC instance running.
Luis Héctor Chávez 2017/03/01 22:25:38 nit: return; to avoid the else.
victorhsieh 2017/03/02 00:28:12 L563-564 should still run.
556 RequestDisable(); 556 } else {
557 if (is_play_store_enabled)
558 RequestEnable();
559 else
560 RequestDisable();
561 }
557 562
558 for (auto& observer : observer_list_) 563 for (auto& observer : observer_list_)
559 observer.OnArcPlayStoreEnabledChanged(is_play_store_enabled); 564 observer.OnArcPlayStoreEnabledChanged(is_play_store_enabled);
560 } 565 }
561 566
562 void ArcSessionManager::ShutdownSession() { 567 void ArcSessionManager::ShutdownSession() {
563 arc_sign_in_timer_.Stop(); 568 arc_sign_in_timer_.Stop();
564 playstore_launcher_.reset(); 569 playstore_launcher_.reset();
565 terms_of_service_negotiator_.reset(); 570 terms_of_service_negotiator_.reset();
566 android_management_checker_.reset(); 571 android_management_checker_.reset();
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 // TODO(poromov): Move to more Kiosk dedicated set-up phase. 710 // TODO(poromov): Move to more Kiosk dedicated set-up phase.
706 if (IsArcKioskMode()) 711 if (IsArcKioskMode())
707 prefs->SetBoolean(prefs::kArcTermsAccepted, true); 712 prefs->SetBoolean(prefs::kArcTermsAccepted, true);
708 713
709 // Skip to show UI asking users to set up ARC OptIn preferences, if all of 714 // Skip to show UI asking users to set up ARC OptIn preferences, if all of
710 // them are managed by the admin policy. Note that the ToS agreement is anyway 715 // them are managed by the admin policy. Note that the ToS agreement is anyway
711 // not shown in the case of the managed ARC. 716 // not shown in the case of the managed ARC.
712 if (AreArcAllOptInPreferencesManaged()) 717 if (AreArcAllOptInPreferencesManaged())
713 prefs->SetBoolean(prefs::kArcTermsAccepted, true); 718 prefs->SetBoolean(prefs::kArcTermsAccepted, true);
714 719
715 // If it is marked that sign in has been successfully done, then directly 720 // If it is marked that sign in has been successfully done, then directly
Luis Héctor Chávez 2017/03/01 22:25:38 nit: "successfully done or if ARC has been set up
victorhsieh 2017/03/02 00:28:12 Done.
716 // start ARC. 721 // start ARC.
717 // For testing, and for Kiosk mode, we also skip ToS negotiation procedure. 722 // For testing, and for Kiosk mode, we also skip ToS negotiation procedure.
718 // For backward compatibility, this check needs to be prior to the 723 // For backward compatibility, this check needs to be prior to the
719 // kArcTermsAccepted check below. 724 // kArcTermsAccepted check below.
720 if (prefs->GetBoolean(prefs::kArcSignedIn) || 725 if (prefs->GetBoolean(prefs::kArcSignedIn) || ShouldArcAlwaysStart() ||
721 IsArcOptInVerificationDisabled() || IsArcKioskMode()) { 726 IsArcOptInVerificationDisabled() || IsArcKioskMode()) {
722 StartArc(); 727 StartArc();
723 728
724 // Skip Android management check for testing. 729 // Skip Android management check for testing.
725 // We also skip if Android management check for Kiosk mode, 730 // We also skip if Android management check for Kiosk mode,
726 // because there are no managed human users for Kiosk exist. 731 // because there are no managed human users for Kiosk exist.
727 if (IsArcOptInVerificationDisabled() || IsArcKioskMode() || 732 if (IsArcOptInVerificationDisabled() || IsArcKioskMode() ||
728 (g_disable_ui_for_testing && 733 (g_disable_ui_for_testing &&
729 !g_enable_check_android_management_for_testing)) { 734 !g_enable_check_android_management_for_testing)) {
730 return; 735 return;
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 1005
1001 #undef MAP_STATE 1006 #undef MAP_STATE
1002 1007
1003 // Some compilers report an error even if all values of an enum-class are 1008 // Some compilers report an error even if all values of an enum-class are
1004 // covered exhaustively in a switch statement. 1009 // covered exhaustively in a switch statement.
1005 NOTREACHED() << "Invalid value " << static_cast<int>(state); 1010 NOTREACHED() << "Invalid value " << static_cast<int>(state);
1006 return os; 1011 return os;
1007 } 1012 }
1008 1013
1009 } // namespace arc 1014 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698