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

Unified Diff: chrome/browser/protector/protected_prefs_watcher.h

Issue 9620010: Added Protector backup for Preferences. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Whitespace. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/protector/protected_prefs_watcher.h
diff --git a/chrome/browser/protector/protected_prefs_watcher.h b/chrome/browser/protector/protected_prefs_watcher.h
new file mode 100644
index 0000000000000000000000000000000000000000..9854c651fce9721d38bdfdceee7f28f4e9d723b5
--- /dev/null
+++ b/chrome/browser/protector/protected_prefs_watcher.h
@@ -0,0 +1,70 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_PROTECTOR_PROTECTED_PREFS_WATCHER_H_
+#define CHROME_BROWSER_PROTECTOR_PROTECTED_PREFS_WATCHER_H_
+#pragma once
+
+#include <set>
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
+#include "content/public/browser/notification_observer.h"
+
+class PrefService;
+class PrefSetObserver;
+class Profile;
+
+namespace protector {
+
+class ProtectedPrefsWatcher : public content::NotificationObserver {
+ public:
+ explicit ProtectedPrefsWatcher(Profile* profile);
+ ~ProtectedPrefsWatcher();
+
+ // Registers prefs on a new Profile instance.
+ static void RegisterUserPrefs(PrefService* prefs);
+
+ // Perform a check that backup is valid and settings have not been modified.
+ 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
+
+ private:
+ // content::NotificationObserver overrides:
+ virtual void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) OVERRIDE;
+
+ // Updates cached prefs from their actual values and returns |true| if there
+ // were any changes.
+ bool UpdateCachedPrefs();
+
+ // Update the backup signature.
+ void UpdateBackupSignature();
+
+ // Checks if backup signature is valid.
+ bool IsSignatureValid();
whywhat 2012/03/07 18:53:30 const?
Ivan Korotkov 2012/03/11 12:59:44 Done.
+
+ // Returns |false| if |profile_| does not have a backup yet (needs to be
+ // initialized).
+ bool HasBackup();
whywhat 2012/03/07 18:53:30 const?
Ivan Korotkov 2012/03/11 12:59:44 Done.
+
+ // Returns data to be signed as string.
+ std::string GetSignatureData(PrefService* prefs);
whywhat 2012/03/07 18:53:30 ditto
Ivan Korotkov 2012/03/11 12:59:44 Done.
+
+ // Cached set of extension IDs. They are not changed as frequently
+ std::set<std::string> cached_extension_ids_;
+
+ scoped_ptr<PrefSetObserver> pref_observer_;
+
+ 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.
+
+ Profile* profile_;
+
+ DISALLOW_COPY_AND_ASSIGN(ProtectedPrefsWatcher);
+};
+
+} // namespace protector
+
+#endif // CHROME_BROWSER_PROTECTOR_PROTECTED_PREFS_WATCHER_H_

Powered by Google App Engine
This is Rietveld 408576698