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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
160 // enabled or disabled. Please see also TODO of | 160 // enabled or disabled. Please see also TODO of |
161 // SetArcPlayStoreEnabledForProfile(). | 161 // SetArcPlayStoreEnabledForProfile(). |
162 void RequestEnable(); | 162 void RequestEnable(); |
163 | 163 |
164 // Requests to disable ARC session. This stops ARC instance, or quits Terms | 164 // Requests to disable ARC session. This stops ARC instance, or quits Terms |
165 // Of Service negotiation if it is the middle of the process (e.g. closing | 165 // Of Service negotiation if it is the middle of the process (e.g. closing |
166 // UI for manual negotiation if it is shown). | 166 // UI for manual negotiation if it is shown). |
167 // If it is already requested to disable, no-op. | 167 // If it is already requested to disable, no-op. |
168 void RequestDisable(); | 168 void RequestDisable(); |
169 | 169 |
170 // Requests to remove the ARC data. | |
171 // If ARC is stopped, triggers to remove the data. Otherwise, queues to | |
172 // remove the data on ARC stopping. | |
Luis Héctor Chávez
2017/03/07 21:52:00
nit: "after ARC stops" is a bit more precise (othe
hidehiko
2017/03/09 09:25:51
Done.
| |
173 // A log statement with the removal reason must be added prior to calling | |
174 // this. | |
175 void RequestArcDataRemoval(); | |
176 | |
170 // Called from the Chrome OS metrics provider to record Arc.State | 177 // Called from the Chrome OS metrics provider to record Arc.State |
171 // periodically. | 178 // periodically. |
172 void RecordArcState(); | 179 void RecordArcState(); |
173 | 180 |
174 // ArcSupportHost::Observer: | 181 // ArcSupportHost::Observer: |
175 void OnWindowClosed() override; | 182 void OnWindowClosed() override; |
176 void OnTermsAgreed(bool is_metrics_enabled, | 183 void OnTermsAgreed(bool is_metrics_enabled, |
177 bool is_backup_and_restore_enabled, | 184 bool is_backup_and_restore_enabled, |
178 bool is_location_service_enabled) override; | 185 bool is_location_service_enabled) override; |
179 void OnRetryClicked() override; | 186 void OnRetryClicked() override; |
180 void OnSendFeedbackClicked() override; | 187 void OnSendFeedbackClicked() override; |
181 | 188 |
182 // StopArc(), then restart. Between them data clear may happens. | 189 // StopArc(), then restart. Between them data clear may happens. |
183 // This is a special method to support enterprise device lost case. | 190 // This is a special method to support enterprise device lost case. |
184 // This can be called only when ARC is running. | 191 // This can be called only when ARC is running. |
185 void StopAndEnableArc(); | 192 void StopAndEnableArc(); |
186 | 193 |
187 // Removes the data if ARC is stopped. Otherwise, queue to remove the data | |
188 // on ARC is stopped. A log statement with the removal reason must be added | |
189 // prior to calling RemoveArcData(). | |
190 void RemoveArcData(); | |
191 | |
192 ArcSupportHost* support_host() { return support_host_.get(); } | 194 ArcSupportHost* support_host() { return support_host_.get(); } |
193 | 195 |
194 // TODO(hidehiko): Get rid of the getter by migration between ArcAuthContext | 196 // TODO(hidehiko): Get rid of the getter by migration between ArcAuthContext |
195 // and ArcAuthInfoFetcher. | 197 // and ArcAuthInfoFetcher. |
196 ArcAuthContext* auth_context() { return context_.get(); } | 198 ArcAuthContext* auth_context() { return context_.get(); } |
197 | 199 |
198 // On provisioning completion (regardless of whether successfully done or | 200 // On provisioning completion (regardless of whether successfully done or |
199 // not), this is called with its status. On success, called with | 201 // not), this is called with its status. On success, called with |
200 // ProvisioningResult::SUCCESS, otherwise |result| is the error reason. | 202 // ProvisioningResult::SUCCESS, otherwise |result| is the error reason. |
201 void OnProvisioningFinished(ProvisioningResult result); | 203 void OnProvisioningFinished(ProvisioningResult result); |
(...skipping 23 matching lines...) Expand all Loading... | |
225 // RequestEnable() has a check in order not to trigger starting procedure | 227 // RequestEnable() has a check in order not to trigger starting procedure |
226 // twice. This method can be called to bypass that check when restarting. | 228 // twice. This method can be called to bypass that check when restarting. |
227 void RequestEnableImpl(); | 229 void RequestEnableImpl(); |
228 | 230 |
229 // Negotiates the terms of service to user. | 231 // Negotiates the terms of service to user. |
230 void StartTermsOfServiceNegotiation(); | 232 void StartTermsOfServiceNegotiation(); |
231 void OnTermsOfServiceNegotiated(bool accepted); | 233 void OnTermsOfServiceNegotiated(bool accepted); |
232 | 234 |
233 void SetState(State state); | 235 void SetState(State state); |
234 void ShutdownSession(); | 236 void ShutdownSession(); |
235 void OnArcDataRemoved(bool success); | |
236 void OnArcSignInTimeout(); | 237 void OnArcSignInTimeout(); |
237 | 238 |
238 // Starts Android management check. This is for first boot case (= Opt-in | 239 // Starts Android management check. This is for first boot case (= Opt-in |
239 // or OOBE flow case). In secondary or later ARC enabling, the check should | 240 // or OOBE flow case). In secondary or later ARC enabling, the check should |
240 // run in background. | 241 // run in background. |
241 void StartAndroidManagementCheck(); | 242 void StartAndroidManagementCheck(); |
242 | 243 |
243 // Called when the Android management check is done in opt-in flow or | 244 // Called when the Android management check is done in opt-in flow or |
244 // OOBE flow. | 245 // OOBE flow. |
245 void OnAndroidManagementChecked( | 246 void OnAndroidManagementChecked( |
(...skipping 20 matching lines...) Expand all Loading... | |
266 // Requests to stop ARC instnace. This resets two persistent flags: | 267 // Requests to stop ARC instnace. This resets two persistent flags: |
267 // kArcSignedIn and kArcTermsAccepted, so that, in next enabling, | 268 // kArcSignedIn and kArcTermsAccepted, so that, in next enabling, |
268 // it is started from Terms of Service negotiation. | 269 // it is started from Terms of Service negotiation. |
269 // TODO(hidehiko): Introduce STOPPING state, and this function should | 270 // TODO(hidehiko): Introduce STOPPING state, and this function should |
270 // transition to it. | 271 // transition to it. |
271 void StopArc(); | 272 void StopArc(); |
272 | 273 |
273 // ArcSessionRunner::Observer: | 274 // ArcSessionRunner::Observer: |
274 void OnSessionStopped(ArcStopReason reason, bool restarting) override; | 275 void OnSessionStopped(ArcStopReason reason, bool restarting) override; |
275 | 276 |
277 // Starts to remove ARC data, if it is requested via RequestArcDataRemoval(). | |
278 // On completion, OnArcDataRemoved() is called. | |
279 // If not requested, OnArcDataRemoved() is called as if the data removal | |
Yusuke Sato
2017/03/07 21:03:08
Please update the comment too.
hidehiko
2017/03/09 09:25:51
Done.
| |
280 // is done successfully, synchronously. | |
281 void StartArcDataRemoval(); | |
Luis Héctor Chávez
2017/03/07 21:52:00
Another vote to call this "MaybeStartArcDataRemova
hidehiko
2017/03/09 09:25:51
Done.
| |
282 void OnArcDataRemoved(bool success); | |
283 | |
276 // On ARC session stopped and/or data removal completion, this is called | 284 // On ARC session stopped and/or data removal completion, this is called |
277 // so that, if necessary, ARC session is restarted. | 285 // so that, if necessary, ARC session is restarted. |
278 // TODO(hidehiko): This can be removed after the racy state machine | 286 // TODO(hidehiko): This can be removed after the racy state machine |
279 // is fixed. | 287 // is fixed. |
280 void MaybeReenableArc(); | 288 void MaybeReenableArc(); |
281 | 289 |
282 std::unique_ptr<ArcSessionRunner> arc_session_runner_; | 290 std::unique_ptr<ArcSessionRunner> arc_session_runner_; |
283 | 291 |
284 // Unowned pointer. Keeps current profile. | 292 // Unowned pointer. Keeps current profile. |
285 Profile* profile_ = nullptr; | 293 Profile* profile_ = nullptr; |
(...skipping 29 matching lines...) Expand all Loading... | |
315 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager); | 323 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager); |
316 }; | 324 }; |
317 | 325 |
318 // Outputs the stringified |state| to |os|. This is only for logging purposes. | 326 // Outputs the stringified |state| to |os|. This is only for logging purposes. |
319 std::ostream& operator<<(std::ostream& os, | 327 std::ostream& operator<<(std::ostream& os, |
320 const ArcSessionManager::State& state); | 328 const ArcSessionManager::State& state); |
321 | 329 |
322 } // namespace arc | 330 } // namespace arc |
323 | 331 |
324 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ | 332 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ |
OLD | NEW |