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

Unified Diff: chrome/browser/chromeos/arc/arc_session_manager.h

Issue 2737453003: Fix ArcSessionManager state machine, part 1. (Closed)
Patch Set: Rebase 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/arc/arc_session_manager.h
diff --git a/chrome/browser/chromeos/arc/arc_session_manager.h b/chrome/browser/chromeos/arc/arc_session_manager.h
index b2c8379f9ebde550d1099b9f5cdb9a80fa0a768d..9aa0ca8a679e8747799534a09fcd9e48fc1422e3 100644
--- a/chrome/browser/chromeos/arc/arc_session_manager.h
+++ b/chrome/browser/chromeos/arc/arc_session_manager.h
@@ -42,8 +42,14 @@ class ArcSessionManager : public ArcSessionRunner::Observer,
// so that this service is not yet initialized, or Chrome is being shut
// down so that this is destroyed.
// STOPPED: ARC session is not running, or being terminated.
- // SHOWING_TERMS_OF_SERVICE: "Terms Of Service" page is shown on ARC support
- // Chrome app.
+ // NEGOTIATING_TERMS_OF_SERVICE: Negotiating Google Play Store "Terms of
+ // Service" with a user. There are several ways for the negotiation,
+ // including opt-in flow, which shows "Terms of Service" page on ARC
+ // support app, and OOBE flow, which shows "Terms of Service" page as a
+ // part of Chrome OOBE flow.
+ // If user does not accept the Terms of Service, disables Google Play
+ // Store, which triggers RequestDisable() and the state will be set to
+ // STOPPED, then.
// CHECKING_ANDROID_MANAGEMENT: Checking Android management status. Note that
// the status is checked for each ARC session starting, but this is the
// state only for the first boot case (= opt-in case). The second time and
@@ -60,9 +66,9 @@ class ArcSessionManager : public ArcSessionRunner::Observer,
// ...(any)... -> STOPPED: on error.
//
// In the first boot case:
- // STOPPED -> SHOWING_TERMS_OF_SERVICE: when arc.enabled preference is set.
- // SHOWING_TERMS_OF_SERVICE -> CHECKING_ANDROID_MANAGEMENT: when a user
- // agree with "Terms Of Service"
+ // STOPPED -> NEGOTIATING_TERMS_OF_SERVICE: On request to enable.
+ // NEGOTIATING_TERMS_OF_SERVICE -> CHECKING_ANDROID_MANAGEMENT: when a user
+ // accepts "Terms Of Service"
// CHECKING_ANDROID_MANAGEMENT -> ACTIVE: when the auth token is
// successfully fetched.
//
@@ -75,7 +81,7 @@ class ArcSessionManager : public ArcSessionRunner::Observer,
enum class State {
NOT_INITIALIZED,
STOPPED,
- SHOWING_TERMS_OF_SERVICE,
+ NEGOTIATING_TERMS_OF_SERVICE,
CHECKING_ANDROID_MANAGEMENT,
REMOVING_DATA_DIR,
ACTIVE,
@@ -230,6 +236,11 @@ class ArcSessionManager : public ArcSessionRunner::Observer,
void StartTermsOfServiceNegotiation();
void OnTermsOfServiceNegotiated(bool accepted);
+ // Returns true if Terms of Service negotiation is needed. Otherwise false.
+ // TODO(crbug.com/698418): Write unittest for this utility after extracting
+ // ToS related code from ArcSessionManager into a dedicated class.
+ bool IsArcTermsOfServiceNegotiationNeeded() const;
+
void SetState(State state);
void ShutdownSession();
void OnArcDataRemoved(bool success);

Powered by Google App Engine
This is Rietveld 408576698