| 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 // RequestEnable() has a check in order not to trigger starting procedure | 225 // RequestEnable() has a check in order not to trigger starting procedure |
| 226 // twice. This method can be called to bypass that check when restarting. | 226 // twice. This method can be called to bypass that check when restarting. |
| 227 void RequestEnableImpl(); | 227 void RequestEnableImpl(); |
| 228 | 228 |
| 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 void SetState(State state); | 233 void SetState(State state); |
| 234 void ShutdownSession(); | 234 void ShutdownSession(); |
| 235 void OnAndroidManagementPassed(); | |
| 236 void OnArcDataRemoved(bool success); | 235 void OnArcDataRemoved(bool success); |
| 237 void OnArcSignInTimeout(); | 236 void OnArcSignInTimeout(); |
| 238 | 237 |
| 239 void StartArcAndroidManagementCheck(); | 238 // Starts Android management check. This is for first boot case (= Opt-in |
| 240 void MaybeReenableArc(); | 239 // or OOBE flow case). In secondary or later ARC enabling, the check should |
| 240 // run in background. |
| 241 void StartAndroidManagementCheck(); |
| 241 | 242 |
| 242 // Called when the Android management check is done in opt-in flow or | 243 // Called when the Android management check is done in opt-in flow or |
| 243 // re-auth flow. | 244 // OOBE flow. |
| 244 void OnAndroidManagementChecked( | 245 void OnAndroidManagementChecked( |
| 245 policy::AndroidManagementClient::Result result); | 246 policy::AndroidManagementClient::Result result); |
| 246 | 247 |
| 248 // Starts Android management check in background (in parallel with starting |
| 249 // ARC). This is for secondary or later ARC enabling. |
| 250 // The reason running them in parallel is for performance. The secondary or |
| 251 // later ARC enabling is typically on "logging into Chrome" for the user who |
| 252 // already opted in to use Google Play Store. In such a case, network is |
| 253 // typically not yet ready. Thus, if we block ARC boot, it delays several |
| 254 // seconds, which is not very user friendly. |
| 255 void StartBackgroundAndroidManagementCheck(); |
| 256 |
| 247 // Called when the background Android management check is done. It is | 257 // Called when the background Android management check is done. It is |
| 248 // triggered when the second or later ARC boot timing. | 258 // triggered when the second or later ARC boot timing. |
| 249 void OnBackgroundAndroidManagementChecked( | 259 void OnBackgroundAndroidManagementChecked( |
| 250 policy::AndroidManagementClient::Result result); | 260 policy::AndroidManagementClient::Result result); |
| 251 | 261 |
| 252 // Requests to starts ARC instance. Also, update the internal state to | 262 // Requests to starts ARC instance. Also, update the internal state to |
| 253 // ACTIVE. | 263 // ACTIVE. |
| 254 void StartArc(); | 264 void StartArc(); |
| 255 | 265 |
| 256 // Requests to stop ARC instnace. This resets two persistent flags: | 266 // Requests to stop ARC instnace. This resets two persistent flags: |
| 257 // kArcSignedIn and kArcTermsAccepted, so that, in next enabling, | 267 // kArcSignedIn and kArcTermsAccepted, so that, in next enabling, |
| 258 // it is started from Terms of Service negotiation. | 268 // it is started from Terms of Service negotiation. |
| 259 // TODO(hidehiko): Introduce STOPPING state, and this function should | 269 // TODO(hidehiko): Introduce STOPPING state, and this function should |
| 260 // transition to it. | 270 // transition to it. |
| 261 void StopArc(); | 271 void StopArc(); |
| 262 | 272 |
| 263 // ArcSessionRunner::Observer: | 273 // ArcSessionRunner::Observer: |
| 264 void OnSessionStopped(ArcStopReason reason, bool restarting) override; | 274 void OnSessionStopped(ArcStopReason reason, bool restarting) override; |
| 265 | 275 |
| 276 // On ARC session stopped and/or data removal completion, this is called |
| 277 // so that, if necessary, ARC session is restarted. |
| 278 // TODO(hidehiko): This can be removed after the racy state machine |
| 279 // is fixed. |
| 280 void MaybeReenableArc(); |
| 281 |
| 266 std::unique_ptr<ArcSessionRunner> arc_session_runner_; | 282 std::unique_ptr<ArcSessionRunner> arc_session_runner_; |
| 267 | 283 |
| 268 // Unowned pointer. Keeps current profile. | 284 // Unowned pointer. Keeps current profile. |
| 269 Profile* profile_ = nullptr; | 285 Profile* profile_ = nullptr; |
| 270 | 286 |
| 271 // Whether ArcSessionManager is requested to enable (starting to run ARC | 287 // Whether ArcSessionManager is requested to enable (starting to run ARC |
| 272 // instance) or not. | 288 // instance) or not. |
| 273 bool enable_requested_ = false; | 289 bool enable_requested_ = false; |
| 274 | 290 |
| 275 // Internal state machine. See also State enum class. | 291 // Internal state machine. See also State enum class. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 299 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager); | 315 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager); |
| 300 }; | 316 }; |
| 301 | 317 |
| 302 // Outputs the stringified |state| to |os|. This is only for logging purposes. | 318 // Outputs the stringified |state| to |os|. This is only for logging purposes. |
| 303 std::ostream& operator<<(std::ostream& os, | 319 std::ostream& operator<<(std::ostream& os, |
| 304 const ArcSessionManager::State& state); | 320 const ArcSessionManager::State& state); |
| 305 | 321 |
| 306 } // namespace arc | 322 } // namespace arc |
| 307 | 323 |
| 308 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ | 324 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ |
| OLD | NEW |