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

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: Respond to comments, add sorting of ProfileAttributesEntry 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"
tapted 2016/02/02 00:20:55 this doesn't compile for me on mac: unicode/utypes
lwchkg 2016/02/03 17:18:38 Oh. Can you start the try bot about Mac for me? It
lwchkg 2016/02/04 14:27:06 Find the cause of the error. There's a new depende
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 explicit SortComparator(const icu::Collator* const collator)
32 : collator_(collator) {}
33 bool operator()(const ProfileAttributesEntry* const a,
34 const ProfileAttributesEntry* const b) const;
35 // Returns a Collator which is used to construct SortComparator.
36 static scoped_ptr<icu::Collator> GetCollator();
37 private:
38 const icu::Collator* const collator_;
tapted 2016/01/31 23:04:37 The ownership in this class is not right. You shou
lwchkg 2016/02/01 06:31:20 Before coming to this version, actually I tried wh
tapted 2016/02/02 00:20:55 I think you just need to add a move constructor to
39 };
40
25 ProfileAttributesEntry(); 41 ProfileAttributesEntry();
26 virtual ~ProfileAttributesEntry() {} 42 virtual ~ProfileAttributesEntry() {}
27 43
28 // Gets the name of the profile, which is the one displayed in the User Menu. 44 // Gets the name of the profile, which is the one displayed in the User Menu.
29 base::string16 GetName() const; 45 base::string16 GetName() const;
30 46
31 base::string16 GetShortcutName() const; 47 base::string16 GetShortcutName() const;
32 // Gets the path to the profile. Should correspond to the path passed to 48 // Gets the path to the profile. Should correspond to the path passed to
33 // ProfileAttributesStorage::GetProfileAttributesWithPath to get this entry. 49 // ProfileAttributesStorage::GetProfileAttributesWithPath to get this entry.
34 base::FilePath GetPath() const; 50 base::FilePath GetPath() const;
35 base::Time GetActiveTime() const; 51 base::Time GetActiveTime() const;
36 // Gets the user name of the signed in profile. This is typically the email 52 // 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 53 // address used to sign in and the empty string for profiles that aren't
38 // signed in to chrome. 54 // signed in to chrome.
39 base::string16 GetUserName() const; 55 base::string16 GetUserName() const;
40 // Gets the icon used as this profile's avatar. This might not be the icon 56 // Gets the icon used as this profile's avatar. This might not be the icon
41 // displayed in the UI if IsUsingGAIAPicture() is true. 57 // displayed in the UI if IsUsingGAIAPicture() is true.
42 const gfx::Image& GetAvatarIcon(); 58 const gfx::Image& GetAvatarIcon() const;
43 std::string GetLocalAuthCredentials() const; 59 std::string GetLocalAuthCredentials() const;
44 std::string GetPasswordChangeDetectionToken() const; 60 std::string GetPasswordChangeDetectionToken() const;
45 // Note that a return value of false could mean an error in collection or 61 // 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 62 // that there are currently no background apps running. However, the action
47 // which results is the same in both cases (thus far). 63 // which results is the same in both cases (thus far).
48 bool GetBackgroundStatus() const; 64 bool GetBackgroundStatus() const;
49 // Gets the GAIA full name associated with this profile if it's signed in. 65 // Gets the GAIA full name associated with this profile if it's signed in.
50 base::string16 GetGAIAName() const; 66 base::string16 GetGAIAName() const;
51 // Gets the GAIA given name associated with this profile if it's signed in. 67 // Gets the GAIA given name associated with this profile if it's signed in.
52 base::string16 GetGAIAGivenName() const; 68 base::string16 GetGAIAGivenName() const;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 friend class ProfileInfoCache; 150 friend class ProfileInfoCache;
135 void Initialize(ProfileInfoCache* cache, const base::FilePath& path); 151 void Initialize(ProfileInfoCache* cache, const base::FilePath& path);
136 size_t profile_index() const; 152 size_t profile_index() const;
137 ProfileInfoCache* profile_info_cache_; 153 ProfileInfoCache* profile_info_cache_;
138 base::FilePath profile_path_; 154 base::FilePath profile_path_;
139 155
140 DISALLOW_COPY_AND_ASSIGN(ProfileAttributesEntry); 156 DISALLOW_COPY_AND_ASSIGN(ProfileAttributesEntry);
141 }; 157 };
142 158
143 #endif // CHROME_BROWSER_PROFILES_PROFILE_ATTRIBUTES_ENTRY_H_ 159 #endif // CHROME_BROWSER_PROFILES_PROFILE_ATTRIBUTES_ENTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698