| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_CHROME_APP_LIST_ITEM_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_LIST_CHROME_APP_LIST_ITEM_H_ |
| 6 #define CHROME_BROWSER_UI_APP_LIST_CHROME_APP_LIST_ITEM_H_ | 6 #define CHROME_BROWSER_UI_APP_LIST_CHROME_APP_LIST_ITEM_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" | 10 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" |
| 11 #include "ui/app_list/app_list_item.h" | 11 #include "ui/app_list/app_list_item.h" |
| 12 | 12 |
| 13 class AppListControllerDelegate; | 13 class AppListControllerDelegate; |
| 14 class Profile; | 14 class Profile; |
| 15 | 15 |
| 16 namespace extensions { | 16 namespace extensions { |
| 17 class AppSorting; | 17 class AppSorting; |
| 18 } // namespace extensions | 18 } // namespace extensions |
| 19 | 19 |
| 20 namespace gfx { | 20 namespace gfx { |
| 21 class ImageSkia; | 21 class ImageSkia; |
| 22 } // namespace gfx | 22 } // namespace gfx |
| 23 | 23 |
| 24 // Base class of all chrome app list items. | 24 // Base class of all chrome app list items. |
| 25 class ChromeAppListItem : public app_list::AppListItem { | 25 class ChromeAppListItem : public app_list::AppListItem { |
| 26 public: |
| 27 // AppListControllerDelegate is not properly implemented in tests. Use mock |
| 28 // |controller| for unit_tests. |
| 29 static void OverrideAppListControllerDelegateForTesting( |
| 30 AppListControllerDelegate* controller); |
| 31 |
| 26 protected: | 32 protected: |
| 27 ChromeAppListItem(Profile* profile, const std::string& app_id); | 33 ChromeAppListItem(Profile* profile, const std::string& app_id); |
| 28 ~ChromeAppListItem() override; | 34 ~ChromeAppListItem() override; |
| 29 | 35 |
| 30 Profile* profile() const { return profile_; } | 36 Profile* profile() const { return profile_; } |
| 31 | 37 |
| 32 extensions::AppSorting* GetAppSorting(); | 38 extensions::AppSorting* GetAppSorting(); |
| 33 | 39 |
| 34 AppListControllerDelegate* GetController(); | 40 AppListControllerDelegate* GetController(); |
| 35 | 41 |
| 36 // Updates item position and name from |sync_item|. |sync_item| can be nullptr | 42 // Updates item position and name from |sync_item|. |sync_item| can be nullptr |
| 37 // or not valid. In last case position is updated from ordering. | 43 // or not valid. In last case position is updated from ordering. |
| 38 void UpdateFromSync( | 44 void UpdateFromSync( |
| 39 const app_list::AppListSyncableService::SyncItem* sync_item); | 45 const app_list::AppListSyncableService::SyncItem* sync_item); |
| 40 | 46 |
| 41 void UpdatePositionFromOrdering(); | 47 void UpdatePositionFromOrdering(); |
| 42 | 48 |
| 43 static gfx::ImageSkia CreateDisabledIcon(const gfx::ImageSkia& icon); | 49 static gfx::ImageSkia CreateDisabledIcon(const gfx::ImageSkia& icon); |
| 44 | 50 |
| 45 private: | 51 private: |
| 46 Profile* profile_; | 52 Profile* profile_; |
| 47 | 53 |
| 48 DISALLOW_COPY_AND_ASSIGN(ChromeAppListItem); | 54 DISALLOW_COPY_AND_ASSIGN(ChromeAppListItem); |
| 49 }; | 55 }; |
| 50 | 56 |
| 51 #endif // CHROME_BROWSER_UI_APP_LIST_CHROME_APP_LIST_ITEM_H_ | 57 #endif // CHROME_BROWSER_UI_APP_LIST_CHROME_APP_LIST_ITEM_H_ |
| OLD | NEW |