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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 ACTIVE, | 87 ACTIVE, |
88 }; | 88 }; |
89 | 89 |
90 // Observer for those services outside of ARC which want to know ARC events. | 90 // Observer for those services outside of ARC which want to know ARC events. |
91 class Observer { | 91 class Observer { |
92 public: | 92 public: |
93 // Called to notify that whether Google Play Store is enabled or not, which | 93 // Called to notify that whether Google Play Store is enabled or not, which |
94 // is represented by "arc.enabled" preference, is updated. | 94 // is represented by "arc.enabled" preference, is updated. |
95 virtual void OnArcPlayStoreEnabledChanged(bool enabled) {} | 95 virtual void OnArcPlayStoreEnabledChanged(bool enabled) {} |
96 | 96 |
| 97 // Called to notify that checking of Android management status started |
| 98 // during the opt-in flow. |
| 99 virtual void OnArcOptInManagementCheckStarted() {} |
| 100 |
97 // Called to notify that ARC has been initialized successfully. | 101 // Called to notify that ARC has been initialized successfully. |
98 virtual void OnArcInitialStart() {} | 102 virtual void OnArcInitialStart() {} |
99 | 103 |
100 // Called when ARC session is stopped, and is not being restarted | 104 // Called when ARC session is stopped, and is not being restarted |
101 // automatically. | 105 // automatically. |
102 virtual void OnArcSessionStopped(ArcStopReason stop_reason) {} | 106 virtual void OnArcSessionStopped(ArcStopReason stop_reason) {} |
103 | 107 |
104 // Called to notify that Android data has been removed. Used in | 108 // Called to notify that Android data has been removed. Used in |
105 // browser_tests | 109 // browser_tests |
106 virtual void OnArcDataRemoved() {} | 110 virtual void OnArcDataRemoved() {} |
107 | 111 |
| 112 // Called to notify that the error is requested by the session manager to be |
| 113 // displayed in the support host. This is called even if Support UI is |
| 114 // disabled. Note that this is not called in cases when the support app |
| 115 // switches to an error page by itself. |
| 116 virtual void OnArcErrorShowRequested(ArcSupportHost::Error error) {} |
| 117 |
108 protected: | 118 protected: |
109 virtual ~Observer() = default; | 119 virtual ~Observer() = default; |
110 }; | 120 }; |
111 | 121 |
112 explicit ArcSessionManager( | 122 explicit ArcSessionManager( |
113 std::unique_ptr<ArcSessionRunner> arc_session_runner); | 123 std::unique_ptr<ArcSessionRunner> arc_session_runner); |
114 ~ArcSessionManager() override; | 124 ~ArcSessionManager() override; |
115 | 125 |
116 static ArcSessionManager* Get(); | 126 static ArcSessionManager* Get(); |
117 | 127 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 // MaybeReenableArc() directly. | 308 // MaybeReenableArc() directly. |
299 void MaybeStartArcDataRemoval(); | 309 void MaybeStartArcDataRemoval(); |
300 void OnArcDataRemoved(bool success); | 310 void OnArcDataRemoved(bool success); |
301 | 311 |
302 // On ARC session stopped and/or data removal completion, this is called | 312 // On ARC session stopped and/or data removal completion, this is called |
303 // so that, if necessary, ARC session is restarted. | 313 // so that, if necessary, ARC session is restarted. |
304 // TODO(hidehiko): This can be removed after the racy state machine | 314 // TODO(hidehiko): This can be removed after the racy state machine |
305 // is fixed. | 315 // is fixed. |
306 void MaybeReenableArc(); | 316 void MaybeReenableArc(); |
307 | 317 |
| 318 // Requests the support host (if it exists) to show the error, and notifies |
| 319 // the observers. |
| 320 void ShowArcSupportHostError(ArcSupportHost::Error error, |
| 321 bool should_show_send_feedback); |
| 322 |
308 std::unique_ptr<ArcSessionRunner> arc_session_runner_; | 323 std::unique_ptr<ArcSessionRunner> arc_session_runner_; |
309 | 324 |
310 // Unowned pointer. Keeps current profile. | 325 // Unowned pointer. Keeps current profile. |
311 Profile* profile_ = nullptr; | 326 Profile* profile_ = nullptr; |
312 | 327 |
313 // Whether ArcSessionManager is requested to enable (starting to run ARC | 328 // Whether ArcSessionManager is requested to enable (starting to run ARC |
314 // instance) or not. | 329 // instance) or not. |
315 bool enable_requested_ = false; | 330 bool enable_requested_ = false; |
316 | 331 |
317 // Internal state machine. See also State enum class. | 332 // Internal state machine. See also State enum class. |
(...skipping 25 matching lines...) Expand all Loading... |
343 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager); | 358 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager); |
344 }; | 359 }; |
345 | 360 |
346 // Outputs the stringified |state| to |os|. This is only for logging purposes. | 361 // Outputs the stringified |state| to |os|. This is only for logging purposes. |
347 std::ostream& operator<<(std::ostream& os, | 362 std::ostream& operator<<(std::ostream& os, |
348 const ArcSessionManager::State& state); | 363 const ArcSessionManager::State& state); |
349 | 364 |
350 } // namespace arc | 365 } // namespace arc |
351 | 366 |
352 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ | 367 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ |
OLD | NEW |