OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_SETTINGS_CROS_SETTINGS_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_CROS_SETTINGS_H_ |
6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_CROS_SETTINGS_H_ | 6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_CROS_SETTINGS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
12 #include "base/callback_list.h" | 12 #include "base/callback_list.h" |
13 #include "base/containers/hash_tables.h" | 13 #include "base/containers/hash_tables.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/threading/non_thread_safe.h" | 15 #include "base/threading/non_thread_safe.h" |
16 #include "chromeos/settings/cros_settings_names.h" | 16 #include "chromeos/settings/cros_settings_names.h" |
17 #include "chromeos/settings/cros_settings_provider.h" | 17 #include "chromeos/settings/cros_settings_provider.h" |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 class DictionaryValue; | 20 class DictionaryValue; |
21 class ListValue; | 21 class ListValue; |
22 class Value; | 22 class Value; |
23 } | 23 } |
24 | 24 |
| 25 namespace user_manager { |
| 26 class UserID; |
| 27 } |
| 28 |
25 namespace chromeos { | 29 namespace chromeos { |
26 | 30 |
27 class DeviceSettingsService; | 31 class DeviceSettingsService; |
28 | 32 |
29 // This class manages per-device/global settings. | 33 // This class manages per-device/global settings. |
30 class CrosSettings : public base::NonThreadSafe { | 34 class CrosSettings : public base::NonThreadSafe { |
31 public: | 35 public: |
32 // Manage singleton instance. | 36 // Manage singleton instance. |
33 static void Initialize(); | 37 static void Initialize(); |
34 static bool IsInitialized(); | 38 static bool IsInitialized(); |
35 static void Shutdown(); | 39 static void Shutdown(); |
36 static CrosSettings* Get(); | 40 static CrosSettings* Get(); |
37 | 41 |
38 // Checks if the given username is whitelisted and allowed to sign-in to | 42 // Checks if the given username is whitelisted and allowed to sign-in to |
39 // this device. |wildcard_match| may be NULL. If it's present, it'll be set to | 43 // this device. |wildcard_match| may be NULL. If it's present, it'll be set to |
40 // true if the whitelist check was satisfied via a wildcard. | 44 // true if the whitelist check was satisfied via a wildcard. |
41 static bool IsWhitelisted(const std::string& username, bool* wildcard_match); | 45 static bool IsWhitelisted(const user_manager::UserID& user_id, bool* wildcard_
match); |
42 | 46 |
43 // Creates a device settings service instance. This is meant for unit tests, | 47 // Creates a device settings service instance. This is meant for unit tests, |
44 // production code uses the singleton returned by Get() above. | 48 // production code uses the singleton returned by Get() above. |
45 explicit CrosSettings(DeviceSettingsService* device_settings_service); | 49 explicit CrosSettings(DeviceSettingsService* device_settings_service); |
46 virtual ~CrosSettings(); | 50 virtual ~CrosSettings(); |
47 | 51 |
48 // Helper function to test if the given |path| is a valid cros setting. | 52 // Helper function to test if the given |path| is a valid cros setting. |
49 static bool IsCrosSettings(const std::string& path); | 53 static bool IsCrosSettings(const std::string& path); |
50 | 54 |
51 // Sets |in_value| to given |path| in cros settings. | 55 // Sets |in_value| to given |path| in cros settings. |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 ScopedTestCrosSettings(); | 147 ScopedTestCrosSettings(); |
144 ~ScopedTestCrosSettings(); | 148 ~ScopedTestCrosSettings(); |
145 | 149 |
146 private: | 150 private: |
147 DISALLOW_COPY_AND_ASSIGN(ScopedTestCrosSettings); | 151 DISALLOW_COPY_AND_ASSIGN(ScopedTestCrosSettings); |
148 }; | 152 }; |
149 | 153 |
150 } // namespace chromeos | 154 } // namespace chromeos |
151 | 155 |
152 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_CROS_SETTINGS_H_ | 156 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_CROS_SETTINGS_H_ |
OLD | NEW |