Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: chrome/browser/chromeos/user_cros_settings_provider.h

Issue 7867044: PART1: Initiated the SignedSettings refactoring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments from Chris and rebased to ToT to get it running on the try servers again. Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_USER_CROS_SETTINGS_PROVIDER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_USER_CROS_SETTINGS_PROVIDER_H_
6 #define CHROME_BROWSER_CHROMEOS_USER_CROS_SETTINGS_PROVIDER_H_ 6 #define CHROME_BROWSER_CHROMEOS_USER_CROS_SETTINGS_PROVIDER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 15 matching lines...) Expand all
26 // TODO(nkostylev): Rename this class to indicate that it is 26 // TODO(nkostylev): Rename this class to indicate that it is
27 // SignedSettings specific. 27 // SignedSettings specific.
28 class UserCrosSettingsProvider : public CrosSettingsProvider { 28 class UserCrosSettingsProvider : public CrosSettingsProvider {
29 public: 29 public:
30 UserCrosSettingsProvider(); 30 UserCrosSettingsProvider();
31 virtual ~UserCrosSettingsProvider() {} 31 virtual ~UserCrosSettingsProvider() {}
32 32
33 // Registers cached users settings in preferences. 33 // Registers cached users settings in preferences.
34 static void RegisterPrefs(PrefService* local_state); 34 static void RegisterPrefs(PrefService* local_state);
35 35
36 // Methods to use when trusted (signature verified) values are required.
37 // Return true if subsequent call to corresponding cached_* getter shall
38 // return trusted value.
39 // Return false if trusted values are unavailable at a moment.
40 // In latter case passed task will be posted when ready.
41 bool RequestTrustedAllowGuest(const base::Closure& callback);
42 bool RequestTrustedAllowNewUser(const base::Closure& callback);
43 bool RequestTrustedDataRoamingEnabled(const base::Closure& callback);
44 bool RequestTrustedShowUsersOnSignin(const base::Closure& callback);
45 bool RequestTrustedOwner(const base::Closure& callback);
46 bool RequestTrustedReportingEnabled(const base::Closure& callback);
47
48 // Reloads values from device settings. 36 // Reloads values from device settings.
49 void Reload(); 37 void Reload();
50 38
51 // Helper functions to access cached settings.
52 static bool cached_allow_guest();
53 static bool cached_allow_new_user();
54 static bool cached_data_roaming_enabled();
55 static bool cached_show_users_on_signin();
56 static bool cached_reporting_enabled();
57 static const base::ListValue* cached_whitelist();
58 static std::string cached_owner();
59
60 // Returns true if given email is in user whitelist.
61 // Note this function is for display purpose only and should use
62 // CheckWhitelist op for the real whitelist check.
63 static bool IsEmailInCachedWhitelist(const std::string& email);
64
65 // CrosSettingsProvider implementation. 39 // CrosSettingsProvider implementation.
66 virtual bool Get(const std::string& path, 40 virtual const base::Value* Get(const std::string& path) const OVERRIDE;
67 base::Value** out_value) const OVERRIDE; 41 virtual bool GetTrusted(const std::string& path,
42 const base::Closure& callback) const OVERRIDE;
68 virtual bool HandlesSetting(const std::string& path) const OVERRIDE; 43 virtual bool HandlesSetting(const std::string& path) const OVERRIDE;
69 44
70 void WhitelistUser(const std::string& email); 45 static void WhitelistUser(const std::string& email);
71 void UnwhitelistUser(const std::string& email); 46 static void UnwhitelistUser(const std::string& email);
72 47
73 // Updates cached value of the owner. 48 // Updates cached value of the owner.
74 static void UpdateCachedOwner(const std::string& email); 49 static void UpdateCachedOwner(const std::string& email);
75 50
76 private: 51 private:
77 // CrosSettingsProvider implementation. 52 // CrosSettingsProvider implementation.
78 virtual void DoSet(const std::string& path, base::Value* value) OVERRIDE; 53 virtual void DoSet(const std::string& path, base::Value* value) OVERRIDE;
79 54
80 DISALLOW_COPY_AND_ASSIGN(UserCrosSettingsProvider); 55 DISALLOW_COPY_AND_ASSIGN(UserCrosSettingsProvider);
81 }; 56 };
82 57
83 } // namespace chromeos 58 } // namespace chromeos
84 59
85 #endif // CHROME_BROWSER_CHROMEOS_USER_CROS_SETTINGS_PROVIDER_H_ 60 #endif // CHROME_BROWSER_CHROMEOS_USER_CROS_SETTINGS_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698