Chromium Code Reviews| Index: chrome/browser/ui/views/aura/app_list/extension_item.h |
| diff --git a/chrome/browser/ui/views/aura/app_list/extension_item.h b/chrome/browser/ui/views/aura/app_list/extension_item.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5545f57471da29b9a63db39677779e28c3ffc98d |
| --- /dev/null |
| +++ b/chrome/browser/ui/views/aura/app_list/extension_item.h |
| @@ -0,0 +1,64 @@ |
| +// 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 CHROME_BROWSER_UI_VIEWS_AURA_APP_LIST_EXTENSION_ITEM_H_ |
| +#define CHROME_BROWSER_UI_VIEWS_AURA_APP_LIST_EXTENSION_ITEM_H_ |
| +#pragma once |
| + |
| +#include "base/memory/scoped_ptr.h" |
| +#include "chrome/browser/extensions/image_loading_tracker.h" |
| +#include "chrome/browser/ui/views/aura/app_list/chrome_app_list_item.h" |
| +#include "chrome/common/string_ordinal.h" |
| + |
| +class Extension; |
| +class ExtensionResource; |
| +class Profile; |
| +class SkBitmap; |
| + |
| +// ExtensionItem represents an extension app in app list. |
| +class ExtensionItem : public ChromeAppListItem, |
|
Ben Goodger (Google)
2011/12/20 19:07:18
ExtensionAppItem then?
xiyuan
2011/12/20 21:55:50
Done.
|
| + public ImageLoadingTracker::Observer { |
| + public: |
| + ExtensionItem(Profile* profile, const Extension* extension); |
| + virtual ~ExtensionItem(); |
| + |
| + // Gets extension associated with this model. Returns NULL if extension |
| + // no longer exists. |
| + const Extension* GetExtension() const; |
| + |
| + int page_index() const { |
| + return page_index_; |
| + } |
| + |
| + const StringOrdinal& launch_ordinal() const { |
| + return launch_ordinal_; |
| + } |
| + |
| + private: |
| + // Loads extension icon. |
| + void LoadImage(const Extension* extension); |
| + |
| + // Loads default extension icon. |
| + void LoadDefaultImage(); |
| + |
| + // Overridden from ChromeAppListItem: |
| + virtual void Activate(int event_flags) OVERRIDE; |
| + |
| + // Overridden from ImageLoadingTracker::Observer |
| + virtual void OnImageLoaded(SkBitmap* image, |
| + const ExtensionResource& resource, |
| + int tracker_index) OVERRIDE; |
| + |
| + Profile* profile_; |
| + const std::string extension_id_; |
| + |
| + const int page_index_; |
| + const StringOrdinal launch_ordinal_; |
| + |
| + scoped_ptr<ImageLoadingTracker> tracker_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ExtensionItem); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_UI_VIEWS_AURA_APP_LIST_EXTENSION_ITEM_H_ |