| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_APP_LIST_EXTENSION_APP_ITEM_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_LIST_EXTENSION_APP_ITEM_H_ |
| 6 #define CHROME_BROWSER_UI_APP_LIST_EXTENSION_APP_ITEM_H_ | 6 #define CHROME_BROWSER_UI_APP_LIST_EXTENSION_APP_ITEM_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "chrome/browser/extensions/extension_icon_image.h" | 11 #include "chrome/browser/extensions/extension_icon_image.h" |
| 12 #include "chrome/browser/ui/app_list/chrome_app_list_item.h" | 12 #include "chrome/browser/ui/app_list/chrome_app_list_item.h" |
| 13 #include "sync/api/string_ordinal.h" |
| 13 #include "ui/base/models/simple_menu_model.h" | 14 #include "ui/base/models/simple_menu_model.h" |
| 14 | 15 |
| 15 class AppListController; | 16 class AppListController; |
| 16 class ExtensionResource; | 17 class ExtensionResource; |
| 17 class Profile; | 18 class Profile; |
| 18 class SkBitmap; | 19 class SkBitmap; |
| 19 | 20 |
| 20 namespace extensions { | 21 namespace extensions { |
| 21 class Extension; | 22 class Extension; |
| 22 } | 23 } |
| 23 | 24 |
| 24 // ExtensionAppItem represents an extension app in app list. | 25 // ExtensionAppItem represents an extension app in app list. |
| 25 class ExtensionAppItem : public ChromeAppListItem, | 26 class ExtensionAppItem : public ChromeAppListItem, |
| 26 public extensions::IconImage::Observer, | 27 public extensions::IconImage::Observer, |
| 27 public ui::SimpleMenuModel::Delegate { | 28 public ui::SimpleMenuModel::Delegate { |
| 28 public: | 29 public: |
| 29 ExtensionAppItem(Profile* profile, | 30 ExtensionAppItem(Profile* profile, |
| 30 const extensions::Extension* extension, | 31 const extensions::Extension* extension, |
| 31 AppListController* controller); | 32 AppListController* controller); |
| 32 virtual ~ExtensionAppItem(); | 33 virtual ~ExtensionAppItem(); |
| 33 | 34 |
| 34 // Gets extension associated with this model. Returns NULL if extension | 35 // Gets extension associated with this model. Returns NULL if extension |
| 35 // no longer exists. | 36 // no longer exists. |
| 36 const extensions::Extension* GetExtension() const; | 37 const extensions::Extension* GetExtension() const; |
| 37 | 38 |
| 38 const std::string& extension_id() const { | 39 syncer::StringOrdinal GetPageOrdinal() const; |
| 39 return extension_id_; | 40 syncer::StringOrdinal GetAppLaunchOrdinal() const; |
| 40 } | 41 |
| 42 const std::string& extension_id() const { return extension_id_; } |
| 41 | 43 |
| 42 private: | 44 private: |
| 43 // Returns true if this item represents a version of the Talk extension. | 45 // Returns true if this item represents a version of the Talk extension. |
| 44 bool IsTalkExtension() const; | 46 bool IsTalkExtension() const; |
| 45 | 47 |
| 46 // Loads extension icon. | 48 // Loads extension icon. |
| 47 void LoadImage(const extensions::Extension* extension); | 49 void LoadImage(const extensions::Extension* extension); |
| 48 | 50 |
| 49 void ShowExtensionOptions(); | 51 void ShowExtensionOptions(); |
| 50 void ShowExtensionDetails(); | 52 void ShowExtensionDetails(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 72 const std::string extension_id_; | 74 const std::string extension_id_; |
| 73 AppListController* controller_; | 75 AppListController* controller_; |
| 74 | 76 |
| 75 scoped_ptr<extensions::IconImage> icon_; | 77 scoped_ptr<extensions::IconImage> icon_; |
| 76 scoped_ptr<ui::SimpleMenuModel> context_menu_model_; | 78 scoped_ptr<ui::SimpleMenuModel> context_menu_model_; |
| 77 | 79 |
| 78 DISALLOW_COPY_AND_ASSIGN(ExtensionAppItem); | 80 DISALLOW_COPY_AND_ASSIGN(ExtensionAppItem); |
| 79 }; | 81 }; |
| 80 | 82 |
| 81 #endif // CHROME_BROWSER_UI_APP_LIST_EXTENSION_APP_ITEM_H_ | 83 #endif // CHROME_BROWSER_UI_APP_LIST_EXTENSION_APP_ITEM_H_ |
| OLD | NEW |