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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
69 // SetUpCommandLine(), and its argument should be passed to this function. | 69 // SetUpCommandLine(), and its argument should be passed to this function. |
70 // Also, in unittests, this can be called in SetUp() with | 70 // Also, in unittests, this can be called in SetUp() with |
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(); |
Luis Héctor Chávez
2017/08/29 16:24:09
This _should_ now be unused. Can you remove it?
T
Sergey Poromov
2017/08/29 16:37:30
IsArcKioskMode() is used in https://cs.chromium.or
| |
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/29 16:24:09
IIUC this is unused. Can you remove it?
Sergey Poromov
2017/08/29 16:37:30
Done.
| |
85 | |
86 // Returns true if current user is a robot account user. | |
87 // These are Public Session and ARC Kiosk users. | |
88 // The check is basically IsArcKioskMode() | IsPublicSessionMode(). | |
89 bool IsRobotAccountMode(); | |
90 | |
81 // Returns true if ARC is allowed for the given user. Note this should not be | 91 // 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 | 92 // 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 | 93 // 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 | 94 // as a secondary user or signs in to create a supervised user, ARC should be |
85 // disabled for such cases. | 95 // disabled for such cases. |
86 bool IsArcAllowedForUser(const user_manager::User* user); | 96 bool IsArcAllowedForUser(const user_manager::User* user); |
87 | 97 |
88 // Checks if opt-in verification was disabled by switch in command line. | 98 // Checks if opt-in verification was disabled by switch in command line. |
89 // In most cases, it is disabled for testing purpose. | 99 // In most cases, it is disabled for testing purpose. |
90 bool IsArcOptInVerificationDisabled(); | 100 bool IsArcOptInVerificationDisabled(); |
91 | 101 |
92 // Returns true if the |window|'s aura::client::kAppType is ARC_APP. When | 102 // Returns true if the |window|'s aura::client::kAppType is ARC_APP. When |
93 // |window| is nullptr, returns false. | 103 // |window| is nullptr, returns false. |
94 bool IsArcAppWindow(aura::Window* window); | 104 bool IsArcAppWindow(aura::Window* window); |
95 | 105 |
96 // Adjusts the amount of CPU the ARC instance is allowed to use. When | 106 // 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 | 107 // |do_restrict| is true, the limit is adjusted so ARC can only use tightly |
98 // restricted CPU resources. | 108 // restricted CPU resources. |
99 // TODO(yusukes): Use enum instead of bool. | 109 // TODO(yusukes): Use enum instead of bool. |
100 void SetArcCpuRestriction(bool do_restrict); | 110 void SetArcCpuRestriction(bool do_restrict); |
101 | 111 |
102 } // namespace arc | 112 } // namespace arc |
103 | 113 |
104 #endif // COMPONENTS_ARC_ARC_UTIL_H_ | 114 #endif // COMPONENTS_ARC_ARC_UTIL_H_ |
OLD | NEW |