summaryrefslogtreecommitdiffstats
path: root/ui/aura_shell/launcher/launcher_model.h
blob: 242129e25ef8935ed74f2303a95353aadc4d75cf (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
52
53
54
// Copyright (c) 2011 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 UI_AURA_SHELL_LAUNCHER_MODEL_H_
#define UI_AURA_SHELL_LAUNCHER_MODEL_H_
#pragma once

#include <vector>

#include "base/observer_list.h"
#include "ui/aura_shell/aura_shell_export.h"
#include "ui/aura_shell/launcher/launcher_types.h"

namespace views {
class View;
}

namespace aura_shell {

class LauncherModelObserver;

// Model used by LauncherView.
class AURA_SHELL_EXPORT LauncherModel {
 public:
  LauncherModel();
  ~LauncherModel();

  // Adds a new item to the model.
  void Add(int index, const LauncherItem& item);

  // Removes the item at |index|.
  void RemoveItemAt(int index);

  // Changes the images of the specified item.
  void SetTabbedImages(int index, const LauncherTabbedImages& images);
  void SetAppImage(int index, const SkBitmap& image);

  const LauncherItems& items() const { return items_; }
  int item_count() const { return static_cast<int>(items_.size()); }

  void AddObserver(LauncherModelObserver* observer);
  void RemoveObserver(LauncherModelObserver* observer);

 private:
  LauncherItems items_;
  ObserverList<LauncherModelObserver> observers_;

  DISALLOW_COPY_AND_ASSIGN(LauncherModel);
};

}  // namespace aura_shell

#endif  // UI_AURA_SHELL_LAUNCHER_MODEL_H_