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 #include "chrome/browser/ui/app_list/chrome_app_list_item.h" | 5 #include "chrome/browser/ui/app_list/chrome_app_list_item.h" |
6 | 6 |
7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/browser/ui/app_list/app_list_service.h" | 8 #include "chrome/browser/ui/app_list/app_list_service.h" |
9 #include "chrome/browser/ui/host_desktop.h" | 9 #include "chrome/browser/ui/host_desktop.h" |
10 #include "extensions/browser/app_sorting.h" | 10 #include "extensions/browser/app_sorting.h" |
11 #include "extensions/browser/extension_system.h" | 11 #include "extensions/browser/extension_system.h" |
12 #include "ui/gfx/color_utils.h" | 12 #include "ui/gfx/color_utils.h" |
13 #include "ui/gfx/image/image_skia_operations.h" | 13 #include "ui/gfx/image/image_skia_operations.h" |
14 | 14 |
| 15 namespace { |
| 16 |
| 17 AppListControllerDelegate* g_controller_for_test = nullptr; |
| 18 |
| 19 } // namespace |
| 20 |
| 21 // static |
| 22 void ChromeAppListItem::OverrideAppListControllerDelegateForTesting( |
| 23 AppListControllerDelegate* controller) { |
| 24 g_controller_for_test = controller; |
| 25 } |
| 26 |
15 // static | 27 // static |
16 gfx::ImageSkia ChromeAppListItem::CreateDisabledIcon( | 28 gfx::ImageSkia ChromeAppListItem::CreateDisabledIcon( |
17 const gfx::ImageSkia& icon) { | 29 const gfx::ImageSkia& icon) { |
18 const color_utils::HSL shift = {-1, 0, 0.6}; | 30 const color_utils::HSL shift = {-1, 0, 0.6}; |
19 return gfx::ImageSkiaOperations::CreateHSLShiftedImage(icon, shift); | 31 return gfx::ImageSkiaOperations::CreateHSLShiftedImage(icon, shift); |
20 } | 32 } |
21 | 33 |
22 ChromeAppListItem::ChromeAppListItem(Profile* profile, | 34 ChromeAppListItem::ChromeAppListItem(Profile* profile, |
23 const std::string& app_id) | 35 const std::string& app_id) |
24 : app_list::AppListItem(app_id), | 36 : app_list::AppListItem(app_id), |
(...skipping 24 matching lines...) Expand all Loading... |
49 void ChromeAppListItem::UpdatePositionFromOrdering() { | 61 void ChromeAppListItem::UpdatePositionFromOrdering() { |
50 const syncer::StringOrdinal& page = | 62 const syncer::StringOrdinal& page = |
51 GetAppSorting()->GetPageOrdinal(id()); | 63 GetAppSorting()->GetPageOrdinal(id()); |
52 const syncer::StringOrdinal& launch = | 64 const syncer::StringOrdinal& launch = |
53 GetAppSorting()->GetAppLaunchOrdinal(id()); | 65 GetAppSorting()->GetAppLaunchOrdinal(id()); |
54 set_position(syncer::StringOrdinal( | 66 set_position(syncer::StringOrdinal( |
55 page.ToInternalValue() + launch.ToInternalValue())); | 67 page.ToInternalValue() + launch.ToInternalValue())); |
56 } | 68 } |
57 | 69 |
58 AppListControllerDelegate* ChromeAppListItem::GetController() { | 70 AppListControllerDelegate* ChromeAppListItem::GetController() { |
59 return AppListService::Get(chrome::GetActiveDesktop())-> | 71 return g_controller_for_test != nullptr ? |
60 GetControllerDelegate(); | 72 g_controller_for_test : |
| 73 AppListService::Get(chrome::GetActiveDesktop())->GetControllerDelegate(); |
61 } | 74 } |
OLD | NEW |