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 OptIn flow. | |
99 virtual void OnArcStartOptInAndroidManagementCheck() {} | |
Luis Héctor Chávez
2017/03/13 15:50:41
nit: Events should be OnArc[Phrase][Verb in past p
emaxx
2017/03/16 18:32:12
Done.
| |
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 to be displayed in the | |
hidehiko
2017/03/13 05:10:46
ARC support app can switch to an error page by its
emaxx
2017/03/16 18:32:12
Done. Tried to address this by the name of the met
| |
113 // support host. | |
114 virtual void OnArcSupportHostErrorShown(ArcSupportHost::Error error) {} | |
115 | |
108 protected: | 116 protected: |
109 virtual ~Observer() = default; | 117 virtual ~Observer() = default; |
110 }; | 118 }; |
111 | 119 |
112 explicit ArcSessionManager( | 120 explicit ArcSessionManager( |
113 std::unique_ptr<ArcSessionRunner> arc_session_runner); | 121 std::unique_ptr<ArcSessionRunner> arc_session_runner); |
114 ~ArcSessionManager() override; | 122 ~ArcSessionManager() override; |
115 | 123 |
116 static ArcSessionManager* Get(); | 124 static ArcSessionManager* Get(); |
117 | 125 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
292 // MaybeReenableArc() directly. | 300 // MaybeReenableArc() directly. |
293 void MaybeStartArcDataRemoval(); | 301 void MaybeStartArcDataRemoval(); |
294 void OnArcDataRemoved(bool success); | 302 void OnArcDataRemoved(bool success); |
295 | 303 |
296 // On ARC session stopped and/or data removal completion, this is called | 304 // On ARC session stopped and/or data removal completion, this is called |
297 // so that, if necessary, ARC session is restarted. | 305 // so that, if necessary, ARC session is restarted. |
298 // TODO(hidehiko): This can be removed after the racy state machine | 306 // TODO(hidehiko): This can be removed after the racy state machine |
299 // is fixed. | 307 // is fixed. |
300 void MaybeReenableArc(); | 308 void MaybeReenableArc(); |
301 | 309 |
310 // Requests the support host (if it exists) to show the error, and notifies | |
311 // the observers. | |
312 void ShowArcSupportHostError(ArcSupportHost::Error error, | |
313 bool should_show_send_feedback); | |
314 | |
302 std::unique_ptr<ArcSessionRunner> arc_session_runner_; | 315 std::unique_ptr<ArcSessionRunner> arc_session_runner_; |
303 | 316 |
304 // Unowned pointer. Keeps current profile. | 317 // Unowned pointer. Keeps current profile. |
305 Profile* profile_ = nullptr; | 318 Profile* profile_ = nullptr; |
306 | 319 |
307 // Whether ArcSessionManager is requested to enable (starting to run ARC | 320 // Whether ArcSessionManager is requested to enable (starting to run ARC |
308 // instance) or not. | 321 // instance) or not. |
309 bool enable_requested_ = false; | 322 bool enable_requested_ = false; |
310 | 323 |
311 // Internal state machine. See also State enum class. | 324 // Internal state machine. See also State enum class. |
(...skipping 23 matching lines...) Expand all Loading... | |
335 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager); | 348 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager); |
336 }; | 349 }; |
337 | 350 |
338 // Outputs the stringified |state| to |os|. This is only for logging purposes. | 351 // Outputs the stringified |state| to |os|. This is only for logging purposes. |
339 std::ostream& operator<<(std::ostream& os, | 352 std::ostream& operator<<(std::ostream& os, |
340 const ArcSessionManager::State& state); | 353 const ArcSessionManager::State& state); |
341 | 354 |
342 } // namespace arc | 355 } // namespace arc |
343 | 356 |
344 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ | 357 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ |
OLD | NEW |