| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 std::unique_ptr<ArcSessionRunner> arc_session_runner); | 119 std::unique_ptr<ArcSessionRunner> arc_session_runner); |
| 120 ~ArcSessionManager() override; | 120 ~ArcSessionManager() override; |
| 121 | 121 |
| 122 static ArcSessionManager* Get(); | 122 static ArcSessionManager* Get(); |
| 123 | 123 |
| 124 // It is called from chrome/browser/prefs/browser_prefs.cc. | 124 // It is called from chrome/browser/prefs/browser_prefs.cc. |
| 125 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 125 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| 126 | 126 |
| 127 static void DisableUIForTesting(); | 127 static void DisableUIForTesting(); |
| 128 static void SetShelfDelegateForTesting(ash::ShelfDelegate* shelf_delegate); | 128 static void SetShelfDelegateForTesting(ash::ShelfDelegate* shelf_delegate); |
| 129 | |
| 130 // Checks if OptIn verification was disabled by switch in command line. | |
| 131 static bool IsOptInVerificationDisabled(); | |
| 132 | |
| 133 static void EnableCheckAndroidManagementForTesting(); | 129 static void EnableCheckAndroidManagementForTesting(); |
| 134 | 130 |
| 135 // Returns true if Arc is allowed to run for the given profile. | |
| 136 static bool IsAllowedForProfile(const Profile* profile); | |
| 137 | |
| 138 // Disallows ARC for all profiles for testing. | |
| 139 static void DisallowForTesting(); | |
| 140 | |
| 141 // Returns true if ARC should run under Kiosk mode. | |
| 142 static bool IsArcKioskMode(); | |
| 143 | |
| 144 // Returns true if Arc is allowed to run for the current session. | 131 // Returns true if Arc is allowed to run for the current session. |
| 132 // TODO(hidehiko): The name is very close to IsArcAllowedForProfile(), but |
| 133 // has different meaning. Clean this up. |
| 145 bool IsAllowed() const; | 134 bool IsAllowed() const; |
| 146 | 135 |
| 147 void OnPrimaryUserProfilePrepared(Profile* profile); | 136 void OnPrimaryUserProfilePrepared(Profile* profile); |
| 148 void Shutdown(); | 137 void Shutdown(); |
| 149 | 138 |
| 150 Profile* profile() { return profile_; } | 139 Profile* profile() { return profile_; } |
| 151 const Profile* profile() const { return profile_; } | 140 const Profile* profile() const { return profile_; } |
| 152 | 141 |
| 153 State state() const { return state_; } | 142 State state() const { return state_; } |
| 154 | 143 |
| 155 // Adds or removes observers. | 144 // Adds or removes observers. |
| 156 void AddObserver(Observer* observer); | 145 void AddObserver(Observer* observer); |
| 157 void RemoveObserver(Observer* observer); | 146 void RemoveObserver(Observer* observer); |
| 158 | 147 |
| 159 // Adds or removes ArcSessionObservers. | 148 // Adds or removes ArcSessionObservers. |
| 160 // TODO(hidehiko): The observer should be migrated into | 149 // TODO(hidehiko): The observer should be migrated into |
| 161 // ArcSessionManager::Observer. | 150 // ArcSessionManager::Observer. |
| 162 void AddSessionObserver(ArcSessionObserver* observer); | 151 void AddSessionObserver(ArcSessionObserver* observer); |
| 163 void RemoveSessionObserver(ArcSessionObserver* observer); | 152 void RemoveSessionObserver(ArcSessionObserver* observer); |
| 164 | 153 |
| 165 // Returns true if ARC instance is running/stopped, respectively. | 154 // Returns true if ARC instance is running/stopped, respectively. |
| 166 // See ArcSessionRunner::IsRunning()/IsStopped() for details. | 155 // See ArcSessionRunner::IsRunning()/IsStopped() for details. |
| 167 bool IsSessionRunning() const; | 156 bool IsSessionRunning() const; |
| 168 bool IsSessionStopped() const; | 157 bool IsSessionStopped() const; |
| 169 | 158 |
| 170 // Called from Arc support platform app when user cancels signing. | 159 // Called from Arc support platform app when user cancels signing. |
| 171 void CancelAuthCode(); | 160 void CancelAuthCode(); |
| 172 | 161 |
| 162 // TODO(hidehiko): Better to rename longer but descriptive one, e.g. |
| 163 // IsArcEnabledPreferenceManaged. |
| 164 // TODO(hidehiko): Look at the real usage, and write document. |
| 173 bool IsArcManaged() const; | 165 bool IsArcManaged() const; |
| 166 |
| 167 // TODO(hidehiko): better to rename longer but descriptive one, e.g. |
| 168 // IsArcPlayStoreEnabled(). |
| 169 // TODO(hidehiko): Look at the real usage, and write document. |
| 174 bool IsArcEnabled() const; | 170 bool IsArcEnabled() const; |
| 175 | 171 |
| 176 // This requires Arc to be allowed (|IsAllowed|)for current profile. | 172 // This requires Arc to be allowed (|IsAllowed|)for current profile. |
| 177 void EnableArc(); | 173 void EnableArc(); |
| 178 void DisableArc(); | 174 void DisableArc(); |
| 179 | 175 |
| 180 // Called from the Chrome OS metrics provider to record Arc.State | 176 // Called from the Chrome OS metrics provider to record Arc.State |
| 181 // periodically. | 177 // periodically. |
| 182 void RecordArcState(); | 178 void RecordArcState(); |
| 183 | 179 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager); | 280 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager); |
| 285 }; | 281 }; |
| 286 | 282 |
| 287 // Outputs the stringified |state| to |os|. This is only for logging purposes. | 283 // Outputs the stringified |state| to |os|. This is only for logging purposes. |
| 288 std::ostream& operator<<(std::ostream& os, | 284 std::ostream& operator<<(std::ostream& os, |
| 289 const ArcSessionManager::State& state); | 285 const ArcSessionManager::State& state); |
| 290 | 286 |
| 291 } // namespace arc | 287 } // namespace arc |
| 292 | 288 |
| 293 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ | 289 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ |
| OLD | NEW |