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

Side by Side Diff: chrome/common/pref_store.h

Issue 10383262: RefCounted types should not have public destructors, delegate cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make win bot happy Created 8 years, 5 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_COMMON_PREF_STORE_H_ 5 #ifndef CHROME_COMMON_PREF_STORE_H_
6 #define CHROME_COMMON_PREF_STORE_H_ 6 #define CHROME_COMMON_PREF_STORE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 13
14 namespace base { 14 namespace base {
15 class Value; 15 class Value;
16 } 16 }
17 17
18 // This is an abstract interface for reading and writing from/to a persistent 18 // This is an abstract interface for reading and writing from/to a persistent
19 // preference store, used by PrefService. An implementation using a JSON file 19 // preference store, used by PrefService. An implementation using a JSON file
20 // can be found in JsonPrefStore, while an implementation without any backing 20 // can be found in JsonPrefStore, while an implementation without any backing
21 // store for testing can be found in TestingPrefStore. Furthermore, there is 21 // store for testing can be found in TestingPrefStore. Furthermore, there is
22 // CommandLinePrefStore, which bridges command line options to preferences and 22 // CommandLinePrefStore, which bridges command line options to preferences and
23 // ConfigurationPolicyPrefStore, which is used for hooking up configuration 23 // ConfigurationPolicyPrefStore, which is used for hooking up configuration
24 // policy with the preference subsystem. 24 // policy with the preference subsystem.
25 class PrefStore : public base::RefCounted<PrefStore> { 25 class PrefStore : public base::RefCounted<PrefStore> {
26 public: 26 public:
27 // Observer interface for monitoring PrefStore. 27 // Observer interface for monitoring PrefStore.
28 class Observer { 28 class Observer {
29 public: 29 public:
30 virtual ~Observer() {}
31
32 // Called when the value for the given |key| in the store changes. 30 // Called when the value for the given |key| in the store changes.
33 virtual void OnPrefValueChanged(const std::string& key) = 0; 31 virtual void OnPrefValueChanged(const std::string& key) = 0;
34 // Notification about the PrefStore being fully initialized. 32 // Notification about the PrefStore being fully initialized.
35 virtual void OnInitializationCompleted(bool succeeded) = 0; 33 virtual void OnInitializationCompleted(bool succeeded) = 0;
34
35 protected:
36 virtual ~Observer() {}
36 }; 37 };
37 38
38 // Return values for GetValue(). 39 // Return values for GetValue().
39 enum ReadResult { 40 enum ReadResult {
40 // Value found and returned. 41 // Value found and returned.
41 READ_OK, 42 READ_OK,
42 // No value present, but skip other pref stores and use default. 43 // No value present, but skip other pref stores and use default.
43 READ_USE_DEFAULT, 44 READ_USE_DEFAULT,
44 // No value present. 45 // No value present.
45 READ_NO_VALUE, 46 READ_NO_VALUE,
(...skipping 17 matching lines...) Expand all
63 64
64 protected: 65 protected:
65 friend class base::RefCounted<PrefStore>; 66 friend class base::RefCounted<PrefStore>;
66 virtual ~PrefStore() {} 67 virtual ~PrefStore() {}
67 68
68 private: 69 private:
69 DISALLOW_COPY_AND_ASSIGN(PrefStore); 70 DISALLOW_COPY_AND_ASSIGN(PrefStore);
70 }; 71 };
71 72
72 #endif // CHROME_COMMON_PREF_STORE_H_ 73 #endif // CHROME_COMMON_PREF_STORE_H_
OLDNEW
« no previous file with comments | « chrome/common/net/gaia/oauth2_mint_token_flow.h ('k') | chrome/service/cloud_print/cloud_print_url_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698