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

Unified Diff: chrome/browser/api/prefs/pref_change_registrar.h

Issue 11243002: Move the bits of Prefs where production code has only trivially easy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments, fix gypi problem Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/DEPS ('k') | chrome/browser/api/prefs/pref_change_registrar.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/api/prefs/pref_change_registrar.h
diff --git a/chrome/browser/api/prefs/pref_change_registrar.h b/chrome/browser/api/prefs/pref_change_registrar.h
deleted file mode 100644
index e6e2114d121e8695dc986e81f74314139140905d..0000000000000000000000000000000000000000
--- a/chrome/browser/api/prefs/pref_change_registrar.h
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright (c) 2010 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_API_PREFS_PREF_CHANGE_REGISTRAR_H_
-#define CHROME_BROWSER_API_PREFS_PREF_CHANGE_REGISTRAR_H_
-
-#include <set>
-#include <string>
-
-#include "base/basictypes.h"
-
-class PrefServiceBase;
-
-namespace content {
-class NotificationObserver;
-}
-
-// Automatically manages the registration of one or more pref change observers
-// with a PrefStore. Functions much like NotificationRegistrar, but specifically
-// manages observers of preference changes. When the Registrar is destroyed,
-// all registered observers are automatically unregistered with the PrefStore.
-class PrefChangeRegistrar {
- public:
- PrefChangeRegistrar();
- virtual ~PrefChangeRegistrar();
-
- // Must be called before adding or removing observers. Can be called more
- // than once as long as the value of |service| doesn't change.
- void Init(PrefServiceBase* service);
-
- // Adds an pref observer for the specified pref |path| and |obs| observer
- // object. All registered observers will be automatically unregistered
- // when the registrar's destructor is called unless the observer has been
- // explicitly removed by a call to Remove beforehand.
- void Add(const char* path,
- content::NotificationObserver* obs);
-
- // Removes a preference observer that has previously been added with a call to
- // Add.
- void Remove(const char* path,
- content::NotificationObserver* obs);
-
- // Removes all observers that have been previously added with a call to Add.
- void RemoveAll();
-
- // Returns true if no pref observers are registered.
- bool IsEmpty() const;
-
- // Check whether |pref| is in the set of preferences being observed.
- bool IsObserved(const std::string& pref);
-
- // Check whether any of the observed preferences has the managed bit set.
- bool IsManaged();
-
- private:
- typedef std::pair<std::string, content::NotificationObserver*>
- ObserverRegistration;
-
- std::set<ObserverRegistration> observers_;
- PrefServiceBase* service_;
-
- DISALLOW_COPY_AND_ASSIGN(PrefChangeRegistrar);
-};
-
-#endif // CHROME_BROWSER_API_PREFS_PREF_CHANGE_REGISTRAR_H_
« no previous file with comments | « chrome/DEPS ('k') | chrome/browser/api/prefs/pref_change_registrar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698