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

Side by Side Diff: chrome/browser/prefs/value_map_pref_store.h

Issue 9251026: Reinitialize LocalState's CommandLinePrefStore after about_flags updates the command line. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix presubmit checks, no code change Created 8 years, 11 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
1 // Copyright (c) 2011 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_PREFS_VALUE_MAP_PREF_STORE_H_ 5 #ifndef CHROME_BROWSER_PREFS_VALUE_MAP_PREF_STORE_H_
6 #define CHROME_BROWSER_PREFS_VALUE_MAP_PREF_STORE_H_ 6 #define CHROME_BROWSER_PREFS_VALUE_MAP_PREF_STORE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map>
10 #include <string>
11
9 #include "base/basictypes.h" 12 #include "base/basictypes.h"
10 #include "base/observer_list.h" 13 #include "base/observer_list.h"
11 #include "chrome/browser/prefs/pref_value_map.h" 14 #include "chrome/browser/prefs/pref_value_map.h"
12 #include "chrome/common/pref_store.h" 15 #include "chrome/common/pref_store.h"
13 16
14 // A basic PrefStore implementation that uses a simple name-value map for 17 // A basic PrefStore implementation that uses a simple name-value map for
15 // storing the preference values. 18 // storing the preference values.
16 class ValueMapPrefStore : public PrefStore { 19 class ValueMapPrefStore : public PrefStore {
17 public: 20 public:
18 typedef std::map<std::string, base::Value*>::iterator iterator; 21 typedef std::map<std::string, base::Value*>::iterator iterator;
19 typedef std::map<std::string, base::Value*>::const_iterator const_iterator; 22 typedef std::map<std::string, base::Value*>::const_iterator const_iterator;
20 23
21 ValueMapPrefStore(); 24 ValueMapPrefStore();
22 virtual ~ValueMapPrefStore(); 25 virtual ~ValueMapPrefStore();
23 26
24 // PrefStore overrides: 27 // PrefStore overrides:
25 virtual ReadResult GetValue(const std::string& key, 28 virtual ReadResult GetValue(const std::string& key,
26 const base::Value** value) const OVERRIDE; 29 const base::Value** value) const OVERRIDE;
27 virtual void AddObserver(PrefStore::Observer* observer) OVERRIDE; 30 virtual void AddObserver(PrefStore::Observer* observer) OVERRIDE;
28 virtual void RemoveObserver(PrefStore::Observer* observer) OVERRIDE; 31 virtual void RemoveObserver(PrefStore::Observer* observer) OVERRIDE;
32 virtual size_t NumberOfObservers() const OVERRIDE;
29 33
30 iterator begin(); 34 iterator begin();
31 iterator end(); 35 iterator end();
32 const_iterator begin() const; 36 const_iterator begin() const;
33 const_iterator end() const; 37 const_iterator end() const;
34 38
35 protected: 39 protected:
36 // Store a |value| for |key| in the store. Also generates an notification if 40 // Store a |value| for |key| in the store. Also generates an notification if
37 // the value changed. Assumes ownership of |value|, which must be non-NULL. 41 // the value changed. Assumes ownership of |value|, which must be non-NULL.
38 void SetValue(const std::string& key, base::Value* value); 42 void SetValue(const std::string& key, base::Value* value);
39 43
40 // Remove the value for |key| from the store. Sends a notification if there 44 // Remove the value for |key| from the store. Sends a notification if there
41 // was a value to be removed. 45 // was a value to be removed.
42 void RemoveValue(const std::string& key); 46 void RemoveValue(const std::string& key);
43 47
44 // Notify observers about the initialization completed event. 48 // Notify observers about the initialization completed event.
45 void NotifyInitializationCompleted(); 49 void NotifyInitializationCompleted();
46 50
47 private: 51 private:
48 PrefValueMap prefs_; 52 PrefValueMap prefs_;
49 53
50 ObserverList<PrefStore::Observer, true> observers_; 54 ObserverList<PrefStore::Observer, true> observers_;
51 55
52 DISALLOW_COPY_AND_ASSIGN(ValueMapPrefStore); 56 DISALLOW_COPY_AND_ASSIGN(ValueMapPrefStore);
53 }; 57 };
54 58
55 #endif // CHROME_BROWSER_PREFS_VALUE_MAP_PREF_STORE_H_ 59 #endif // CHROME_BROWSER_PREFS_VALUE_MAP_PREF_STORE_H_
OLDNEW
« no previous file with comments | « chrome/browser/prefs/testing_pref_store.cc ('k') | chrome/browser/prefs/value_map_pref_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698