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

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

Issue 9748016: [protector] Added UI for invalid Preferences backup case. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix unit-test. Created 8 years, 9 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
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 21 matching lines...) Expand all
32 static void RegisterUserPrefs(PrefService* prefs); 32 static void RegisterUserPrefs(PrefService* prefs);
33 33
34 // Returns true if pref named |path| has changed and the backup is valid. 34 // Returns true if pref named |path| has changed and the backup is valid.
35 bool DidPrefChange(const std::string& path) const; 35 bool DidPrefChange(const std::string& path) const;
36 36
37 // Returns the backup value for pref named |path| or |NULL| if the pref is not 37 // Returns the backup value for pref named |path| or |NULL| if the pref is not
38 // protected, does not exist or the backup is invalid. The returned Value 38 // protected, does not exist or the backup is invalid. The returned Value
39 // instance is owned by the PrefService. 39 // instance is owned by the PrefService.
40 const base::Value* GetBackupForPref(const std::string& path) const; 40 const base::Value* GetBackupForPref(const std::string& path) const;
41 41
42 // Updates the backup signature.
43 void UpdateBackupSignature();
44
42 // True if the backup was valid at the profile load time. 45 // True if the backup was valid at the profile load time.
43 bool is_backup_valid() { return is_backup_valid_; } 46 bool is_backup_valid() { return is_backup_valid_; }
44 47
45 private: 48 private:
46 friend class ProtectedPrefsWatcherTest; 49 friend class ProtectedPrefsWatcherTest;
47 50
48 // content::NotificationObserver overrides: 51 // content::NotificationObserver overrides:
49 virtual void Observe(int type, 52 virtual void Observe(int type,
50 const content::NotificationSource& source, 53 const content::NotificationSource& source,
51 const content::NotificationDetails& details) OVERRIDE; 54 const content::NotificationDetails& details) OVERRIDE;
(...skipping 10 matching lines...) Expand all
62 // initialized). 65 // initialized).
63 bool HasBackup() const; 66 bool HasBackup() const;
64 67
65 // Creates initial backup entries. 68 // Creates initial backup entries.
66 void InitBackup(); 69 void InitBackup();
67 70
68 // Updates the backup утекн for |pref_name| and кeturns |true| if the 71 // Updates the backup утекн for |pref_name| and кeturns |true| if the
69 // backup has changed. 72 // backup has changed.
70 bool UpdateBackupEntry(const std::string& pref_name); 73 bool UpdateBackupEntry(const std::string& pref_name);
71 74
72 // Updates the backup signature.
73 void UpdateBackupSignature();
74
75 // Perform a check that backup is valid and settings have not been modified. 75 // Perform a check that backup is valid and settings have not been modified.
76 void ValidateBackup(); 76 void ValidateBackup();
77 77
78 // Returns |true| if backup signature is valid. 78 // Returns |true| if backup signature is valid.
79 bool IsSignatureValid() const; 79 bool IsSignatureValid() const;
80 80
81 // Returns data to be signed as string. 81 // Returns data to be signed as string.
82 std::string GetSignatureData(PrefService* prefs) const; 82 std::string GetSignatureData(PrefService* prefs) const;
83 83
84 // Cached set of extension IDs. They are not changed as frequently 84 // Cached set of extension IDs. They are not changed as frequently
85 ExtensionPrefs::ExtensionIdSet cached_extension_ids_; 85 ExtensionPrefs::ExtensionIdSet cached_extension_ids_;
86 86
87 scoped_ptr<PrefSetObserver> pref_observer_; 87 scoped_ptr<PrefSetObserver> pref_observer_;
88 88
89 // True if the backup was valid at the profile load time. 89 // True if the backup was valid at the profile load time.
90 bool is_backup_valid_; 90 bool is_backup_valid_;
91 91
92 Profile* profile_; 92 Profile* profile_;
93 93
94 DISALLOW_COPY_AND_ASSIGN(ProtectedPrefsWatcher); 94 DISALLOW_COPY_AND_ASSIGN(ProtectedPrefsWatcher);
95 }; 95 };
96 96
97 } // namespace protector 97 } // namespace protector
98 98
99 #endif // CHROME_BROWSER_PROTECTOR_PROTECTED_PREFS_WATCHER_H_ 99 #endif // CHROME_BROWSER_PROTECTOR_PROTECTED_PREFS_WATCHER_H_
OLDNEW
« no previous file with comments | « chrome/browser/protector/prefs_backup_invalid_change_unittest.cc ('k') | chrome/browser/protector/protected_prefs_watcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698