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

Side by Side Diff: chrome/browser/protector/protected_prefs_watcher.h

Issue 10065016: [protector] Refactoring of --no-protector code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 8 years, 8 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) 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_PROTECTOR_PROTECTED_PREFS_WATCHER_H_ 5 #ifndef CHROME_BROWSER_PROTECTOR_PROTECTED_PREFS_WATCHER_H_
6 #define CHROME_BROWSER_PROTECTOR_PROTECTED_PREFS_WATCHER_H_ 6 #define CHROME_BROWSER_PROTECTOR_PROTECTED_PREFS_WATCHER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 24 matching lines...) Expand all
35 static void RegisterUserPrefs(PrefService* prefs); 35 static void RegisterUserPrefs(PrefService* prefs);
36 36
37 // Returns true if pref named |path| has changed and the backup is valid. 37 // Returns true if pref named |path| has changed and the backup is valid.
38 bool DidPrefChange(const std::string& path) const; 38 bool DidPrefChange(const std::string& path) const;
39 39
40 // Returns the backup value for pref named |path| or |NULL| if the pref is not 40 // Returns the backup value for pref named |path| or |NULL| if the pref is not
41 // protected, does not exist or the backup is invalid. The returned Value 41 // protected, does not exist or the backup is invalid. The returned Value
42 // instance is owned by the PrefService. 42 // instance is owned by the PrefService.
43 const base::Value* GetBackupForPref(const std::string& path) const; 43 const base::Value* GetBackupForPref(const std::string& path) const;
44 44
45 // Updates the backup signature. 45 // Forces a valid backup, matching actual preferences (overwriting any
46 void UpdateBackupSignature(); 46 // previous data). Should only be when protector service is disabled.
47 void ForceUpdateBackup();
47 48
48 // True if the backup was valid at the profile load time. 49 // True if the backup was valid at the profile load time.
49 bool is_backup_valid() { return is_backup_valid_; } 50 bool is_backup_valid() { return is_backup_valid_; }
50 51
51 private: 52 private:
52 friend class ProtectedPrefsWatcherTest; 53 friend class ProtectedPrefsWatcherTest;
53 54
54 // content::NotificationObserver overrides: 55 // content::NotificationObserver overrides:
55 virtual void Observe(int type, 56 virtual void Observe(int type,
56 const content::NotificationSource& source, 57 const content::NotificationSource& source,
(...skipping 20 matching lines...) Expand all
77 // Updates the backup утекн for |pref_name| and кeturns |true| if the 78 // Updates the backup утекн for |pref_name| and кeturns |true| if the
78 // backup has changed. 79 // backup has changed.
79 bool UpdateBackupEntry(const std::string& pref_name); 80 bool UpdateBackupEntry(const std::string& pref_name);
80 81
81 // Perform a check that backup is valid and settings have not been modified. 82 // Perform a check that backup is valid and settings have not been modified.
82 void ValidateBackup(); 83 void ValidateBackup();
83 84
84 // Returns |true| if backup signature is valid. 85 // Returns |true| if backup signature is valid.
85 bool IsSignatureValid() const; 86 bool IsSignatureValid() const;
86 87
88 // Updates the backup signature.
89 void UpdateBackupSignature();
90
87 // Returns data to be signed as string. 91 // Returns data to be signed as string.
88 std::string GetSignatureData(PrefService* prefs) const; 92 std::string GetSignatureData(PrefService* prefs) const;
89 93
90 // Cached set of extension IDs. They are not changed as frequently 94 // Cached set of extension IDs. They are not changed as frequently
91 ExtensionPrefs::ExtensionIdSet cached_extension_ids_; 95 ExtensionPrefs::ExtensionIdSet cached_extension_ids_;
92 96
93 scoped_ptr<PrefSetObserver> pref_observer_; 97 scoped_ptr<PrefSetObserver> pref_observer_;
94 98
95 // True if the backup was valid at the profile load time. 99 // True if the backup was valid at the profile load time.
96 bool is_backup_valid_; 100 bool is_backup_valid_;
97 101
98 Profile* profile_; 102 Profile* profile_;
99 103
100 DISALLOW_COPY_AND_ASSIGN(ProtectedPrefsWatcher); 104 DISALLOW_COPY_AND_ASSIGN(ProtectedPrefsWatcher);
101 }; 105 };
102 106
103 } // namespace protector 107 } // namespace protector
104 108
105 #endif // CHROME_BROWSER_PROTECTOR_PROTECTED_PREFS_WATCHER_H_ 109 #endif // CHROME_BROWSER_PROTECTOR_PROTECTED_PREFS_WATCHER_H_
OLDNEW
« no previous file with comments | « chrome/browser/protector/prefs_backup_invalid_change.cc ('k') | chrome/browser/protector/protected_prefs_watcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698