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