OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_INFO_ENTRY_H_ |
| 6 #define CHROME_BROWSER_PROFILES_PROFILE_INFO_ENTRY_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/files/file_path.h" |
| 10 #include "chrome/browser/profiles/profile_info_util.h" |
| 11 #include "ui/base/resource/resource_bundle.h" |
| 12 |
| 13 namespace base { |
| 14 class DictionaryValue; |
| 15 } |
| 16 namespace gfx { |
| 17 class Image; |
| 18 } |
| 19 |
| 20 // This class caches information about a single profile. |
| 21 class ProfileInfoEntry { |
| 22 public: |
| 23 ProfileInfoEntry(); |
| 24 explicit ProfileInfoEntry(const base::FilePath& path, |
| 25 const base::DictionaryValue& info); |
| 26 |
| 27 // Overload the < and = operators so that the ProfileInfoCache can return |
| 28 // a list of sorted ProfileInfoEntries. |
| 29 ProfileInfoEntry& operator=(const ProfileInfoEntry& entry); |
| 30 bool operator<(const ProfileInfoEntry& rhs) const; |
| 31 |
| 32 const base::FilePath& path() const { return path_; } |
| 33 void set_path(const base::FilePath& path) { path_ = path; } |
| 34 |
| 35 const string16& name() const { return name_; } |
| 36 void set_name(const string16& name) { name_ = name; } |
| 37 |
| 38 const string16& shortcut_name() const { return shortcut_name_; } |
| 39 void set_shortcut_name(const string16& name) {shortcut_name_ = name; } |
| 40 |
| 41 const string16& user_name() const { return user_name_; } |
| 42 void set_user_name(const string16& user_name) { user_name_ = user_name; } |
| 43 |
| 44 const string16& GAIA_given_name() const { return GAIA_given_name_; } |
| 45 void set_GAIA_given_name(const string16& name) { GAIA_given_name_ = name; } |
| 46 |
| 47 const string16& GAIA_full_name() const { return GAIA_full_name_; } |
| 48 void set_GAIA_full_name(const string16& name) { GAIA_full_name_ = name; } |
| 49 |
| 50 bool is_using_GAIA_name() const { return is_using_GAIA_name_; } |
| 51 void set_is_using_GAIA_name(bool flag) { is_using_GAIA_name_ = flag; } |
| 52 |
| 53 bool is_using_GAIA_picture() const { return is_using_GAIA_picture_; } |
| 54 void set_is_using_GAIA_picture(bool flag) { is_using_GAIA_picture_ = flag; } |
| 55 |
| 56 bool has_migrated_to_GAIA_info_of_profile() const { return has_migrated_to_GAI
A_info_of_profile_; } |
| 57 void set_has_migrated_to_GAIA_info_of_profile(bool flag) { has_migrated_to_GAI
A_info_of_profile_ = flag; } |
| 58 |
| 59 const std::string GAIA_picture_file_name() const { return GAIA_picture_file_na
me_; } |
| 60 void set_GAIA_picture_file_name(const std::string& file) { GAIA_picture_file_n
ame_ = file; } |
| 61 |
| 62 const std::string managed_user_id() const { return managed_user_id_; } |
| 63 void set_managed_user_id(const std::string& id) { managed_user_id_ = id; } |
| 64 |
| 65 size_t icon_index() const { return icon_index_; } |
| 66 void set_icon_index(size_t index) { icon_index_ = index; } |
| 67 |
| 68 bool is_running_background_apps() const { return is_running_background_apps_;
} |
| 69 void set_is_running_background_apps(bool flag) { is_running_background_apps_ =
flag; } |
| 70 |
| 71 bool is_signin_required() const { return is_signin_required_; } |
| 72 void set_is_signin_required(bool flag) { is_signin_required_ = flag; } |
| 73 |
| 74 // This refers to local management (formerly "managed mode"), |
| 75 // not enterprise management. |
| 76 bool IsManaged() const { |
| 77 return !managed_user_id_.empty(); |
| 78 } |
| 79 |
| 80 const string16 GetDisplayName() const { |
| 81 string16 name; |
| 82 if (is_using_GAIA_name_) |
| 83 name = GAIA_given_name_.empty() ? GAIA_full_name_ : GAIA_given_name_; |
| 84 |
| 85 return name.empty() ? name_ : name; |
| 86 } |
| 87 |
| 88 private: |
| 89 base::FilePath path_; |
| 90 string16 name_; |
| 91 string16 shortcut_name_; |
| 92 string16 user_name_; |
| 93 |
| 94 string16 GAIA_given_name_; |
| 95 string16 GAIA_full_name_; |
| 96 bool is_using_GAIA_name_; |
| 97 bool is_using_GAIA_picture_; |
| 98 std::string GAIA_picture_file_name_; |
| 99 bool has_migrated_to_GAIA_info_of_profile_; |
| 100 |
| 101 // This refers to local management (formerly "managed mode"), |
| 102 // not enterprise management. |
| 103 std::string managed_user_id_; |
| 104 size_t icon_index_; |
| 105 bool is_running_background_apps_; |
| 106 |
| 107 bool is_signin_required_; |
| 108 }; |
| 109 |
| 110 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_ENTRY_H_ |
OLD | NEW |