Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #ifndef CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <ostream> | 9 #include <ostream> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 229 // Negotiates the terms of service to user. | 229 // Negotiates the terms of service to user. |
| 230 void StartTermsOfServiceNegotiation(); | 230 void StartTermsOfServiceNegotiation(); |
| 231 void OnTermsOfServiceNegotiated(bool accepted); | 231 void OnTermsOfServiceNegotiated(bool accepted); |
| 232 | 232 |
| 233 // Returns whether ARC is managed and all ARC related OptIn preferences are | 233 // Returns whether ARC is managed and all ARC related OptIn preferences are |
| 234 // managed too. | 234 // managed too. |
| 235 bool AreArcAllOptInPreferencesManaged() const; | 235 bool AreArcAllOptInPreferencesManaged() const; |
| 236 | 236 |
| 237 void SetState(State state); | 237 void SetState(State state); |
| 238 void ShutdownSession(); | 238 void ShutdownSession(); |
| 239 void OnAndroidManagementPassed(); | |
| 240 void OnArcDataRemoved(bool success); | 239 void OnArcDataRemoved(bool success); |
| 241 void OnArcSignInTimeout(); | 240 void OnArcSignInTimeout(); |
| 242 | 241 |
| 243 void StartArcAndroidManagementCheck(); | 242 // Starts Android management check. This is for first boot case (= Opt-in |
| 244 void MaybeReenableArc(); | 243 // or OOBE flow case). In secondary or later ARC enabling, the check should |
| 244 // run in background. | |
| 245 void StartAndroidManagementCheck(); | |
| 245 | 246 |
| 246 // Called when the Android management check is done in opt-in flow or | 247 // Called when the Android management check is done in opt-in flow or |
| 247 // re-auth flow. | 248 // OOBE flow. |
| 248 void OnAndroidManagementChecked( | 249 void OnAndroidManagementChecked( |
| 249 policy::AndroidManagementClient::Result result); | 250 policy::AndroidManagementClient::Result result); |
| 250 | 251 |
| 252 // Starts Android management check in background (in parallel with starting | |
| 253 // ARC). This is for secondary or later ARC enabling. | |
| 254 // The reason running them in parallel is for performance. The secondary or | |
| 255 // later ARC enabling is typically on "logging into Chrome" for the user who | |
| 256 // already opted in to use Google Play Store. In such a case, network is | |
| 257 // typically not yet ready. Thus, if we block ARC boot, it delays several | |
| 258 // seconds, which is not very user friendly. | |
| 259 void StartBackgroundAndroidManagementCheck(); | |
| 260 | |
| 251 // Called when the background Android management check is done. It is | 261 // Called when the background Android management check is done. It is |
| 252 // triggered when the second or later ARC boot timing. | 262 // triggered when the second or later ARC boot timing. |
| 253 void OnBackgroundAndroidManagementChecked( | 263 void OnBackgroundAndroidManagementChecked( |
| 254 policy::AndroidManagementClient::Result result); | 264 policy::AndroidManagementClient::Result result); |
| 255 | 265 |
| 256 // Requests to starts ARC instance. Also, update the internal state to | 266 // Requests to starts ARC instance. Also, update the internal state to |
| 257 // ACTIVE. | 267 // ACTIVE. |
| 258 void StartArc(); | 268 void StartArc(); |
| 259 | 269 |
| 260 // Requests to stop ARC instnace. This resets two persistent flags: | 270 // Requests to stop ARC instnace. This resets two persistent flags: |
| 261 // kArcSignedIn and kArcTermsAccepted, so that, in next enabling, | 271 // kArcSignedIn and kArcTermsAccepted, so that, in next enabling, |
| 262 // it is started from Terms of Service negotiation. | 272 // it is started from Terms of Service negotiation. |
| 263 // TODO(hidehiko): Introduce STOPPING state, and this function should | 273 // TODO(hidehiko): Introduce STOPPING state, and this function should |
| 264 // transition to it. | 274 // transition to it. |
| 265 void StopArc(); | 275 void StopArc(); |
| 266 | 276 |
| 267 // ArcSessionRunner::Observer: | 277 // ArcSessionRunner::Observer: |
| 268 void OnSessionStopped(ArcStopReason reason, bool restarting) override; | 278 void OnSessionStopped(ArcStopReason reason, bool restarting) override; |
| 269 | 279 |
| 280 // On ARC session stopped and/or data removal completion, this is called | |
|
hidehiko
2017/03/06 11:57:56
Updated, just because I'm here.
| |
| 281 // so that, if necessary, ARC session is restarted. | |
| 282 // TODO(hidehiko): This can be removed after the racy state machine | |
| 283 // is fixed. | |
| 284 void MaybeReenableArc(); | |
| 285 | |
| 270 std::unique_ptr<ArcSessionRunner> arc_session_runner_; | 286 std::unique_ptr<ArcSessionRunner> arc_session_runner_; |
| 271 | 287 |
| 272 // Unowned pointer. Keeps current profile. | 288 // Unowned pointer. Keeps current profile. |
| 273 Profile* profile_ = nullptr; | 289 Profile* profile_ = nullptr; |
| 274 | 290 |
| 275 // Whether ArcSessionManager is requested to enable (starting to run ARC | 291 // Whether ArcSessionManager is requested to enable (starting to run ARC |
| 276 // instance) or not. | 292 // instance) or not. |
| 277 bool enable_requested_ = false; | 293 bool enable_requested_ = false; |
| 278 | 294 |
| 279 // Internal state machine. See also State enum class. | 295 // Internal state machine. See also State enum class. |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 303 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager); | 319 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager); |
| 304 }; | 320 }; |
| 305 | 321 |
| 306 // Outputs the stringified |state| to |os|. This is only for logging purposes. | 322 // Outputs the stringified |state| to |os|. This is only for logging purposes. |
| 307 std::ostream& operator<<(std::ostream& os, | 323 std::ostream& operator<<(std::ostream& os, |
| 308 const ArcSessionManager::State& state); | 324 const ArcSessionManager::State& state); |
| 309 | 325 |
| 310 } // namespace arc | 326 } // namespace arc |
| 311 | 327 |
| 312 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ | 328 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ |
| OLD | NEW |