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

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

Issue 2722263002: Add function document, and small refactor around Start/StopArc(). (Closed)
Patch Set: Rebase 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/arc/arc_session_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 void OnIsSyncingChanged() override; 181 void OnIsSyncingChanged() override;
182 182
183 // ArcSupportHost::Observer: 183 // ArcSupportHost::Observer:
184 void OnWindowClosed() override; 184 void OnWindowClosed() override;
185 void OnTermsAgreed(bool is_metrics_enabled, 185 void OnTermsAgreed(bool is_metrics_enabled,
186 bool is_backup_and_restore_enabled, 186 bool is_backup_and_restore_enabled,
187 bool is_location_service_enabled) override; 187 bool is_location_service_enabled) override;
188 void OnRetryClicked() override; 188 void OnRetryClicked() override;
189 void OnSendFeedbackClicked() override; 189 void OnSendFeedbackClicked() override;
190 190
191 // Stops ARC without changing ArcEnabled preference.
192 void StopArc();
193
194 // StopArc(), then restart. Between them data clear may happens. 191 // StopArc(), then restart. Between them data clear may happens.
195 // This is a special method to support enterprise device lost case. 192 // This is a special method to support enterprise device lost case.
196 // This can be called only when ARC is running. 193 // This can be called only when ARC is running.
197 void StopAndEnableArc(); 194 void StopAndEnableArc();
198 195
199 // Removes the data if ARC is stopped. Otherwise, queue to remove the data 196 // Removes the data if ARC is stopped. Otherwise, queue to remove the data
200 // on ARC is stopped. A log statement with the removal reason must be added 197 // on ARC is stopped. A log statement with the removal reason must be added
201 // prior to calling RemoveArcData(). 198 // prior to calling RemoveArcData().
202 void RemoveArcData(); 199 void RemoveArcData();
203 200
204 ArcSupportHost* support_host() { return support_host_.get(); } 201 ArcSupportHost* support_host() { return support_host_.get(); }
205 202
206 // TODO(hidehiko): Get rid of the getter by migration between ArcAuthContext 203 // TODO(hidehiko): Get rid of the getter by migration between ArcAuthContext
207 // and ArcAuthInfoFetcher. 204 // and ArcAuthInfoFetcher.
208 ArcAuthContext* auth_context() { return context_.get(); } 205 ArcAuthContext* auth_context() { return context_.get(); }
209 206
210 void StartArc(); 207 // On provisioning completion (regardless of whether successfully done or
211 208 // not), this is called with its status. On success, called with
209 // ProvisioningResult::SUCCESS, otherwise |result| is the error reason.
212 void OnProvisioningFinished(ProvisioningResult result); 210 void OnProvisioningFinished(ProvisioningResult result);
213 211
214 // Returns the time when the sign in process started, or a null time if 212 // Returns the time when the sign in process started, or a null time if
215 // signing in didn't happen during this session. 213 // signing in didn't happen during this session.
216 base::Time sign_in_start_time() const { return sign_in_start_time_; } 214 base::Time sign_in_start_time() const { return sign_in_start_time_; }
217 215
218 // Returns the time when ARC was about to start, or a null time if ARC has not 216 // Returns the time when ARC was about to start, or a null time if ARC has not
219 // been started yet. 217 // been started yet.
220 base::Time arc_start_time() const { return arc_start_time_; } 218 base::Time arc_start_time() const { return arc_start_time_; }
221 219
222 // Injectors for testing. 220 // Injectors for testing.
223 void SetArcSessionRunnerForTesting( 221 void SetArcSessionRunnerForTesting(
224 std::unique_ptr<ArcSessionRunner> arc_session_runner); 222 std::unique_ptr<ArcSessionRunner> arc_session_runner);
225 void SetAttemptUserExitCallbackForTesting(const base::Closure& callback); 223 void SetAttemptUserExitCallbackForTesting(const base::Closure& callback);
226 224
227 // Returns whether the Play Store app is requested to be launched by this 225 // Returns whether the Play Store app is requested to be launched by this
228 // class. Should be used only for tests. 226 // class. Should be used only for tests.
229 bool IsPlaystoreLaunchRequestedForTesting() const; 227 bool IsPlaystoreLaunchRequestedForTesting() const;
230 228
229 // Invoking StartArc() only for testing, e.g., to emulate accepting Terms of
230 // Service then passing Android management check successfully.
231 void StartArcForTesting() { StartArc(); }
232
231 private: 233 private:
232 // RequestEnable() has a check in order not to trigger starting procedure 234 // RequestEnable() has a check in order not to trigger starting procedure
233 // twice. This method can be called to bypass that check when restarting. 235 // twice. This method can be called to bypass that check when restarting.
234 void RequestEnableImpl(); 236 void RequestEnableImpl();
235 237
236 // Negotiates the terms of service to user. 238 // Negotiates the terms of service to user.
237 void StartTermsOfServiceNegotiation(); 239 void StartTermsOfServiceNegotiation();
238 void OnTermsOfServiceNegotiated(bool accepted); 240 void OnTermsOfServiceNegotiated(bool accepted);
239 241
240 // Returns whether ARC is managed and all ARC related OptIn preferences are 242 // Returns whether ARC is managed and all ARC related OptIn preferences are
(...skipping 13 matching lines...) Expand all
254 // Called when the Android management check is done in opt-in flow or 256 // Called when the Android management check is done in opt-in flow or
255 // re-auth flow. 257 // re-auth flow.
256 void OnAndroidManagementChecked( 258 void OnAndroidManagementChecked(
257 policy::AndroidManagementClient::Result result); 259 policy::AndroidManagementClient::Result result);
258 260
259 // Called when the background Android management check is done. It is 261 // Called when the background Android management check is done. It is
260 // triggered when the second or later ARC boot timing. 262 // triggered when the second or later ARC boot timing.
261 void OnBackgroundAndroidManagementChecked( 263 void OnBackgroundAndroidManagementChecked(
262 policy::AndroidManagementClient::Result result); 264 policy::AndroidManagementClient::Result result);
263 265
266 // Requests to starts ARC instance. Also, update the internal state to
267 // ACTIVE.
268 void StartArc();
269
270 // Requests to stop ARC instnace. This resets two persistent flags:
271 // kArcSignedIn and kArcTermsAccepted, so that, in next enabling,
272 // it is started from Terms of Service negotiation.
273 // TODO(hidehiko): Introduce STOPPING state, and this function should
274 // transition to it.
275 void StopArc();
276
264 // ArcSessionRunner::Observer: 277 // ArcSessionRunner::Observer:
265 void OnSessionStopped(ArcStopReason reason, bool restarting) override; 278 void OnSessionStopped(ArcStopReason reason, bool restarting) override;
266 279
267 std::unique_ptr<ArcSessionRunner> arc_session_runner_; 280 std::unique_ptr<ArcSessionRunner> arc_session_runner_;
268 281
269 // Unowned pointer. Keeps current profile. 282 // Unowned pointer. Keeps current profile.
270 Profile* profile_ = nullptr; 283 Profile* profile_ = nullptr;
271 284
272 // Registrar used to monitor ARC enabled state. 285 // Registrar used to monitor ARC enabled state.
273 PrefChangeRegistrar pref_change_registrar_; 286 PrefChangeRegistrar pref_change_registrar_;
(...skipping 29 matching lines...) Expand all
303 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager); 316 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager);
304 }; 317 };
305 318
306 // Outputs the stringified |state| to |os|. This is only for logging purposes. 319 // Outputs the stringified |state| to |os|. This is only for logging purposes.
307 std::ostream& operator<<(std::ostream& os, 320 std::ostream& operator<<(std::ostream& os,
308 const ArcSessionManager::State& state); 321 const ArcSessionManager::State& state);
309 322
310 } // namespace arc 323 } // namespace arc
311 324
312 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ 325 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/arc/arc_session_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698