summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/profiles/profile_list_chromeos.h
blob: e7854eb9093dc98c63220da51f85b79447190a7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright 2013 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_CHROMEOS_PROFILES_PROFILE_LIST_CHROMEOS_H_
#define CHROME_BROWSER_CHROMEOS_PROFILES_PROFILE_LIST_CHROMEOS_H_

#include "chrome/browser/profiles/profile_list.h"

#include <stddef.h>

#include <vector>

#include "base/macros.h"

class ProfileInfoInterface;

namespace chromeos {

// This model represents profiles corresponding to logged-in ChromeOS users.
class ProfileListChromeOS : public ProfileList {
 public:
  explicit ProfileListChromeOS(ProfileInfoInterface* profile_cache);
  ~ProfileListChromeOS() override;

  // ProfileList overrides:
  size_t GetNumberOfItems() const override;
  const AvatarMenu::Item& GetItemAt(size_t index) const override;
  void RebuildMenu() override;
  size_t MenuIndexFromProfileIndex(size_t index) override;
  void ActiveProfilePathChanged(base::FilePath& path) override;

 private:
  void ClearMenu();
  void SortMenu();

  // The cache that provides the profile information. Weak.
  ProfileInfoInterface* profile_info_;

  // The path of the currently active profile.
  base::FilePath active_profile_path_;

  // List of built "menu items."
  std::vector<AvatarMenu::Item*> items_;

  DISALLOW_COPY_AND_ASSIGN(ProfileListChromeOS);
};

}  // namespace chromeos

#endif  // CHROME_BROWSER_CHROMEOS_PROFILES_PROFILE_LIST_CHROMEOS_H_