Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 COMPONENTS_ARC_ARC_UTIL_H_ | 5 #ifndef COMPONENTS_ARC_ARC_UTIL_H_ |
| 6 #define COMPONENTS_ARC_ARC_UTIL_H_ | 6 #define COMPONENTS_ARC_ARC_UTIL_H_ |
| 7 | 7 |
| 8 // This file contains utility to see ARC functionality status controlled by | 8 // This file contains utility to see ARC functionality status controlled by |
| 9 // outside of ARC, e.g. CommandLine flag, attribute of global data/state, | 9 // outside of ARC, e.g. CommandLine flag, attribute of global data/state, |
| 10 // users' preferences, and FeatureList. | 10 // users' preferences, and FeatureList. |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 // base::CommandLine::ForCurrentProcess(). | 71 // base::CommandLine::ForCurrentProcess(). |
| 72 // |command_line| must not be nullptr. | 72 // |command_line| must not be nullptr. |
| 73 void SetArcAvailableCommandLineForTesting(base::CommandLine* command_line); | 73 void SetArcAvailableCommandLineForTesting(base::CommandLine* command_line); |
| 74 | 74 |
| 75 // Returns true if ARC should run under Kiosk mode for the current profile. | 75 // Returns true if ARC should run under Kiosk mode for the current profile. |
| 76 // As it can return true only when user is already initialized, it implies | 76 // As it can return true only when user is already initialized, it implies |
| 77 // that ARC availability was checked before and IsArcKioskAvailable() | 77 // that ARC availability was checked before and IsArcKioskAvailable() |
| 78 // should also return true in that case. | 78 // should also return true in that case. |
| 79 bool IsArcKioskMode(); | 79 bool IsArcKioskMode(); |
| 80 | 80 |
| 81 // Returns true if current user is a public session. | |
| 82 // In that case ARC should also be started if available, using the same | |
| 83 // authentication flow as ARC Kiosk mode. | |
| 84 bool IsPublicSessionMode(); | |
|
Luis Héctor Chávez
2017/08/28 18:33:28
So far all the code is doing are variations of (Is
Sergey Poromov
2017/08/28 18:47:24
Done.
| |
| 85 | |
| 81 // Returns true if ARC is allowed for the given user. Note this should not be | 86 // Returns true if ARC is allowed for the given user. Note this should not be |
| 82 // used as a signal of whether ARC is allowed alone because it only considers | 87 // used as a signal of whether ARC is allowed alone because it only considers |
| 83 // user meta data. e.g. a user could be allowed for ARC but if the user signs in | 88 // user meta data. e.g. a user could be allowed for ARC but if the user signs in |
| 84 // as a secondary user or signs in to create a supervised user, ARC should be | 89 // as a secondary user or signs in to create a supervised user, ARC should be |
| 85 // disabled for such cases. | 90 // disabled for such cases. |
| 86 bool IsArcAllowedForUser(const user_manager::User* user); | 91 bool IsArcAllowedForUser(const user_manager::User* user); |
| 87 | 92 |
| 88 // Checks if opt-in verification was disabled by switch in command line. | 93 // Checks if opt-in verification was disabled by switch in command line. |
| 89 // In most cases, it is disabled for testing purpose. | 94 // In most cases, it is disabled for testing purpose. |
| 90 bool IsArcOptInVerificationDisabled(); | 95 bool IsArcOptInVerificationDisabled(); |
| 91 | 96 |
| 92 // Returns true if the |window|'s aura::client::kAppType is ARC_APP. When | 97 // Returns true if the |window|'s aura::client::kAppType is ARC_APP. When |
| 93 // |window| is nullptr, returns false. | 98 // |window| is nullptr, returns false. |
| 94 bool IsArcAppWindow(aura::Window* window); | 99 bool IsArcAppWindow(aura::Window* window); |
| 95 | 100 |
| 96 // Adjusts the amount of CPU the ARC instance is allowed to use. When | 101 // Adjusts the amount of CPU the ARC instance is allowed to use. When |
| 97 // |do_restrict| is true, the limit is adjusted so ARC can only use tightly | 102 // |do_restrict| is true, the limit is adjusted so ARC can only use tightly |
| 98 // restricted CPU resources. | 103 // restricted CPU resources. |
| 99 // TODO(yusukes): Use enum instead of bool. | 104 // TODO(yusukes): Use enum instead of bool. |
| 100 void SetArcCpuRestriction(bool do_restrict); | 105 void SetArcCpuRestriction(bool do_restrict); |
| 101 | 106 |
| 102 } // namespace arc | 107 } // namespace arc |
| 103 | 108 |
| 104 #endif // COMPONENTS_ARC_ARC_UTIL_H_ | 109 #endif // COMPONENTS_ARC_ARC_UTIL_H_ |
| OLD | NEW |