Chromium Code Reviews| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 bool IsArcPlayStoreEnabled() const; | 163 bool IsArcPlayStoreEnabled() const; |
| 164 | 164 |
| 165 // Enables/disables Google Play Store on ARC. Currently, it is tied to | 165 // Enables/disables Google Play Store on ARC. Currently, it is tied to |
| 166 // ARC enabled state, too, so this also should trigger to enable/disable | 166 // ARC enabled state, too, so this also should trigger to enable/disable |
| 167 // whole ARC system. | 167 // whole ARC system. |
| 168 // TODO(hidehiko): De-couple the concept to enable ARC system and opt-in | 168 // TODO(hidehiko): De-couple the concept to enable ARC system and opt-in |
| 169 // to use Google Play Store. Note that there is a plan to use ARC without | 169 // to use Google Play Store. Note that there is a plan to use ARC without |
| 170 // Google Play Store, then ARC can run without opt-in. | 170 // Google Play Store, then ARC can run without opt-in. |
| 171 void SetArcPlayStoreEnabled(bool enable); | 171 void SetArcPlayStoreEnabled(bool enable); |
| 172 | 172 |
| 173 // Enabels ARC session. This triggers to start ARC instance, or maybe | |
|
Daniel Erat
2017/02/15 14:50:06
nit: "Enables"
hidehiko
2017/02/15 19:45:12
Done.
| |
| 174 // to start Terms Of Service negotiation. | |
|
Daniel Erat
2017/02/15 14:50:06
maybe "This starts the ARC instance (or displays t
hidehiko
2017/02/15 19:45:12
Updated the comment. Note: ToS negotiation have va
| |
| 175 // If it is already enabled, no-op. | |
| 176 // Currently, enabled/disabled is tried to whether Google Play Store is | |
|
Daniel Erat
2017/02/15 14:50:06
nit: s/tried/tied/ ?
hidehiko
2017/02/15 19:45:11
Good catch. Done.
| |
| 177 // enabled or disabled. | |
| 178 void Enable(); | |
|
khmel
2017/02/15 15:54:34
These functions are public, Why do we need to have
hidehiko
2017/02/15 19:45:11
This is preparation to extract preference handler
| |
| 179 | |
| 180 // Disables ARC session. This triggers to stop ARC instance, or if it is | |
|
Daniel Erat
2017/02/15 14:50:06
"This stops the ARC instance (or closes the ToS if
hidehiko
2017/02/15 19:45:11
Done. Similar to Enable() case, I avoided to limit
| |
| 181 // middle of Terms Of Service negotiation, closes its UI etc. | |
| 182 // If it is already disabled, no-op. | |
| 183 // Currently, enabled/disabled is tried to whether Google Play Store is | |
|
Daniel Erat
2017/02/15 14:50:06
i'd delete this sentence since you have it earlier
hidehiko
2017/02/15 19:45:12
I see. Done.
| |
| 184 // enabled or disabled. | |
| 185 void Disable(); | |
| 186 | |
| 173 // Called from the Chrome OS metrics provider to record Arc.State | 187 // Called from the Chrome OS metrics provider to record Arc.State |
| 174 // periodically. | 188 // periodically. |
| 175 void RecordArcState(); | 189 void RecordArcState(); |
| 176 | 190 |
| 177 // sync_preferences::PrefServiceSyncableObserver | 191 // sync_preferences::PrefServiceSyncableObserver |
| 178 void OnIsSyncingChanged() override; | 192 void OnIsSyncingChanged() override; |
| 179 | 193 |
| 180 // ArcSupportHost::Observer: | 194 // ArcSupportHost::Observer: |
| 181 void OnWindowClosed() override; | 195 void OnWindowClosed() override; |
| 182 void OnTermsAgreed(bool is_metrics_enabled, | 196 void OnTermsAgreed(bool is_metrics_enabled, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 215 // Returns the time when ARC was about to start, or a null time if ARC has not | 229 // Returns the time when ARC was about to start, or a null time if ARC has not |
| 216 // been started yet. | 230 // been started yet. |
| 217 base::Time arc_start_time() const { return arc_start_time_; } | 231 base::Time arc_start_time() const { return arc_start_time_; } |
| 218 | 232 |
| 219 // Injectors for testing. | 233 // Injectors for testing. |
| 220 void SetArcSessionRunnerForTesting( | 234 void SetArcSessionRunnerForTesting( |
| 221 std::unique_ptr<ArcSessionRunner> arc_session_runner); | 235 std::unique_ptr<ArcSessionRunner> arc_session_runner); |
| 222 void SetAttemptUserExitCallbackForTesting(const base::Closure& callback); | 236 void SetAttemptUserExitCallbackForTesting(const base::Closure& callback); |
| 223 | 237 |
| 224 private: | 238 private: |
| 239 // Enable() has a check in order not to trigger starting procedure twice. | |
| 240 // For restarting, we would like to workaround it, and this is the method. | |
|
Daniel Erat
2017/02/15 14:50:06
nit: "This method can be called to bypass that che
hidehiko
2017/02/15 19:45:12
Thank you for good suggestion! Done.
| |
| 241 void EnableImpl(); | |
| 242 | |
| 225 // Negotiates the terms of service to user. | 243 // Negotiates the terms of service to user. |
| 226 void StartTermsOfServiceNegotiation(); | 244 void StartTermsOfServiceNegotiation(); |
| 227 void OnTermsOfServiceNegotiated(bool accepted); | 245 void OnTermsOfServiceNegotiated(bool accepted); |
| 228 | 246 |
| 229 void SetState(State state); | 247 void SetState(State state); |
| 230 void ShutdownSession(); | 248 void ShutdownSession(); |
| 231 void OnOptInPreferenceChanged(); | 249 void OnOptInPreferenceChanged(); |
| 232 void OnAndroidManagementPassed(); | 250 void OnAndroidManagementPassed(); |
| 233 void OnArcDataRemoved(bool success); | 251 void OnArcDataRemoved(bool success); |
| 234 void OnArcSignInTimeout(); | 252 void OnArcSignInTimeout(); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 253 void OnSessionStopped(StopReason reason) override; | 271 void OnSessionStopped(StopReason reason) override; |
| 254 | 272 |
| 255 std::unique_ptr<ArcSessionRunner> arc_session_runner_; | 273 std::unique_ptr<ArcSessionRunner> arc_session_runner_; |
| 256 | 274 |
| 257 // Unowned pointer. Keeps current profile. | 275 // Unowned pointer. Keeps current profile. |
| 258 Profile* profile_ = nullptr; | 276 Profile* profile_ = nullptr; |
| 259 | 277 |
| 260 // Registrar used to monitor ARC enabled state. | 278 // Registrar used to monitor ARC enabled state. |
| 261 PrefChangeRegistrar pref_change_registrar_; | 279 PrefChangeRegistrar pref_change_registrar_; |
| 262 | 280 |
| 281 bool enabled_ = false; | |
| 263 State state_ = State::NOT_INITIALIZED; | 282 State state_ = State::NOT_INITIALIZED; |
| 264 base::ObserverList<Observer> observer_list_; | 283 base::ObserverList<Observer> observer_list_; |
| 265 base::ObserverList<ArcSessionObserver> arc_session_observer_list_; | 284 base::ObserverList<ArcSessionObserver> arc_session_observer_list_; |
| 266 std::unique_ptr<ArcAppLauncher> playstore_launcher_; | 285 std::unique_ptr<ArcAppLauncher> playstore_launcher_; |
| 267 bool reenable_arc_ = false; | 286 bool reenable_arc_ = false; |
| 268 bool provisioning_reported_ = false; | 287 bool provisioning_reported_ = false; |
| 269 base::OneShotTimer arc_sign_in_timer_; | 288 base::OneShotTimer arc_sign_in_timer_; |
| 270 | 289 |
| 271 std::unique_ptr<ArcSupportHost> support_host_; | 290 std::unique_ptr<ArcSupportHost> support_host_; |
| 272 | 291 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 287 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager); | 306 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager); |
| 288 }; | 307 }; |
| 289 | 308 |
| 290 // Outputs the stringified |state| to |os|. This is only for logging purposes. | 309 // Outputs the stringified |state| to |os|. This is only for logging purposes. |
| 291 std::ostream& operator<<(std::ostream& os, | 310 std::ostream& operator<<(std::ostream& os, |
| 292 const ArcSessionManager::State& state); | 311 const ArcSessionManager::State& state); |
| 293 | 312 |
| 294 } // namespace arc | 313 } // namespace arc |
| 295 | 314 |
| 296 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ | 315 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ |
| OLD | NEW |