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 CHROME_BROWSER_CHROMEOS_ARC_ARC_UTIL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_ARC_UTIL_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_UTIL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_UTIL_H_ |
| 7 | 7 |
| 8 // Most utility should be put in components/arc/arc_util.{h,cc}, rather than | 8 // Most utility should be put in components/arc/arc_util.{h,cc}, rather than |
| 9 // here. However, some utility implementation requires other modules defined in | 9 // here. However, some utility implementation requires other modules defined in |
| 10 // chrome/, so this file contains such utilities. | 10 // chrome/, so this file contains such utilities. |
| 11 // Note that it is not allowed to have dependency from components/ to chrome/ | 11 // Note that it is not allowed to have dependency from components/ to chrome/ |
| 12 // by DEPS. | 12 // by DEPS. |
| 13 | 13 |
| 14 class Profile; | 14 class Profile; |
| 15 | 15 |
| 16 namespace arc { | 16 namespace arc { |
| 17 | 17 |
| 18 enum ArcAllowedForTestType { | |
| 19 ALLOWEDFORSYNCTEST, | |
|
hidehiko
2017/03/02 17:45:39
style: In chrome, we concat capital letter words w
| |
| 20 DISALLOWEDFORTEST, | |
| 21 NOTSET, | |
| 22 }; | |
| 23 | |
| 18 // Returns true if ARC is allowed to run for the given profile. | 24 // Returns true if ARC is allowed to run for the given profile. |
| 19 // Otherwise, returns false, e.g. if the Profile is not for the primary user, | 25 // Otherwise, returns false, e.g. if the Profile is not for the primary user, |
| 20 // ARC is not available on the device, it is in the flow to set up managed | 26 // ARC is not available on the device, it is in the flow to set up managed |
| 21 // account creation. | 27 // account creation. |
| 22 // nullptr can be safely passed to this function. In that case, returns false. | 28 // nullptr can be safely passed to this function. In that case, returns false. |
| 23 bool IsArcAllowedForProfile(const Profile* profile); | 29 bool IsArcAllowedForProfile(const Profile* profile); |
| 24 | 30 |
| 25 // Disallows ARC for all profiles for testing. | 31 // 1.Type ALLOWEDFORSYNCTEST: Sets ARC as allowed for sync test. |
| 32 // In sync test, mutilpe ArcAppListPrefs are created and can confuse | |
|
hidehiko
2017/03/02 17:45:39
nit: s/mutilpe/multiple/
| |
| 33 // ArcSessionManager. Let IsArcAllowedForProfile() simply return true to | |
|
hidehiko
2017/03/02 17:45:39
This is not really true, IIUC. If IsArcAllowedForP
| |
| 34 // stop confusing ArcSessionManager. | |
| 35 // 2.Type DISALLOWEDFORTEST: Disallows ARC for all profiles for testing. | |
| 26 // In most cases, disabling ARC should be done via commandline. However, | 36 // In most cases, disabling ARC should be done via commandline. However, |
| 27 // there are some cases to be tested where ARC is available, but ARC is not | 37 // there are some cases to be tested where ARC is available, but ARC is not |
| 28 // supported for some reasons (e.g. incognito mode, supervised user, | 38 // supported for some reasons (e.g. incognito mode, supervised user, |
| 29 // secondary profile). On the other hand, some test infra does not support | 39 // secondary profile). On the other hand, some test infra does not support |
| 30 // such situations (e.g. API test). This is for workaround to emulate the | 40 // such situations (e.g. API test). This is for workaround to emulate the |
| 31 // case. | 41 // case. |
| 32 void DisallowArcForTesting(); | 42 // 3.Type NOTSET: Goes through regular checks. |
| 43 void SetArcAllowedForTesting(ArcAllowedForTestType type); | |
|
hidehiko
2017/03/02 17:45:39
Could you use the signature:
void SetArcAllowedFo
lgcheng
2017/03/02 23:45:10
Generally abandon modification for this file. Keep
| |
| 33 | 44 |
| 34 // Returns whether the user has opted in (or is opting in now) to use Google | 45 // Returns whether the user has opted in (or is opting in now) to use Google |
| 35 // Play Store on ARC. | 46 // Play Store on ARC. |
| 36 // This is almost equivalent to the value of "arc.enabled" preference. However, | 47 // This is almost equivalent to the value of "arc.enabled" preference. However, |
| 37 // in addition, if ARC is not allowed for the given |profile|, then returns | 48 // in addition, if ARC is not allowed for the given |profile|, then returns |
| 38 // false. Please see detailed condition for the comment of | 49 // false. Please see detailed condition for the comment of |
| 39 // IsArcAllowedForProfile(). | 50 // IsArcAllowedForProfile(). |
| 40 // Note: For historical reason, the preference name is not matched with the | 51 // Note: For historical reason, the preference name is not matched with the |
| 41 // actual meaning. | 52 // actual meaning. |
| 42 bool IsArcPlayStoreEnabledForProfile(const Profile* profile); | 53 bool IsArcPlayStoreEnabledForProfile(const Profile* profile); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 53 // It is requirement for a caller to ensure ARC is allowed for the user of | 64 // It is requirement for a caller to ensure ARC is allowed for the user of |
| 54 // the given |profile|. | 65 // the given |profile|. |
| 55 // TODO(hidehiko): De-couple the concept to enable ARC system and opt-in | 66 // TODO(hidehiko): De-couple the concept to enable ARC system and opt-in |
| 56 // to use Google Play Store. Note that there is a plan to use ARC without | 67 // to use Google Play Store. Note that there is a plan to use ARC without |
| 57 // Google Play Store, then ARC can run without opt-in. | 68 // Google Play Store, then ARC can run without opt-in. |
| 58 void SetArcPlayStoreEnabledForProfile(Profile* profile, bool enabled); | 69 void SetArcPlayStoreEnabledForProfile(Profile* profile, bool enabled); |
| 59 | 70 |
| 60 } // namespace arc | 71 } // namespace arc |
| 61 | 72 |
| 62 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_UTIL_H_ | 73 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_UTIL_H_ |
| OLD | NEW |