| 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 <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 const app_list::AppListSyncableService::SyncItem* sync_item, | 40 const app_list::AppListSyncableService::SyncItem* sync_item, |
| 41 const std::string& extension_id, | 41 const std::string& extension_id, |
| 42 const std::string& extension_name, | 42 const std::string& extension_name, |
| 43 const gfx::ImageSkia& installing_icon, | 43 const gfx::ImageSkia& installing_icon, |
| 44 bool is_platform_app); | 44 bool is_platform_app); |
| 45 ~ExtensionAppItem() override; | 45 ~ExtensionAppItem() override; |
| 46 | 46 |
| 47 // Reload the title and icon from the underlying extension. | 47 // Reload the title and icon from the underlying extension. |
| 48 void Reload(); | 48 void Reload(); |
| 49 | 49 |
| 50 // Updates the app item's icon, if necessary adding an overlay and/or making | 50 // Updates the app item's icon, if necessary making it gray. |
| 51 // it gray. | |
| 52 void UpdateIcon(); | 51 void UpdateIcon(); |
| 53 | 52 |
| 54 // Update page and app launcher ordinals to put the app in between |prev| and | 53 // Update page and app launcher ordinals to put the app in between |prev| and |
| 55 // |next|. Note that |prev| and |next| could be NULL when the app is put at | 54 // |next|. Note that |prev| and |next| could be NULL when the app is put at |
| 56 // the beginning or at the end. | 55 // the beginning or at the end. |
| 57 void Move(const ExtensionAppItem* prev, const ExtensionAppItem* next); | 56 void Move(const ExtensionAppItem* prev, const ExtensionAppItem* next); |
| 58 | 57 |
| 59 const std::string& extension_id() const { return id(); } | 58 const std::string& extension_id() const { return id(); } |
| 60 const std::string& extension_name() const { return extension_name_; } | 59 const std::string& extension_name() const { return extension_name_; } |
| 61 | 60 |
| 62 private: | 61 private: |
| 63 // Gets extension associated with this model. Returns NULL if extension | 62 // Gets extension associated with this model. Returns NULL if extension |
| 64 // no longer exists. | 63 // no longer exists. |
| 65 const extensions::Extension* GetExtension() const; | 64 const extensions::Extension* GetExtension() const; |
| 66 | 65 |
| 67 // Loads extension icon. | 66 // Loads extension icon. |
| 68 void LoadImage(const extensions::Extension* extension); | 67 void LoadImage(const extensions::Extension* extension); |
| 69 | 68 |
| 70 // Checks if extension is disabled and if enable flow should be started. | 69 // Checks if extension is disabled and if enable flow should be started. |
| 71 // Returns true if extension enable flow is started or there is already one | 70 // Returns true if extension enable flow is started or there is already one |
| 72 // running. | 71 // running. |
| 73 bool RunExtensionEnableFlow(); | 72 bool RunExtensionEnableFlow(); |
| 74 | 73 |
| 75 // Private equivalent to Activate(), without refocus for already-running apps. | 74 // Private equivalent to Activate(), without refocus for already-running apps. |
| 76 void Launch(int event_flags); | 75 void Launch(int event_flags); |
| 77 | 76 |
| 78 // Whether or not the app item needs an overlay. | |
| 79 bool NeedsOverlay() const; | |
| 80 | |
| 81 // Overridden from extensions::IconImage::Observer: | 77 // Overridden from extensions::IconImage::Observer: |
| 82 void OnExtensionIconImageChanged(extensions::IconImage* image) override; | 78 void OnExtensionIconImageChanged(extensions::IconImage* image) override; |
| 83 void OnExtensionIconImageDestroyed(extensions::IconImage* image) override; | 79 void OnExtensionIconImageDestroyed(extensions::IconImage* image) override; |
| 84 | 80 |
| 85 // Overridden from ExtensionEnableFlowDelegate: | 81 // Overridden from ExtensionEnableFlowDelegate: |
| 86 void ExtensionEnableFlowFinished() override; | 82 void ExtensionEnableFlowFinished() override; |
| 87 void ExtensionEnableFlowAborted(bool user_initiated) override; | 83 void ExtensionEnableFlowAborted(bool user_initiated) override; |
| 88 | 84 |
| 89 // Overridden from AppListItem: | 85 // Overridden from AppListItem: |
| 90 void Activate(int event_flags) override; | 86 void Activate(int event_flags) override; |
| 91 ui::MenuModel* GetContextMenuModel() override; | 87 ui::MenuModel* GetContextMenuModel() override; |
| 92 // Updates the icon if the overlay needs to be added/removed. | |
| 93 void OnExtensionPreferenceChanged() override; | |
| 94 const char* GetItemType() const override; | 88 const char* GetItemType() const override; |
| 95 | 89 |
| 96 // Overridden from app_list::AppContextMenuDelegate: | 90 // Overridden from app_list::AppContextMenuDelegate: |
| 97 void ExecuteLaunchCommand(int event_flags) override; | 91 void ExecuteLaunchCommand(int event_flags) override; |
| 98 | 92 |
| 99 std::unique_ptr<extensions::IconImage> icon_; | 93 std::unique_ptr<extensions::IconImage> icon_; |
| 100 std::unique_ptr<app_list::ExtensionAppContextMenu> context_menu_; | 94 std::unique_ptr<app_list::ExtensionAppContextMenu> context_menu_; |
| 101 std::unique_ptr<ExtensionEnableFlow> extension_enable_flow_; | 95 std::unique_ptr<ExtensionEnableFlow> extension_enable_flow_; |
| 102 AppListControllerDelegate* extension_enable_flow_controller_; | 96 AppListControllerDelegate* extension_enable_flow_controller_; |
| 103 | 97 |
| 104 // Name to use for the extension if we can't access it. | 98 // Name to use for the extension if we can't access it. |
| 105 std::string extension_name_; | 99 std::string extension_name_; |
| 106 | 100 |
| 107 // Icon for the extension if we can't access the installed extension. | 101 // Icon for the extension if we can't access the installed extension. |
| 108 gfx::ImageSkia installing_icon_; | 102 gfx::ImageSkia installing_icon_; |
| 109 | 103 |
| 110 // Whether or not this app is a platform app. | 104 // Whether or not this app is a platform app. |
| 111 bool is_platform_app_; | 105 bool is_platform_app_; |
| 112 | 106 |
| 113 // Whether this app item has an overlay. | |
| 114 bool has_overlay_; | |
| 115 | |
| 116 DISALLOW_COPY_AND_ASSIGN(ExtensionAppItem); | 107 DISALLOW_COPY_AND_ASSIGN(ExtensionAppItem); |
| 117 }; | 108 }; |
| 118 | 109 |
| 119 #endif // CHROME_BROWSER_UI_APP_LIST_EXTENSION_APP_ITEM_H_ | 110 #endif // CHROME_BROWSER_UI_APP_LIST_EXTENSION_APP_ITEM_H_ |
| OLD | NEW |