diff options
author | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-09 04:11:45 +0000 |
---|---|---|
committer | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-09 04:11:45 +0000 |
commit | 0039db9b4f365a4c6b1bbd72b4ca4e2aeb65c354 (patch) | |
tree | 5a50f8caa29ce4038da05b20f18161887c3c8fc3 /ui/app_list/app_list_model.h | |
parent | eb951d02de207130faca3a648d481108c97a8525 (diff) | |
download | chromium_src-0039db9b4f365a4c6b1bbd72b4ca4e2aeb65c354.zip chromium_src-0039db9b4f365a4c6b1bbd72b4ca4e2aeb65c354.tar.gz chromium_src-0039db9b4f365a4c6b1bbd72b4ca4e2aeb65c354.tar.bz2 |
Move app list from ash to ui.
The goal is to make app list an independent component so that it could be reused in elsewhere.
BUG=none.
TEST=none.
Review URL: https://chromiumcodereview.appspot.com/10388032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135981 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/app_list/app_list_model.h')
-rw-r--r-- | ui/app_list/app_list_model.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/ui/app_list/app_list_model.h b/ui/app_list/app_list_model.h new file mode 100644 index 0000000..2424f6e --- /dev/null +++ b/ui/app_list/app_list_model.h @@ -0,0 +1,48 @@ +// Copyright (c) 2012 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_APP_LIST_APP_LIST_MODEL_H_ +#define UI_APP_LIST_APP_LIST_MODEL_H_ +#pragma once + +#include "base/basictypes.h" +#include "ui/app_list/app_list_export.h" +#include "ui/app_list/app_list_item_model.h" +#include "ui/base/models/list_model.h" + +namespace app_list { + +class AppListItemModel; + +// Model for AppListModelView that owns a list of AppListItemModels. +class APP_LIST_EXPORT AppListModel { + public: + AppListModel(); + virtual ~AppListModel(); + + // Adds an item to the model. The model takes ownership of |item|. + void AddItem(AppListItemModel* item); + void AddItemAt(int index, AppListItemModel* item); + + void DeleteItemAt(int index); + + AppListItemModel* GetItem(int index); + + void AddObserver(ui::ListModelObserver* observer); + void RemoveObserver(ui::ListModelObserver* observer); + + int item_count() const { + return items_.item_count(); + } + + private: + typedef ui::ListModel<AppListItemModel> Items; + Items items_; + + DISALLOW_COPY_AND_ASSIGN(AppListModel); +}; + +} // namespace app_list + +#endif // UI_APP_LIST_APP_LIST_MODEL_H_ |