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 #include <stdint.h> |
| 9 |
| 10 #include "base/callback_forward.h" |
| 11 |
8 // Most utility should be put in components/arc/arc_util.{h,cc}, rather than | 12 // 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 | 13 // here. However, some utility implementation requires other modules defined in |
10 // chrome/, so this file contains such utilities. | 14 // chrome/, so this file contains such utilities. |
11 // Note that it is not allowed to have dependency from components/ to chrome/ | 15 // Note that it is not allowed to have dependency from components/ to chrome/ |
12 // by DEPS. | 16 // by DEPS. |
13 | 17 |
| 18 class AccountId; |
14 class Profile; | 19 class Profile; |
15 | 20 |
| 21 namespace base { |
| 22 class FilePath; |
| 23 } |
| 24 |
16 namespace arc { | 25 namespace arc { |
17 | 26 |
| 27 // Values to be stored in the local state preference to keep track of the |
| 28 // filesystem encryption migration status. |
| 29 enum FileSystemCompatibilityState : int32_t { |
| 30 // No migiration has happend, user keeps using the old file system. |
| 31 kFileSystemIncompatible = 0, |
| 32 // Migration has happend. New filesystem is in use. |
| 33 kFileSystemCompatible = 1, |
| 34 // Migration has happend, and a notification about the fact was already shown. |
| 35 kFileSystemCompatibleAndNotified = 2, |
| 36 |
| 37 // Existing code assumes that kFileSystemIncompatible is the only state |
| 38 // representing incompatibility and other values are all variants of |
| 39 // "compatible" state. Be careful in the case adding a new enum value. |
| 40 }; |
| 41 |
18 // Returns true if ARC is allowed to run for the given profile. | 42 // 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, | 43 // 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 | 44 // ARC is not available on the device, it is in the flow to set up managed |
21 // account creation. | 45 // account creation. |
22 // nullptr can be safely passed to this function. In that case, returns false. | 46 // nullptr can be safely passed to this function. In that case, returns false. |
23 bool IsArcAllowedForProfile(const Profile* profile); | 47 bool IsArcAllowedForProfile(const Profile* profile); |
24 | 48 |
25 // Disallows ARC for all profiles for testing. | 49 // Disallows ARC for all profiles for testing. |
26 // In most cases, disabling ARC should be done via commandline. However, | 50 // 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 | 51 // there are some cases to be tested where ARC is available, but ARC is not |
(...skipping 22 matching lines...) Expand all Loading... |
50 // ARC enabled state, too, so this also should trigger to enable or disable | 74 // ARC enabled state, too, so this also should trigger to enable or disable |
51 // whole ARC system. | 75 // whole ARC system. |
52 // If the preference is managed, then no-op. | 76 // If the preference is managed, then no-op. |
53 // It is requirement for a caller to ensure ARC is allowed for the user of | 77 // It is requirement for a caller to ensure ARC is allowed for the user of |
54 // the given |profile|. | 78 // the given |profile|. |
55 // TODO(hidehiko): De-couple the concept to enable ARC system and opt-in | 79 // 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 | 80 // 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. | 81 // Google Play Store, then ARC can run without opt-in. |
58 void SetArcPlayStoreEnabledForProfile(Profile* profile, bool enabled); | 82 void SetArcPlayStoreEnabledForProfile(Profile* profile, bool enabled); |
59 | 83 |
| 84 // Checks and updates the preference value whether the underlying filesystem |
| 85 // for the profile is compatible with ARC, when necessary. After it's done (or |
| 86 // skipped), |callback| is run either synchronously or asynchronously. |
| 87 void UpdateArcFileSystemCompatibilityPrefIfNeeded( |
| 88 const AccountId& account_id, |
| 89 const base::FilePath& profile_path, |
| 90 const base::Closure& callback); |
| 91 |
60 } // namespace arc | 92 } // namespace arc |
61 | 93 |
62 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_UTIL_H_ | 94 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_UTIL_H_ |
OLD | NEW |