Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1596)

Side by Side Diff: chrome/browser/chromeos/arc/arc_session_manager.h

Issue 2734873002: Fix ArcSessionManager state machine, part 2. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 // Request to remove the ARC data.
Yusuke Sato 2017/03/06 21:39:59 Requests
hidehiko 2017/03/07 18:51:02 Done.
171 // If ARC is stopped, triggers to remove the data. Otherwise, queues to
172 // remove the data on ARC stopping.
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 28 matching lines...) Expand all
230 void StartTermsOfServiceNegotiation(); 232 void StartTermsOfServiceNegotiation();
231 void OnTermsOfServiceNegotiated(bool accepted); 233 void OnTermsOfServiceNegotiated(bool accepted);
232 234
233 // Returns whether ARC is managed and all ARC related OptIn preferences are 235 // Returns whether ARC is managed and all ARC related OptIn preferences are
234 // managed too. 236 // managed too.
235 bool AreArcAllOptInPreferencesManaged() const; 237 bool AreArcAllOptInPreferencesManaged() const;
236 238
237 void SetState(State state); 239 void SetState(State state);
238 void ShutdownSession(); 240 void ShutdownSession();
239 void OnAndroidManagementPassed(); 241 void OnAndroidManagementPassed();
240 void OnArcDataRemoved(bool success);
241 void OnArcSignInTimeout(); 242 void OnArcSignInTimeout();
242 243
243 void StartArcAndroidManagementCheck(); 244 void StartArcAndroidManagementCheck();
244 void MaybeReenableArc(); 245 void MaybeReenableArc();
245 246
246 // Called when the Android management check is done in opt-in flow or 247 // Called when the Android management check is done in opt-in flow or
247 // re-auth flow. 248 // re-auth flow.
248 void OnAndroidManagementChecked( 249 void OnAndroidManagementChecked(
249 policy::AndroidManagementClient::Result result); 250 policy::AndroidManagementClient::Result result);
250 251
251 // Called when the background Android management check is done. It is 252 // Called when the background Android management check is done. It is
252 // triggered when the second or later ARC boot timing. 253 // triggered when the second or later ARC boot timing.
253 void OnBackgroundAndroidManagementChecked( 254 void OnBackgroundAndroidManagementChecked(
254 policy::AndroidManagementClient::Result result); 255 policy::AndroidManagementClient::Result result);
255 256
256 // Requests to starts ARC instance. Also, update the internal state to 257 // Requests to starts ARC instance. Also, update the internal state to
257 // ACTIVE. 258 // ACTIVE.
258 void StartArc(); 259 void StartArc();
259 260
260 // Requests to stop ARC instnace. This resets two persistent flags: 261 // Requests to stop ARC instnace. This resets two persistent flags:
261 // kArcSignedIn and kArcTermsAccepted, so that, in next enabling, 262 // kArcSignedIn and kArcTermsAccepted, so that, in next enabling,
262 // it is started from Terms of Service negotiation. 263 // it is started from Terms of Service negotiation.
263 // TODO(hidehiko): Introduce STOPPING state, and this function should 264 // TODO(hidehiko): Introduce STOPPING state, and this function should
264 // transition to it. 265 // transition to it.
265 void StopArc(); 266 void StopArc();
266 267
267 // ArcSessionRunner::Observer: 268 // ArcSessionRunner::Observer:
268 void OnSessionStopped(ArcStopReason reason, bool restarting) override; 269 void OnSessionStopped(ArcStopReason reason, bool restarting) override;
269 270
271 // Starts to remove ARC data, if it is requested via RequestArcDataRemoval().
272 // On completion, OnArcDataRemoved() is called.
273 // If not requested, OnArcDataRemoved() is called as if the data removal
274 // is done successfully, synchronously.
275 void StartArcDataRemoval();
276 void OnArcDataRemoved(bool success);
277
270 std::unique_ptr<ArcSessionRunner> arc_session_runner_; 278 std::unique_ptr<ArcSessionRunner> arc_session_runner_;
271 279
272 // Unowned pointer. Keeps current profile. 280 // Unowned pointer. Keeps current profile.
273 Profile* profile_ = nullptr; 281 Profile* profile_ = nullptr;
274 282
275 // Whether ArcSessionManager is requested to enable (starting to run ARC 283 // Whether ArcSessionManager is requested to enable (starting to run ARC
276 // instance) or not. 284 // instance) or not.
277 bool enable_requested_ = false; 285 bool enable_requested_ = false;
278 286
279 // Internal state machine. See also State enum class. 287 // Internal state machine. See also State enum class.
(...skipping 23 matching lines...) Expand all
303 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager); 311 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager);
304 }; 312 };
305 313
306 // Outputs the stringified |state| to |os|. This is only for logging purposes. 314 // Outputs the stringified |state| to |os|. This is only for logging purposes.
307 std::ostream& operator<<(std::ostream& os, 315 std::ostream& operator<<(std::ostream& os,
308 const ArcSessionManager::State& state); 316 const ArcSessionManager::State& state);
309 317
310 } // namespace arc 318 } // namespace arc
311 319
312 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ 320 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698