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 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 // Returns true if ARC should run under Kiosk mode. | |
| 139 static bool IsArcKioskMode(); | |
| 140 | |
| 141 // 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. |
| 142 bool IsAllowed() const; | 132 bool IsAllowed() const; |
|
Yusuke Sato
2017/01/19 22:39:31
I feel the function name is too similar to IsAllow
hidehiko
2017/01/24 17:46:11
Sure. Added TODO.
| |
| 143 | 133 |
| 144 void OnPrimaryUserProfilePrepared(Profile* profile); | 134 void OnPrimaryUserProfilePrepared(Profile* profile); |
| 145 void Shutdown(); | 135 void Shutdown(); |
| 146 | 136 |
| 147 Profile* profile() { return profile_; } | 137 Profile* profile() { return profile_; } |
| 148 const Profile* profile() const { return profile_; } | 138 const Profile* profile() const { return profile_; } |
| 149 | 139 |
| 150 State state() const { return state_; } | 140 State state() const { return state_; } |
| 151 | 141 |
| 152 // Adds or removes observers. | 142 // Adds or removes observers. |
| 153 void AddObserver(Observer* observer); | 143 void AddObserver(Observer* observer); |
| 154 void RemoveObserver(Observer* observer); | 144 void RemoveObserver(Observer* observer); |
| 155 | 145 |
| 156 // Adds or removes ArcSessionObservers. | 146 // Adds or removes ArcSessionObservers. |
| 157 // TODO(hidehiko): The observer should be migrated into | 147 // TODO(hidehiko): The observer should be migrated into |
| 158 // ArcSessionManager::Observer. | 148 // ArcSessionManager::Observer. |
| 159 void AddSessionObserver(ArcSessionObserver* observer); | 149 void AddSessionObserver(ArcSessionObserver* observer); |
| 160 void RemoveSessionObserver(ArcSessionObserver* observer); | 150 void RemoveSessionObserver(ArcSessionObserver* observer); |
| 161 | 151 |
| 162 // Returns true if ARC instance is running/stopped, respectively. | 152 // Returns true if ARC instance is running/stopped, respectively. |
| 163 // See ArcSessionRunner::IsRunning()/IsStopped() for details. | 153 // See ArcSessionRunner::IsRunning()/IsStopped() for details. |
| 164 bool IsSessionRunning() const; | 154 bool IsSessionRunning() const; |
| 165 bool IsSessionStopped() const; | 155 bool IsSessionStopped() const; |
| 166 | 156 |
| 167 // Called from Arc support platform app when user cancels signing. | 157 // Called from Arc support platform app when user cancels signing. |
| 168 void CancelAuthCode(); | 158 void CancelAuthCode(); |
| 169 | 159 |
| 170 bool IsArcManaged() const; | 160 bool IsArcManaged() const; |
|
Yusuke Sato
2017/01/19 22:39:31
* Please document the function. When typically sho
hidehiko
2017/01/24 17:46:11
This is for existing code. So let me add TODO.
| |
| 171 bool IsArcEnabled() const; | 161 bool IsArcEnabled() const; |
|
Yusuke Sato
2017/01/19 22:39:31
So we still have the function with exactly the sam
hidehiko
2017/01/24 17:46:11
Similarly, added TODO.
Yusuke Sato
2017/01/24 20:36:58
Thanks, and please fix these TODOs as part of b/34
| |
| 172 | 162 |
| 173 // This requires Arc to be allowed (|IsAllowed|)for current profile. | 163 // This requires Arc to be allowed (|IsAllowed|)for current profile. |
| 174 void EnableArc(); | 164 void EnableArc(); |
| 175 void DisableArc(); | 165 void DisableArc(); |
| 176 | 166 |
| 177 // Called from the Chrome OS metrics provider to record Arc.State | 167 // Called from the Chrome OS metrics provider to record Arc.State |
| 178 // periodically. | 168 // periodically. |
| 179 void RecordArcState(); | 169 void RecordArcState(); |
| 180 | 170 |
| 181 // sync_preferences::PrefServiceSyncableObserver | 171 // sync_preferences::PrefServiceSyncableObserver |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 281 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager); | 271 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager); |
| 282 }; | 272 }; |
| 283 | 273 |
| 284 // Outputs the stringified |state| to |os|. This is only for logging purposes. | 274 // Outputs the stringified |state| to |os|. This is only for logging purposes. |
| 285 std::ostream& operator<<(std::ostream& os, | 275 std::ostream& operator<<(std::ostream& os, |
| 286 const ArcSessionManager::State& state); | 276 const ArcSessionManager::State& state); |
| 287 | 277 |
| 288 } // namespace arc | 278 } // namespace arc |
| 289 | 279 |
| 290 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ | 280 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ |
| OLD | NEW |