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 |
16 namespace base { | 21 namespace base { |
17 class FilePath; | 22 class FilePath; |
18 } | 23 } |
19 | 24 |
20 namespace arc { | 25 namespace arc { |
21 | 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, | |
Junichi Uekawa
2017/05/11 22:15:34
what about the case that the ext4 crypto is alread
| |
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 // TODO(kinaba): This value isn't yet used until crbug.com/711095 is done. | |
36 kFileSystemCompatibleAndNotified = 2, | |
37 | |
38 // Existing code assumes that kFileSystemIncompatible is the only state | |
39 // representing incompatibility and other values are all variants of | |
40 // "compatible" state. Be careful in the case adding a new enum value. | |
41 }; | |
42 | |
22 // Returns true if ARC is allowed to run for the given profile. | 43 // Returns true if ARC is allowed to run for the given profile. |
23 // Otherwise, returns false, e.g. if the Profile is not for the primary user, | 44 // Otherwise, returns false, e.g. if the Profile is not for the primary user, |
24 // ARC is not available on the device, it is in the flow to set up managed | 45 // ARC is not available on the device, it is in the flow to set up managed |
25 // account creation. | 46 // account creation. |
26 // nullptr can be safely passed to this function. In that case, returns false. | 47 // nullptr can be safely passed to this function. In that case, returns false. |
27 bool IsArcAllowedForProfile(const Profile* profile); | 48 bool IsArcAllowedForProfile(const Profile* profile); |
28 | 49 |
29 // Returns true if ARC app is allowed to show up on app list for the given | 50 // Returns true if ARC app is allowed to show up on app list for the given |
30 // profile. This can be a looser condition than IsArcAllowedForProfile. | 51 // profile. This can be a looser condition than IsArcAllowedForProfile. |
31 // ARC may be temporaliry disallowed for the profile, but it may become again | 52 // ARC may be temporaliry disallowed for the profile, but it may become again |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
71 // the given |profile|. | 92 // the given |profile|. |
72 // TODO(hidehiko): De-couple the concept to enable ARC system and opt-in | 93 // TODO(hidehiko): De-couple the concept to enable ARC system and opt-in |
73 // to use Google Play Store. Note that there is a plan to use ARC without | 94 // to use Google Play Store. Note that there is a plan to use ARC without |
74 // Google Play Store, then ARC can run without opt-in. | 95 // Google Play Store, then ARC can run without opt-in. |
75 void SetArcPlayStoreEnabledForProfile(Profile* profile, bool enabled); | 96 void SetArcPlayStoreEnabledForProfile(Profile* profile, bool enabled); |
76 | 97 |
77 // Returns whether all ARC related OptIn preferences (i.e. | 98 // Returns whether all ARC related OptIn preferences (i.e. |
78 // ArcBackupRestoreEnabled and ArcLocationServiceEnabled) are managed. | 99 // ArcBackupRestoreEnabled and ArcLocationServiceEnabled) are managed. |
79 bool AreArcAllOptInPreferencesManagedForProfile(const Profile* profile); | 100 bool AreArcAllOptInPreferencesManagedForProfile(const Profile* profile); |
80 | 101 |
81 // Returns whether ARC can run on the filesystem mounted at |path|. | 102 // Checks and updates the preference value whether the underlying filesystem |
82 // This function should run only on threads where IO operations are allowed. | 103 // for the profile is compatible with ARC, when necessary. After it's done (or |
83 bool IsArcCompatibleFilesystem(const base::FilePath& path); | 104 // skipped), |callback| is run either synchronously or asynchronously. |
105 void UpdateArcFileSystemCompatibilityPrefIfNeeded( | |
106 const AccountId& account_id, | |
107 const base::FilePath& profile_path, | |
108 const base::Closure& callback); | |
84 | 109 |
85 } // namespace arc | 110 } // namespace arc |
86 | 111 |
87 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_UTIL_H_ | 112 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_UTIL_H_ |
OLD | NEW |