Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_PROTECTOR_PROTECTED_PREFS_WATCHER_H_ | |
| 6 #define CHROME_BROWSER_PROTECTOR_PROTECTED_PREFS_WATCHER_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <set> | |
| 10 #include <string> | |
| 11 | |
| 12 #include "base/basictypes.h" | |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "content/public/browser/notification_observer.h" | |
| 15 | |
| 16 class PrefService; | |
| 17 class PrefSetObserver; | |
| 18 class Profile; | |
| 19 | |
| 20 namespace protector { | |
| 21 | |
| 22 class ProtectedPrefsWatcher : public content::NotificationObserver { | |
| 23 public: | |
| 24 explicit ProtectedPrefsWatcher(Profile* profile); | |
| 25 ~ProtectedPrefsWatcher(); | |
| 26 | |
| 27 // Registers prefs on a new Profile instance. | |
| 28 static void RegisterUserPrefs(PrefService* prefs); | |
| 29 | |
| 30 // Perform a check that backup is valid and settings have not been modified. | |
| 31 void CheckForPrefChanges(); | |
|
whywhat
2012/03/07 18:53:30
nit: Maybe ValidateProtectedPrefs or something lik
Ivan Korotkov
2012/03/11 12:59:44
I didn't document the behaviour for now because it
| |
| 32 | |
| 33 private: | |
| 34 // content::NotificationObserver overrides: | |
| 35 virtual void Observe(int type, | |
| 36 const content::NotificationSource& source, | |
| 37 const content::NotificationDetails& details) OVERRIDE; | |
| 38 | |
| 39 // Updates cached prefs from their actual values and returns |true| if there | |
| 40 // were any changes. | |
| 41 bool UpdateCachedPrefs(); | |
| 42 | |
| 43 // Update the backup signature. | |
| 44 void UpdateBackupSignature(); | |
| 45 | |
| 46 // Checks if backup signature is valid. | |
| 47 bool IsSignatureValid(); | |
|
whywhat
2012/03/07 18:53:30
const?
Ivan Korotkov
2012/03/11 12:59:44
Done.
| |
| 48 | |
| 49 // Returns |false| if |profile_| does not have a backup yet (needs to be | |
| 50 // initialized). | |
| 51 bool HasBackup(); | |
|
whywhat
2012/03/07 18:53:30
const?
Ivan Korotkov
2012/03/11 12:59:44
Done.
| |
| 52 | |
| 53 // Returns data to be signed as string. | |
| 54 std::string GetSignatureData(PrefService* prefs); | |
|
whywhat
2012/03/07 18:53:30
ditto
Ivan Korotkov
2012/03/11 12:59:44
Done.
| |
| 55 | |
| 56 // Cached set of extension IDs. They are not changed as frequently | |
| 57 std::set<std::string> cached_extension_ids_; | |
| 58 | |
| 59 scoped_ptr<PrefSetObserver> pref_observer_; | |
| 60 | |
| 61 bool did_startup_settings_change_; | |
|
whywhat
2012/03/07 18:53:30
Comment about this member?
Ivan Korotkov
2012/03/11 12:59:44
Stale member, forgot to remove.
| |
| 62 | |
| 63 Profile* profile_; | |
| 64 | |
| 65 DISALLOW_COPY_AND_ASSIGN(ProtectedPrefsWatcher); | |
| 66 }; | |
| 67 | |
| 68 } // namespace protector | |
| 69 | |
| 70 #endif // CHROME_BROWSER_PROTECTOR_PROTECTED_PREFS_WATCHER_H_ | |
| OLD | NEW |