Home | History | Annotate | Download | only in profiles
      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
      3 // found in the LICENSE file.
      4 
      5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_INFO_INTERFACE_H_
      6 #define CHROME_BROWSER_PROFILES_PROFILE_INFO_INTERFACE_H_
      7 
      8 #include "base/files/file_path.h"
      9 #include "base/strings/string16.h"
     10 
     11 namespace base {
     12 class Time;
     13 }
     14 
     15 namespace gfx {
     16 class Image;
     17 }
     18 
     19 // This abstract interface is used to query the profiles backend for information
     20 // about the different profiles. Its sole concrete implementation is the
     21 // ProfileInfoCache. This interface exists largely to assist in testing.
     22 class ProfileInfoInterface {
     23  public:
     24   virtual size_t GetNumberOfProfiles() const = 0;
     25 
     26   virtual size_t GetIndexOfProfileWithPath(
     27       const base::FilePath& profile_path) const = 0;
     28 
     29   virtual base::Time GetProfileActiveTimeAtIndex(size_t index) const = 0;
     30 
     31   virtual base::string16 GetNameOfProfileAtIndex(size_t index) const = 0;
     32 
     33   virtual base::string16 GetShortcutNameOfProfileAtIndex(
     34       size_t index) const = 0;
     35 
     36   virtual base::FilePath GetPathOfProfileAtIndex(size_t index) const = 0;
     37 
     38   virtual base::string16 GetUserNameOfProfileAtIndex(size_t index) const = 0;
     39 
     40   virtual const gfx::Image& GetAvatarIconOfProfileAtIndex(
     41       size_t index) const = 0;
     42 
     43   virtual std::string GetLocalAuthCredentialsOfProfileAtIndex(
     44       size_t index) const = 0;
     45 
     46   // Returns true if the profile at the given index is currently running any
     47   // background apps.
     48   virtual bool GetBackgroundStatusOfProfileAtIndex(
     49       size_t index) const = 0;
     50 
     51   virtual base::string16 GetGAIANameOfProfileAtIndex(size_t index) const = 0;
     52 
     53   virtual base::string16 GetGAIAGivenNameOfProfileAtIndex(
     54       size_t index) const = 0;
     55 
     56   virtual const gfx::Image* GetGAIAPictureOfProfileAtIndex(
     57       size_t index) const = 0;
     58 
     59   // Checks if the GAIA picture should be used as the profile's avatar icon.
     60   virtual bool IsUsingGAIAPictureOfProfileAtIndex(size_t index) const = 0;
     61 
     62   virtual bool ProfileIsSupervisedAtIndex(size_t index) const = 0;
     63 
     64   // Returns true if the profile should be omitted from the desktop profile
     65   // list (see ProfileListDesktop), so it won't appear in the avatar menu.
     66   virtual bool IsOmittedProfileAtIndex(size_t index) const = 0;
     67 
     68   virtual std::string GetSupervisedUserIdOfProfileAtIndex(
     69       size_t index) const = 0;
     70 
     71   // This profile is associated with an account but has been signed-out.
     72   virtual bool ProfileIsSigninRequiredAtIndex(size_t index) const = 0;
     73 
     74   // Profile is known to be ephemeral and should be deleted when closed.
     75   virtual bool ProfileIsEphemeralAtIndex(size_t index) const = 0;
     76 
     77   // Returns true if the profile is using the name it was assigned by default
     78   // at creation (either the old-style "Lemonade" name, or the new "Profile %d"
     79   // style name).
     80   virtual bool ProfileIsUsingDefaultNameAtIndex(size_t index) const = 0;
     81 
     82  protected:
     83   virtual ~ProfileInfoInterface() {}
     84 };
     85 
     86 #endif  // CHROME_BROWSER_PROFILES_PROFILE_INFO_INTERFACE_H_
     87