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

Side by Side Diff: chrome/browser/profiles/profile_info_cache.h

Issue 11741003: Remove PrefServiceSimple, replacing it with PrefService and PrefRegistrySimple. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix double registration in Chrome Frame test. Created 7 years, 10 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_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_ 5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_
6 #define CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_ 6 #define CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/file_path.h" 14 #include "base/file_path.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/observer_list.h" 16 #include "base/observer_list.h"
17 #include "base/string16.h" 17 #include "base/string16.h"
18 #include "chrome/browser/profiles/profile_info_cache_observer.h" 18 #include "chrome/browser/profiles/profile_info_cache_observer.h"
19 #include "chrome/browser/profiles/profile_info_interface.h" 19 #include "chrome/browser/profiles/profile_info_interface.h"
20 20
21 namespace gfx { 21 namespace gfx {
22 class Image; 22 class Image;
23 } 23 }
24 24
25 namespace base { 25 namespace base {
26 class DictionaryValue; 26 class DictionaryValue;
27 } 27 }
28 28
29 class PrefService; 29 class PrefService;
30 class PrefServiceSimple; 30 class PrefRegistrySimple;
31 31
32 // This class saves various information about profiles to local preferences. 32 // This class saves various information about profiles to local preferences.
33 // This cache can be used to display a list of profiles without having to 33 // This cache can be used to display a list of profiles without having to
34 // actually load the profiles from disk. 34 // actually load the profiles from disk.
35 class ProfileInfoCache : public ProfileInfoInterface, 35 class ProfileInfoCache : public ProfileInfoInterface,
36 public base::SupportsWeakPtr<ProfileInfoCache> { 36 public base::SupportsWeakPtr<ProfileInfoCache> {
37 public: 37 public:
38 ProfileInfoCache(PrefService* prefs, const FilePath& user_data_dir); 38 ProfileInfoCache(PrefService* prefs, const FilePath& user_data_dir);
39 virtual ~ProfileInfoCache(); 39 virtual ~ProfileInfoCache();
40 40
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 static bool IsDefaultAvatarIconUrl(const std::string& icon_url, 122 static bool IsDefaultAvatarIconUrl(const std::string& icon_url,
123 size_t *icon_index); 123 size_t *icon_index);
124 124
125 // Gets all names of profiles associated with this instance of Chrome. 125 // Gets all names of profiles associated with this instance of Chrome.
126 // Because this method will be called during uninstall, before the creation 126 // Because this method will be called during uninstall, before the creation
127 // of the ProfileManager, it reads directly from the local state preferences, 127 // of the ProfileManager, it reads directly from the local state preferences,
128 // rather than going through the ProfileInfoCache object. 128 // rather than going through the ProfileInfoCache object.
129 static std::vector<string16> GetProfileNames(); 129 static std::vector<string16> GetProfileNames();
130 130
131 // Register cache related preferences in Local State. 131 // Register cache related preferences in Local State.
132 static void RegisterPrefs(PrefServiceSimple* prefs); 132 static void RegisterPrefs(PrefRegistrySimple* registry);
133 133
134 void AddObserver(ProfileInfoCacheObserver* obs); 134 void AddObserver(ProfileInfoCacheObserver* obs);
135 void RemoveObserver(ProfileInfoCacheObserver* obs); 135 void RemoveObserver(ProfileInfoCacheObserver* obs);
136 136
137 private: 137 private:
138 const base::DictionaryValue* GetInfoForProfileAtIndex(size_t index) const; 138 const base::DictionaryValue* GetInfoForProfileAtIndex(size_t index) const;
139 // Saves the profile info to a cache and takes ownership of |info|. 139 // Saves the profile info to a cache and takes ownership of |info|.
140 // Currently the only information that is cached is the profile's name, 140 // Currently the only information that is cached is the profile's name,
141 // user name, and avatar icon. 141 // user name, and avatar icon.
142 void SetInfoForProfileAtIndex(size_t index, base::DictionaryValue* info); 142 void SetInfoForProfileAtIndex(size_t index, base::DictionaryValue* info);
(...skipping 28 matching lines...) Expand all
171 // to be mutable. 171 // to be mutable.
172 mutable std::map<std::string, gfx::Image*> gaia_pictures_; 172 mutable std::map<std::string, gfx::Image*> gaia_pictures_;
173 // Marks a gaia profile picture as loading. This prevents a picture from 173 // Marks a gaia profile picture as loading. This prevents a picture from
174 // loading multiple times. 174 // loading multiple times.
175 mutable std::map<std::string, bool> gaia_pictures_loading_; 175 mutable std::map<std::string, bool> gaia_pictures_loading_;
176 176
177 DISALLOW_COPY_AND_ASSIGN(ProfileInfoCache); 177 DISALLOW_COPY_AND_ASSIGN(ProfileInfoCache);
178 }; 178 };
179 179
180 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_ 180 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_
OLDNEW
« no previous file with comments | « chrome/browser/profiles/off_the_record_profile_impl_unittest.cc ('k') | chrome/browser/profiles/profile_info_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698