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

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

Issue 2695113004: Split IsArcPlayStoreEnabled() and ArcSessionManager's enabled concepts. (Closed)
Patch Set: Address comments Created 3 years, 10 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/arc/arc_session_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7c97cdc1aaabc2c93fa74e8e5700f3ff54e016fe..0d3ccb09f066b573feb1d70115a2f6fea94da451 100644
--- a/chrome/browser/chromeos/arc/arc_session_manager.h
+++ b/chrome/browser/chromeos/arc/arc_session_manager.h
@@ -77,6 +77,9 @@ class ArcSessionManager : public ArcSessionObserver,
// In the second (or later) boot case:
// STOPPED -> ACTIVE: when arc.enabled preference is checked that it is
// true. Practically, this is when the primary Profile gets ready.
+ //
+ // TODO(hidehiko): Fix the state machine, and update the comment including
+ // relationship with |enable_requested_|.
enum class State {
NOT_INITIALIZED,
STOPPED,
@@ -170,6 +173,19 @@ class ArcSessionManager : public ArcSessionObserver,
// Google Play Store, then ARC can run without opt-in.
void SetArcPlayStoreEnabled(bool enable);
+ // Requests to enable ARC session. This starts ARC instance, or maybe starts
+ // Terms Of Service negotiation if they haven't been accepted yet.
+ // If it is already requested to enable, no-op.
+ // Currently, enabled/disabled is tied to whether Google Play Store is
+ // enabled or disabled. Please see also TODO of SetArcPlayStoreEnabled().
+ void RequestEnable();
+
+ // Requests to disable ARC session. This stops ARC instance, or quits Terms
+ // Of Service negotiation if it is the middle of the process (e.g. closing
+ // UI for manual negotiation if it is shown).
+ // If it is already requested to disable, no-op.
+ void RequestDisable();
+
// Called from the Chrome OS metrics provider to record Arc.State
// periodically.
void RecordArcState();
@@ -222,6 +238,10 @@ class ArcSessionManager : public ArcSessionObserver,
void SetAttemptUserExitCallbackForTesting(const base::Closure& callback);
private:
+ // RequestEnable() has a check in order not to trigger starting procedure
+ // twice. This method can be called to bypass that check when restarting.
+ void RequestEnableImpl();
+
// Negotiates the terms of service to user.
void StartTermsOfServiceNegotiation();
void OnTermsOfServiceNegotiated(bool accepted);
@@ -260,6 +280,11 @@ class ArcSessionManager : public ArcSessionObserver,
// Registrar used to monitor ARC enabled state.
PrefChangeRegistrar pref_change_registrar_;
+ // Whether ArcSessionManager is requested to enable (starting to run ARC
+ // instance) or not.
+ bool enable_requested_ = false;
+
+ // Internal state machine. See also State enum class.
State state_ = State::NOT_INITIALIZED;
base::ObserverList<Observer> observer_list_;
base::ObserverList<ArcSessionObserver> arc_session_observer_list_;
« no previous file with comments | « no previous file | chrome/browser/chromeos/arc/arc_session_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698