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. Note that this is not called in cases when | |
114 // the support app switches to an error page by itself. | |
hidehiko
2017/04/12 04:51:34
nit: could you add comment that "this is called ev
emaxx
2017/04/12 13:06:46
Done.
| |
115 virtual void OnArcErrorShowRequested(ArcSupportHost::Error error) {} | |
116 | |
108 protected: | 117 protected: |
109 virtual ~Observer() = default; | 118 virtual ~Observer() = default; |
110 }; | 119 }; |
111 | 120 |
112 explicit ArcSessionManager( | 121 explicit ArcSessionManager( |
113 std::unique_ptr<ArcSessionRunner> arc_session_runner); | 122 std::unique_ptr<ArcSessionRunner> arc_session_runner); |
114 ~ArcSessionManager() override; | 123 ~ArcSessionManager() override; |
115 | 124 |
116 static ArcSessionManager* Get(); | 125 static ArcSessionManager* Get(); |
117 | 126 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
298 // MaybeReenableArc() directly. | 307 // MaybeReenableArc() directly. |
299 void MaybeStartArcDataRemoval(); | 308 void MaybeStartArcDataRemoval(); |
300 void OnArcDataRemoved(bool success); | 309 void OnArcDataRemoved(bool success); |
301 | 310 |
302 // On ARC session stopped and/or data removal completion, this is called | 311 // On ARC session stopped and/or data removal completion, this is called |
303 // so that, if necessary, ARC session is restarted. | 312 // so that, if necessary, ARC session is restarted. |
304 // TODO(hidehiko): This can be removed after the racy state machine | 313 // TODO(hidehiko): This can be removed after the racy state machine |
305 // is fixed. | 314 // is fixed. |
306 void MaybeReenableArc(); | 315 void MaybeReenableArc(); |
307 | 316 |
317 // Requests the support host (if it exists) to show the error, and notifies | |
318 // the observers. | |
319 void ShowArcSupportHostError(ArcSupportHost::Error error, | |
320 bool should_show_send_feedback); | |
321 | |
308 std::unique_ptr<ArcSessionRunner> arc_session_runner_; | 322 std::unique_ptr<ArcSessionRunner> arc_session_runner_; |
309 | 323 |
310 // Unowned pointer. Keeps current profile. | 324 // Unowned pointer. Keeps current profile. |
311 Profile* profile_ = nullptr; | 325 Profile* profile_ = nullptr; |
312 | 326 |
313 // Whether ArcSessionManager is requested to enable (starting to run ARC | 327 // Whether ArcSessionManager is requested to enable (starting to run ARC |
314 // instance) or not. | 328 // instance) or not. |
315 bool enable_requested_ = false; | 329 bool enable_requested_ = false; |
316 | 330 |
317 // Internal state machine. See also State enum class. | 331 // Internal state machine. See also State enum class. |
(...skipping 25 matching lines...) Expand all Loading... | |
343 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager); | 357 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager); |
344 }; | 358 }; |
345 | 359 |
346 // Outputs the stringified |state| to |os|. This is only for logging purposes. | 360 // Outputs the stringified |state| to |os|. This is only for logging purposes. |
347 std::ostream& operator<<(std::ostream& os, | 361 std::ostream& operator<<(std::ostream& os, |
348 const ArcSessionManager::State& state); | 362 const ArcSessionManager::State& state); |
349 | 363 |
350 } // namespace arc | 364 } // namespace arc |
351 | 365 |
352 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ | 366 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ |
OLD | NEW |