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

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

Issue 1631373003: Refactor ProfileInfoCache in c/b/ui/app_list (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change to std::cref Created 4 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_ATTRIBUTES_ENTRY_H_ 5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_ATTRIBUTES_ENTRY_H_
6 #define CHROME_BROWSER_PROFILES_PROFILE_ATTRIBUTES_ENTRY_H_ 6 #define CHROME_BROWSER_PROFILES_PROFILE_ATTRIBUTES_ENTRY_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/scoped_ptr.h"
14 #include "base/strings/string16.h" 15 #include "base/strings/string16.h"
15 #include "base/time/time.h" 16 #include "base/time/time.h"
17 #include "third_party/icu/source/i18n/unicode/coll.h"
16 18
17 namespace gfx { 19 namespace gfx {
18 class Image; 20 class Image;
19 } 21 }
20 22
21 class ProfileInfoCache; 23 class ProfileInfoCache;
22 24
23 class ProfileAttributesEntry { 25 class ProfileAttributesEntry {
24 public: 26 public:
27 // Compares two ProfileAttributesEntry using locale-sensitive comparison of
28 // their names. For ties, the profile path is compared next.
29 class SortComparator {
30 public:
31 SortComparator();
32 bool operator()(const ProfileAttributesEntry* const a,
33 const ProfileAttributesEntry* const b) const;
34 private:
35 scoped_ptr<icu::Collator> collator_;
36 };
37
25 ProfileAttributesEntry(); 38 ProfileAttributesEntry();
26 virtual ~ProfileAttributesEntry() {} 39 virtual ~ProfileAttributesEntry() {}
27 40
28 // Gets the name of the profile, which is the one displayed in the User Menu. 41 // Gets the name of the profile, which is the one displayed in the User Menu.
29 base::string16 GetName() const; 42 base::string16 GetName() const;
30 43
31 base::string16 GetShortcutName() const; 44 base::string16 GetShortcutName() const;
32 // Gets the path to the profile. Should correspond to the path passed to 45 // Gets the path to the profile. Should correspond to the path passed to
33 // ProfileAttributesStorage::GetProfileAttributesWithPath to get this entry. 46 // ProfileAttributesStorage::GetProfileAttributesWithPath to get this entry.
34 base::FilePath GetPath() const; 47 base::FilePath GetPath() const;
35 base::Time GetActiveTime() const; 48 base::Time GetActiveTime() const;
36 // Gets the user name of the signed in profile. This is typically the email 49 // Gets the user name of the signed in profile. This is typically the email
37 // address used to sign in and the empty string for profiles that aren't 50 // address used to sign in and the empty string for profiles that aren't
38 // signed in to chrome. 51 // signed in to chrome.
39 base::string16 GetUserName() const; 52 base::string16 GetUserName() const;
40 // Gets the icon used as this profile's avatar. This might not be the icon 53 // Gets the icon used as this profile's avatar. This might not be the icon
41 // displayed in the UI if IsUsingGAIAPicture() is true. 54 // displayed in the UI if IsUsingGAIAPicture() is true.
42 const gfx::Image& GetAvatarIcon(); 55 const gfx::Image& GetAvatarIcon() const;
43 std::string GetLocalAuthCredentials() const; 56 std::string GetLocalAuthCredentials() const;
44 std::string GetPasswordChangeDetectionToken() const; 57 std::string GetPasswordChangeDetectionToken() const;
45 // Note that a return value of false could mean an error in collection or 58 // Note that a return value of false could mean an error in collection or
46 // that there are currently no background apps running. However, the action 59 // that there are currently no background apps running. However, the action
47 // which results is the same in both cases (thus far). 60 // which results is the same in both cases (thus far).
48 bool GetBackgroundStatus() const; 61 bool GetBackgroundStatus() const;
49 // Gets the GAIA full name associated with this profile if it's signed in. 62 // Gets the GAIA full name associated with this profile if it's signed in.
50 base::string16 GetGAIAName() const; 63 base::string16 GetGAIAName() const;
51 // Gets the GAIA given name associated with this profile if it's signed in. 64 // Gets the GAIA given name associated with this profile if it's signed in.
52 base::string16 GetGAIAGivenName() const; 65 base::string16 GetGAIAGivenName() const;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 friend class ProfileInfoCache; 147 friend class ProfileInfoCache;
135 void Initialize(ProfileInfoCache* cache, const base::FilePath& path); 148 void Initialize(ProfileInfoCache* cache, const base::FilePath& path);
136 size_t profile_index() const; 149 size_t profile_index() const;
137 ProfileInfoCache* profile_info_cache_; 150 ProfileInfoCache* profile_info_cache_;
138 base::FilePath profile_path_; 151 base::FilePath profile_path_;
139 152
140 DISALLOW_COPY_AND_ASSIGN(ProfileAttributesEntry); 153 DISALLOW_COPY_AND_ASSIGN(ProfileAttributesEntry);
141 }; 154 };
142 155
143 #endif // CHROME_BROWSER_PROFILES_PROFILE_ATTRIBUTES_ENTRY_H_ 156 #endif // CHROME_BROWSER_PROFILES_PROFILE_ATTRIBUTES_ENTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698