| 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 |
| 129 static void EnableCheckAndroidManagementForTesting(); | 133 static void EnableCheckAndroidManagementForTesting(); |
| 130 | 134 |
| 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 |
| 131 // Returns true if Arc is allowed to run for the current session. | 144 // 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. | |
| 134 bool IsAllowed() const; | 145 bool IsAllowed() const; |
| 135 | 146 |
| 136 void OnPrimaryUserProfilePrepared(Profile* profile); | 147 void OnPrimaryUserProfilePrepared(Profile* profile); |
| 137 void Shutdown(); | 148 void Shutdown(); |
| 138 | 149 |
| 139 Profile* profile() { return profile_; } | 150 Profile* profile() { return profile_; } |
| 140 const Profile* profile() const { return profile_; } | 151 const Profile* profile() const { return profile_; } |
| 141 | 152 |
| 142 State state() const { return state_; } | 153 State state() const { return state_; } |
| 143 | 154 |
| 144 // Adds or removes observers. | 155 // Adds or removes observers. |
| 145 void AddObserver(Observer* observer); | 156 void AddObserver(Observer* observer); |
| 146 void RemoveObserver(Observer* observer); | 157 void RemoveObserver(Observer* observer); |
| 147 | 158 |
| 148 // Adds or removes ArcSessionObservers. | 159 // Adds or removes ArcSessionObservers. |
| 149 // TODO(hidehiko): The observer should be migrated into | 160 // TODO(hidehiko): The observer should be migrated into |
| 150 // ArcSessionManager::Observer. | 161 // ArcSessionManager::Observer. |
| 151 void AddSessionObserver(ArcSessionObserver* observer); | 162 void AddSessionObserver(ArcSessionObserver* observer); |
| 152 void RemoveSessionObserver(ArcSessionObserver* observer); | 163 void RemoveSessionObserver(ArcSessionObserver* observer); |
| 153 | 164 |
| 154 // Returns true if ARC instance is running/stopped, respectively. | 165 // Returns true if ARC instance is running/stopped, respectively. |
| 155 // See ArcSessionRunner::IsRunning()/IsStopped() for details. | 166 // See ArcSessionRunner::IsRunning()/IsStopped() for details. |
| 156 bool IsSessionRunning() const; | 167 bool IsSessionRunning() const; |
| 157 bool IsSessionStopped() const; | 168 bool IsSessionStopped() const; |
| 158 | 169 |
| 159 // Called from Arc support platform app when user cancels signing. | 170 // Called from Arc support platform app when user cancels signing. |
| 160 void CancelAuthCode(); | 171 void CancelAuthCode(); |
| 161 | 172 |
| 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. | |
| 165 bool IsArcManaged() const; | 173 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. | |
| 170 bool IsArcEnabled() const; | 174 bool IsArcEnabled() const; |
| 171 | 175 |
| 172 // This requires Arc to be allowed (|IsAllowed|)for current profile. | 176 // This requires Arc to be allowed (|IsAllowed|)for current profile. |
| 173 void EnableArc(); | 177 void EnableArc(); |
| 174 void DisableArc(); | 178 void DisableArc(); |
| 175 | 179 |
| 176 // Called from the Chrome OS metrics provider to record Arc.State | 180 // Called from the Chrome OS metrics provider to record Arc.State |
| 177 // periodically. | 181 // periodically. |
| 178 void RecordArcState(); | 182 void RecordArcState(); |
| 179 | 183 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager); | 284 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager); |
| 281 }; | 285 }; |
| 282 | 286 |
| 283 // Outputs the stringified |state| to |os|. This is only for logging purposes. | 287 // Outputs the stringified |state| to |os|. This is only for logging purposes. |
| 284 std::ostream& operator<<(std::ostream& os, | 288 std::ostream& operator<<(std::ostream& os, |
| 285 const ArcSessionManager::State& state); | 289 const ArcSessionManager::State& state); |
| 286 | 290 |
| 287 } // namespace arc | 291 } // namespace arc |
| 288 | 292 |
| 289 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ | 293 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ |
| OLD | NEW |