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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 114 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 114 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| 115 | 115 |
| 116 static void DisableUIForTesting(); | 116 static void DisableUIForTesting(); |
| 117 static void EnableCheckAndroidManagementForTesting(); | 117 static void EnableCheckAndroidManagementForTesting(); |
| 118 | 118 |
| 119 // Returns true if ARC is allowed to run for the current session. | 119 // Returns true if ARC is allowed to run for the current session. |
| 120 // TODO(hidehiko): The name is very close to IsArcAllowedForProfile(), but | 120 // TODO(hidehiko): The name is very close to IsArcAllowedForProfile(), but |
| 121 // has different meaning. Clean this up. | 121 // has different meaning. Clean this up. |
| 122 bool IsAllowed() const; | 122 bool IsAllowed() const; |
| 123 | 123 |
| 124 void OnPrimaryUserProfilePrepared(Profile* profile); | |
| 125 void Shutdown(); | 124 void Shutdown(); |
| 126 | 125 |
| 126 // Sets the |profile|, and sets up Profile related fields in this instance. | |
| 127 // IsArcAllowedForProfile() must return true for the given |profile|. | |
| 128 void SetProfile(Profile* profile); | |
| 129 | |
| 127 Profile* profile() { return profile_; } | 130 Profile* profile() { return profile_; } |
| 128 const Profile* profile() const { return profile_; } | 131 const Profile* profile() const { return profile_; } |
| 129 | 132 |
| 130 State state() const { return state_; } | 133 State state() const { return state_; } |
| 131 | 134 |
| 135 // Starts observing Google Play Store enabled preference change. | |
| 136 // Also, based on its initial value, this may start ArcSession, or may start | |
| 137 // removing the data, as initial state. | |
| 138 // In addition, this triggers to show ArcAuthNotification, if necessary. | |
| 139 // Note that this must be called after SetProfile(). | |
| 140 // TODO(hidehiko): Extract preference related code into a class to split the | |
| 141 // dependencty. | |
| 142 void StartPreferenceHandler(); | |
|
hidehiko
2017/02/24 18:29:13
Note: this is named after the new class planning t
| |
| 143 | |
| 132 // Adds or removes observers. | 144 // Adds or removes observers. |
| 133 void AddObserver(Observer* observer); | 145 void AddObserver(Observer* observer); |
| 134 void RemoveObserver(Observer* observer); | 146 void RemoveObserver(Observer* observer); |
| 135 | 147 |
| 136 // Adds or removes ArcSessionObservers. | 148 // Adds or removes ArcSessionObservers. |
| 137 // TODO(hidehiko): The observer should be migrated into | 149 // TODO(hidehiko): The observer should be migrated into |
| 138 // ArcSessionManager::Observer. | 150 // ArcSessionManager::Observer. |
| 139 void AddSessionObserver(ArcSessionObserver* observer); | 151 void AddSessionObserver(ArcSessionObserver* observer); |
| 140 void RemoveSessionObserver(ArcSessionObserver* observer); | 152 void RemoveSessionObserver(ArcSessionObserver* observer); |
| 141 | 153 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 228 // Returns whether ARC is managed and all ARC related OptIn preferences are | 240 // Returns whether ARC is managed and all ARC related OptIn preferences are |
| 229 // managed too. | 241 // managed too. |
| 230 bool AreArcAllOptInPreferencesManaged() const; | 242 bool AreArcAllOptInPreferencesManaged() const; |
| 231 | 243 |
| 232 void SetState(State state); | 244 void SetState(State state); |
| 233 void ShutdownSession(); | 245 void ShutdownSession(); |
| 234 void OnOptInPreferenceChanged(); | 246 void OnOptInPreferenceChanged(); |
| 235 void OnAndroidManagementPassed(); | 247 void OnAndroidManagementPassed(); |
| 236 void OnArcDataRemoved(bool success); | 248 void OnArcDataRemoved(bool success); |
| 237 void OnArcSignInTimeout(); | 249 void OnArcSignInTimeout(); |
| 238 void FetchAuthCode(); | |
|
hidehiko
2017/02/24 18:29:13
This is declared but not defined (unused). So slig
| |
| 239 void PrepareContextForAuthCodeRequest(); | |
| 240 | 250 |
| 241 void StartArcAndroidManagementCheck(); | 251 void StartArcAndroidManagementCheck(); |
| 242 void MaybeReenableArc(); | 252 void MaybeReenableArc(); |
| 243 | 253 |
| 244 // Called when the Android management check is done in opt-in flow or | 254 // Called when the Android management check is done in opt-in flow or |
| 245 // re-auth flow. | 255 // re-auth flow. |
| 246 void OnAndroidManagementChecked( | 256 void OnAndroidManagementChecked( |
| 247 policy::AndroidManagementClient::Result result); | 257 policy::AndroidManagementClient::Result result); |
| 248 | 258 |
| 249 // Called when the background Android management check is done. It is | 259 // Called when the background Android management check is done. It is |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 295 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager); | 305 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager); |
| 296 }; | 306 }; |
| 297 | 307 |
| 298 // 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. |
| 299 std::ostream& operator<<(std::ostream& os, | 309 std::ostream& operator<<(std::ostream& os, |
| 300 const ArcSessionManager::State& state); | 310 const ArcSessionManager::State& state); |
| 301 | 311 |
| 302 } // namespace arc | 312 } // namespace arc |
| 303 | 313 |
| 304 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ | 314 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ |
| OLD | NEW |