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

Unified Diff: chrome/browser/profiles/profile_attributes_entry.h

Issue 1214483002: Improve the ProfileInfoCache API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review feedback Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/profiles/profile_attributes_entry.h
diff --git a/chrome/browser/profiles/profile_attributes_entry.h b/chrome/browser/profiles/profile_attributes_entry.h
new file mode 100644
index 0000000000000000000000000000000000000000..663561fcc5792c7124a5eac1815c48a8902b4c05
--- /dev/null
+++ b/chrome/browser/profiles/profile_attributes_entry.h
@@ -0,0 +1,91 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_PROFILES_PROFILE_ATTRIBUTES_ENTRY_H_
+#define CHROME_BROWSER_PROFILES_PROFILE_ATTRIBUTES_ENTRY_H_
+
+#include <string>
+
+#include "base/files/file_path.h"
+#include "base/strings/string16.h"
+#include "base/time/time.h"
+
+namespace gfx {
+class Image;
+}
+
+class ProfileInfoCache;
+
+class ProfileAttributesEntry {
+ public:
+ ProfileAttributesEntry();
Mike Lerman 2015/07/02 18:01:30 virtual ~ProfileAttributesEntry();
anthonyvd 2015/07/07 21:05:32 Done. Is it a coding guideline thing to have a vir
Mike Lerman 2015/07/08 18:26:34 I think so - I've gotten that as feedback many tim
+
+ base::string16 GetName() const;
+ base::string16 GetShortcutName() const;
+ base::FilePath GetPath() const;
+ base::Time GetActiveTime() const;
+ base::string16 GetUserName() const;
+ const gfx::Image& GetAvatarIcon();
+ std::string GetLocalAuthCredentials() const;
+ std::string GetPasswordChangeDetectionToken() const;
+ // Note that a return value of false could mean an error in collection or
+ // that there are currently no background apps running. However, the action
+ // which results is the same in both cases (thus far).
+ bool GetBackgroundStatus() const;
+ base::string16 GetGAIAName() const;
+ base::string16 GetGAIAGivenName() const;
+ std::string GetGAIAId() const;
+ // Returns the GAIA picture for the given profile. This may return NULL
+ // if the profile does not have a GAIA picture or if the picture must be
+ // loaded from disk.
+ const gfx::Image* GetGAIAPicture() const;
+ bool IsUsingGAIAPicture() const;
+ bool IsSupervised() const;
+ bool IsChild() const;
+ bool IsLegacySupervised() const;
+ bool IsOmitted() const;
+ bool IsSigninRequired() const;
+ std::string GetSupervisedUserId() const;
+ bool IsEphemeral() const;
+ bool IsUsingDefaultName() const;
+ bool IsAuthenticated() const;
+ bool IsUsingDefaultAvatar() const;
+ bool IsAuthError() const;
+ size_t GetAvatarIconIndex() const;
+
+ void SetName(const base::string16& name);
+ void SetShortcutName(const base::string16& name);
+ void SetIsOmitted(bool is_omitted);
+ void SetSupervisedUserId(const std::string& id);
+ void SetLocalAuthCredentials(const std::string& auth);
+ void SetPasswordChangeDetectionToken(const std::string& token);
+ void SetBackgroundStatus(bool running_background_apps);
+ void SetGAIAName(const base::string16& name);
+ void SetGAIAGivenName(const base::string16& name);
+ void SetGAIAPicture(const gfx::Image* image);
+ void SetIsUsingGAIAPicture(bool value);
+ void SetIsSigninRequired(bool value);
+ void SetIsEphemeral(bool value);
+ void SetIsUsingDefaultName(bool value);
+ void SetIsUsingDefaultAvatar(bool value);
+ void SetIsAuthError(bool value);
+ void SetAvatarIconIndex(size_t icon_index);
+
+ void SetAuthInfo(const std::string& gaia_id,
+ const base::string16& user_name);
+
+ private:
+ // These members are an implementation detail meant to smooth the migration
+ // of the ProfileInfoCache to the ProfileAttributesStorage interface. They can
+ // be safely removed once the ProfileInfoCache stops using indices
+ // internally.
+ // TODO(anthonyvd): Remove ProfileInfoCache related implementation details
+ // when this class holds the members required to fulfill its own contract.
+ friend class ProfileInfoCache;
+ ProfileAttributesEntry(ProfileInfoCache* cache, size_t index);
+ ProfileInfoCache* profile_info_cache_;
+ size_t profile_index_;
+};
+
+#endif // CHROME_BROWSER_PROFILES_PROFILE_ATTRIBUTES_ENTRY_H_

Powered by Google App Engine
This is Rietveld 408576698