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

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 to ToT 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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 if (support_host_) { 450 if (support_host_) {
451 support_host_->Close(); 451 support_host_->Close();
452 support_host_->RemoveObserver(this); 452 support_host_->RemoveObserver(this);
453 support_host_.reset(); 453 support_host_.reset();
454 } 454 }
455 context_.reset(); 455 context_.reset();
456 profile_ = nullptr; 456 profile_ = nullptr;
457 SetState(State::NOT_INITIALIZED); 457 SetState(State::NOT_INITIALIZED);
458 } 458 }
459 459
460
461 void ArcSessionManager::ShutdownSession() { 460 void ArcSessionManager::ShutdownSession() {
462 arc_sign_in_timer_.Stop(); 461 arc_sign_in_timer_.Stop();
463 playstore_launcher_.reset(); 462 playstore_launcher_.reset();
464 terms_of_service_negotiator_.reset(); 463 terms_of_service_negotiator_.reset();
465 android_management_checker_.reset(); 464 android_management_checker_.reset();
466 arc_session_runner_->RequestStop(); 465 arc_session_runner_->RequestStop();
467 // TODO(hidehiko): The ARC instance's stopping is asynchronous, so it might 466 // TODO(hidehiko): The ARC instance's stopping is asynchronous, so it might
468 // still be running when we return from this function. Do not set the 467 // still be running when we return from this function. Do not set the
469 // STOPPED state immediately here. 468 // STOPPED state immediately here.
470 if (state_ != State::NOT_INITIALIZED && state_ != State::REMOVING_DATA_DIR) 469 if (state_ != State::NOT_INITIALIZED && state_ != State::REMOVING_DATA_DIR)
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 prefs->SetBoolean(prefs::kArcTermsAccepted, true); 587 prefs->SetBoolean(prefs::kArcTermsAccepted, true);
589 588
590 // Skip to show UI asking users to set up ARC OptIn preferences, if all of 589 // Skip to show UI asking users to set up ARC OptIn preferences, if all of
591 // them are managed by the admin policy. Note that the ToS agreement is anyway 590 // them are managed by the admin policy. Note that the ToS agreement is anyway
592 // not shown in the case of the managed ARC. 591 // not shown in the case of the managed ARC.
593 if (IsArcPlayStoreEnabledPreferenceManagedForProfile(profile_) && 592 if (IsArcPlayStoreEnabledPreferenceManagedForProfile(profile_) &&
594 AreArcAllOptInPreferencesManagedForProfile(profile_)) { 593 AreArcAllOptInPreferencesManagedForProfile(profile_)) {
595 prefs->SetBoolean(prefs::kArcTermsAccepted, true); 594 prefs->SetBoolean(prefs::kArcTermsAccepted, true);
596 } 595 }
597 596
598 // If it is marked that sign in has been successfully done, then directly 597 // If it is marked that sign in has been successfully done, if ARC has been
599 // start ARC. 598 // set up to always start, then directly start ARC.
600 // For testing, and for Kiosk mode, we also skip ToS negotiation procedure. 599 // For testing, and for Kiosk mode, we also skip ToS negotiation procedure.
601 // For backward compatibility, this check needs to be prior to the 600 // For backward compatibility, this check needs to be prior to the
602 // kArcTermsAccepted check below. 601 // kArcTermsAccepted check below.
603 if (prefs->GetBoolean(prefs::kArcSignedIn) || 602 if (prefs->GetBoolean(prefs::kArcSignedIn) || ShouldArcAlwaysStart() ||
604 IsArcOptInVerificationDisabled() || IsArcKioskMode()) { 603 IsArcOptInVerificationDisabled() || IsArcKioskMode()) {
605 StartArc(); 604 StartArc();
606 // Check Android management in parallel. 605 // Check Android management in parallel.
607 // Note: StartBackgroundAndroidManagementCheck() may call 606 // Note: StartBackgroundAndroidManagementCheck() may call
608 // OnBackgroundAndroidManagementChecked() synchronously (or 607 // OnBackgroundAndroidManagementChecked() synchronously (or
609 // asynchornously). In the callback, Google Play Store enabled preference 608 // asynchornously). In the callback, Google Play Store enabled preference
610 // can be set to false if managed, and it triggers RequestDisable() via 609 // can be set to false if managed, and it triggers RequestDisable() via
611 // ArcPlayStoreEnabledPreferenceHandler. 610 // ArcPlayStoreEnabledPreferenceHandler.
612 // Thus, StartArc() should be called so that disabling should work even 611 // Thus, StartArc() should be called so that disabling should work even
613 // if synchronous call case. 612 // if synchronous call case.
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 912
914 #undef MAP_STATE 913 #undef MAP_STATE
915 914
916 // Some compilers report an error even if all values of an enum-class are 915 // Some compilers report an error even if all values of an enum-class are
917 // covered exhaustively in a switch statement. 916 // covered exhaustively in a switch statement.
918 NOTREACHED() << "Invalid value " << static_cast<int>(state); 917 NOTREACHED() << "Invalid value " << static_cast<int>(state);
919 return os; 918 return os;
920 } 919 }
921 920
922 } // namespace arc 921 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698