Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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_UI_VIEWS_AURA_APP_LIST_EXTENSION_ITEM_H_ | |
| 6 #define CHROME_BROWSER_UI_VIEWS_AURA_APP_LIST_EXTENSION_ITEM_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "chrome/browser/extensions/image_loading_tracker.h" | |
| 11 #include "chrome/browser/ui/views/aura/app_list/chrome_app_list_item.h" | |
| 12 #include "chrome/common/string_ordinal.h" | |
| 13 | |
| 14 class Extension; | |
| 15 class ExtensionResource; | |
| 16 class Profile; | |
| 17 class SkBitmap; | |
| 18 | |
| 19 // ExtensionItem represents an extension app in app list. | |
| 20 class ExtensionItem : public ChromeAppListItem, | |
|
Ben Goodger (Google)
2011/12/20 19:07:18
ExtensionAppItem then?
xiyuan
2011/12/20 21:55:50
Done.
| |
| 21 public ImageLoadingTracker::Observer { | |
| 22 public: | |
| 23 ExtensionItem(Profile* profile, const Extension* extension); | |
| 24 virtual ~ExtensionItem(); | |
| 25 | |
| 26 // Gets extension associated with this model. Returns NULL if extension | |
| 27 // no longer exists. | |
| 28 const Extension* GetExtension() const; | |
| 29 | |
| 30 int page_index() const { | |
| 31 return page_index_; | |
| 32 } | |
| 33 | |
| 34 const StringOrdinal& launch_ordinal() const { | |
| 35 return launch_ordinal_; | |
| 36 } | |
| 37 | |
| 38 private: | |
| 39 // Loads extension icon. | |
| 40 void LoadImage(const Extension* extension); | |
| 41 | |
| 42 // Loads default extension icon. | |
| 43 void LoadDefaultImage(); | |
| 44 | |
| 45 // Overridden from ChromeAppListItem: | |
| 46 virtual void Activate(int event_flags) OVERRIDE; | |
| 47 | |
| 48 // Overridden from ImageLoadingTracker::Observer | |
| 49 virtual void OnImageLoaded(SkBitmap* image, | |
| 50 const ExtensionResource& resource, | |
| 51 int tracker_index) OVERRIDE; | |
| 52 | |
| 53 Profile* profile_; | |
| 54 const std::string extension_id_; | |
| 55 | |
| 56 const int page_index_; | |
| 57 const StringOrdinal launch_ordinal_; | |
| 58 | |
| 59 scoped_ptr<ImageLoadingTracker> tracker_; | |
| 60 | |
| 61 DISALLOW_COPY_AND_ASSIGN(ExtensionItem); | |
| 62 }; | |
| 63 | |
| 64 #endif // CHROME_BROWSER_UI_VIEWS_AURA_APP_LIST_EXTENSION_ITEM_H_ | |
| OLD | NEW |