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 // Enables ARC session. This starts ARC instance, or maybe starts Terms Of | |
| 174 // Service negotiation if they haven't been accepted yet. | |
| 175 // If it is already enabled, no-op. | |
| 176 // Currently, enabled/disabled is tied to whether Google Play Store is | |
|
Luis Héctor Chávez
2017/02/15 19:18:53
Maybe add a TODO?
hidehiko
2017/02/15 19:45:12
Instead, referred TODO at SetArcPlayStoreEnabled()
| |
| 177 // enabled or disabled. | |
| 178 void Enable(); | |
|
Luis Héctor Chávez
2017/02/15 19:18:53
I find it a bit inconsistent that we have SetArcPl
hidehiko
2017/02/15 19:45:12
No big reason, but I just followed RequestStart/St
Luis Héctor Chávez
2017/02/15 21:54:43
Given that we want to mirror that, should this be
hidehiko
2017/02/16 02:44:28
Done.
| |
| 179 | |
| 180 // Disables ARC session. This stops ARC instance, or quits Terms Of Service | |
| 181 // negotiation if it is the middle of the process (e.g. closing UI for | |
| 182 // manual negotiation if it is shown). | |
| 183 // If it is already disabled, no-op. | |
| 184 void Disable(); | |
| 185 | |
| 173 // Called from the Chrome OS metrics provider to record Arc.State | 186 // Called from the Chrome OS metrics provider to record Arc.State |
| 174 // periodically. | 187 // periodically. |
| 175 void RecordArcState(); | 188 void RecordArcState(); |
| 176 | 189 |
| 177 // sync_preferences::PrefServiceSyncableObserver | 190 // sync_preferences::PrefServiceSyncableObserver |
| 178 void OnIsSyncingChanged() override; | 191 void OnIsSyncingChanged() override; |
| 179 | 192 |
| 180 // ArcSupportHost::Observer: | 193 // ArcSupportHost::Observer: |
| 181 void OnWindowClosed() override; | 194 void OnWindowClosed() override; |
| 182 void OnTermsAgreed(bool is_metrics_enabled, | 195 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 | 228 // Returns the time when ARC was about to start, or a null time if ARC has not |
| 216 // been started yet. | 229 // been started yet. |
| 217 base::Time arc_start_time() const { return arc_start_time_; } | 230 base::Time arc_start_time() const { return arc_start_time_; } |
| 218 | 231 |
| 219 // Injectors for testing. | 232 // Injectors for testing. |
| 220 void SetArcSessionRunnerForTesting( | 233 void SetArcSessionRunnerForTesting( |
| 221 std::unique_ptr<ArcSessionRunner> arc_session_runner); | 234 std::unique_ptr<ArcSessionRunner> arc_session_runner); |
| 222 void SetAttemptUserExitCallbackForTesting(const base::Closure& callback); | 235 void SetAttemptUserExitCallbackForTesting(const base::Closure& callback); |
| 223 | 236 |
| 224 private: | 237 private: |
| 238 // Enable() has a check in order not to trigger starting procedure twice. | |
| 239 // This method can be called to bypass that check when restarting. | |
| 240 void EnableImpl(); | |
| 241 | |
| 225 // Negotiates the terms of service to user. | 242 // Negotiates the terms of service to user. |
| 226 void StartTermsOfServiceNegotiation(); | 243 void StartTermsOfServiceNegotiation(); |
| 227 void OnTermsOfServiceNegotiated(bool accepted); | 244 void OnTermsOfServiceNegotiated(bool accepted); |
| 228 | 245 |
| 229 void SetState(State state); | 246 void SetState(State state); |
| 230 void ShutdownSession(); | 247 void ShutdownSession(); |
| 231 void OnOptInPreferenceChanged(); | 248 void OnOptInPreferenceChanged(); |
| 232 void OnAndroidManagementPassed(); | 249 void OnAndroidManagementPassed(); |
| 233 void OnArcDataRemoved(bool success); | 250 void OnArcDataRemoved(bool success); |
| 234 void OnArcSignInTimeout(); | 251 void OnArcSignInTimeout(); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 253 void OnSessionStopped(StopReason reason) override; | 270 void OnSessionStopped(StopReason reason) override; |
| 254 | 271 |
| 255 std::unique_ptr<ArcSessionRunner> arc_session_runner_; | 272 std::unique_ptr<ArcSessionRunner> arc_session_runner_; |
| 256 | 273 |
| 257 // Unowned pointer. Keeps current profile. | 274 // Unowned pointer. Keeps current profile. |
| 258 Profile* profile_ = nullptr; | 275 Profile* profile_ = nullptr; |
| 259 | 276 |
| 260 // Registrar used to monitor ARC enabled state. | 277 // Registrar used to monitor ARC enabled state. |
| 261 PrefChangeRegistrar pref_change_registrar_; | 278 PrefChangeRegistrar pref_change_registrar_; |
| 262 | 279 |
| 280 bool enabled_ = false; | |
| 263 State state_ = State::NOT_INITIALIZED; | 281 State state_ = State::NOT_INITIALIZED; |
| 264 base::ObserverList<Observer> observer_list_; | 282 base::ObserverList<Observer> observer_list_; |
| 265 base::ObserverList<ArcSessionObserver> arc_session_observer_list_; | 283 base::ObserverList<ArcSessionObserver> arc_session_observer_list_; |
| 266 std::unique_ptr<ArcAppLauncher> playstore_launcher_; | 284 std::unique_ptr<ArcAppLauncher> playstore_launcher_; |
| 267 bool reenable_arc_ = false; | 285 bool reenable_arc_ = false; |
| 268 bool provisioning_reported_ = false; | 286 bool provisioning_reported_ = false; |
| 269 base::OneShotTimer arc_sign_in_timer_; | 287 base::OneShotTimer arc_sign_in_timer_; |
| 270 | 288 |
| 271 std::unique_ptr<ArcSupportHost> support_host_; | 289 std::unique_ptr<ArcSupportHost> support_host_; |
| 272 | 290 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 287 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager); | 305 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager); |
| 288 }; | 306 }; |
| 289 | 307 |
| 290 // Outputs the stringified |state| to |os|. This is only for logging purposes. | 308 // Outputs the stringified |state| to |os|. This is only for logging purposes. |
| 291 std::ostream& operator<<(std::ostream& os, | 309 std::ostream& operator<<(std::ostream& os, |
| 292 const ArcSessionManager::State& state); | 310 const ArcSessionManager::State& state); |
| 293 | 311 |
| 294 } // namespace arc | 312 } // namespace arc |
| 295 | 313 |
| 296 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ | 314 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ |
| OLD | NEW |