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

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

Issue 7544031: Create AvatarMenuModel for the new avatar menu interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ready for review Created 9 years, 4 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #pragma once 7 #pragma once
8 8
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/file_path.h" 14 #include "base/file_path.h"
14 #include "base/string16.h" 15 #include "base/string16.h"
16 #include "chrome/browser/profiles/profile_info_interface.h"
15 17
16 namespace gfx { 18 namespace gfx {
17 class Image; 19 class Image;
18 } 20 }
19 21
20 namespace base { 22 namespace base {
21 class DictionaryValue; 23 class DictionaryValue;
22 } 24 }
23 25
24 class PrefService; 26 class PrefService;
25 27
26 28
27 // This class saves various information about profiles to local preferences. 29 // This class saves various information about profiles to local preferences.
28 // This cache can be used to display a list of profiles without having to 30 // This cache can be used to display a list of profiles without having to
29 // actually load the profiles from disk. 31 // actually load the profiles from disk.
30 class ProfileInfoCache { 32 class ProfileInfoCache : public ProfileInfoInterface {
31 public: 33 public:
32 ProfileInfoCache(PrefService* prefs, const FilePath& user_data_dir); 34 ProfileInfoCache(PrefService* prefs, const FilePath& user_data_dir);
33 ~ProfileInfoCache(); 35 virtual ~ProfileInfoCache();
34 36
35 void AddProfileToCache(const FilePath& profile_path, 37 void AddProfileToCache(const FilePath& profile_path,
36 const string16& name, 38 const string16& name,
37 size_t icon_index); 39 size_t icon_index);
38 void DeleteProfileFromCache(const FilePath& profile_path); 40 void DeleteProfileFromCache(const FilePath& profile_path);
39 41
40 size_t GetNumberOfProfiles() const; 42 // ProfileInfoInterface:
41 size_t GetIndexOfProfileWithPath(const FilePath& profile_path) const; 43 virtual size_t GetNumberOfProfiles() const OVERRIDE;
42 string16 GetNameOfProfileAtIndex(size_t index) const; 44 virtual size_t GetIndexOfProfileWithPath(
43 FilePath GetPathOfProfileAtIndex(size_t index) const; 45 const FilePath& profile_path) const OVERRIDE;
44 const gfx::Image& GetAvatarIconOfProfileAtIndex(size_t index) const; 46 virtual string16 GetNameOfProfileAtIndex(size_t index) const OVERRIDE;
47 virtual FilePath GetPathOfProfileAtIndex(size_t index) const OVERRIDE;
48 virtual const gfx::Image& GetAvatarIconOfProfileAtIndex(
49 size_t index) const OVERRIDE;
50
45 size_t GetAvatarIconIndexOfProfileAtIndex(size_t index) const; 51 size_t GetAvatarIconIndexOfProfileAtIndex(size_t index) const;
46 52
47 void SetNameOfProfileAtIndex(size_t index, const string16& name); 53 void SetNameOfProfileAtIndex(size_t index, const string16& name);
48 void SetAvatarIconOfProfileAtIndex(size_t index, size_t icon_index); 54 void SetAvatarIconOfProfileAtIndex(size_t index, size_t icon_index);
49 55
50 // Returns unique name that can be assigned to a newly created profile. 56 // Returns unique name that can be assigned to a newly created profile.
51 string16 ChooseNameForNewProfile(); 57 string16 ChooseNameForNewProfile();
52 58
53 // Returns an avatar icon index that can be assigned to a newly created 59 // Returns an avatar icon index that can be assigned to a newly created
54 // profile. Note that the icon may not be unique since there are a limited 60 // profile. Note that the icon may not be unique since there are a limited
(...skipping 28 matching lines...) Expand all
83 const string16& search_name); 89 const string16& search_name);
84 90
85 PrefService* prefs_; 91 PrefService* prefs_;
86 std::vector<std::string> sorted_keys_; 92 std::vector<std::string> sorted_keys_;
87 FilePath user_data_dir_; 93 FilePath user_data_dir_;
88 94
89 DISALLOW_COPY_AND_ASSIGN(ProfileInfoCache); 95 DISALLOW_COPY_AND_ASSIGN(ProfileInfoCache);
90 }; 96 };
91 97
92 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_ 98 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_
OLDNEW
« no previous file with comments | « chrome/browser/profiles/avatar_menu_model_unittest.cc ('k') | chrome/browser/profiles/profile_info_interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698