OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/ui/app_list/chrome_app_list_item.h" |
| 6 |
| 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/ui/app_list/app_list_service.h" |
| 9 #include "chrome/browser/ui/host_desktop.h" |
| 10 #include "extensions/browser/app_sorting.h" |
| 11 #include "extensions/browser/extension_system.h" |
| 12 #include "ui/gfx/color_utils.h" |
| 13 #include "ui/gfx/image/image_skia_operations.h" |
| 14 |
| 15 // static |
| 16 gfx::ImageSkia ChromeAppListItem::CreateDisabledIcon( |
| 17 const gfx::ImageSkia& icon) { |
| 18 const color_utils::HSL shift = {-1, 0, 0.6}; |
| 19 return gfx::ImageSkiaOperations::CreateHSLShiftedImage(icon, shift); |
| 20 } |
| 21 |
| 22 ChromeAppListItem::ChromeAppListItem(Profile* profile, |
| 23 const std::string& app_id) |
| 24 : app_list::AppListItem(app_id), |
| 25 profile_(profile) { |
| 26 } |
| 27 |
| 28 ChromeAppListItem::~ChromeAppListItem() { |
| 29 } |
| 30 |
| 31 extensions::AppSorting* ChromeAppListItem::GetAppSorting() { |
| 32 return extensions::ExtensionSystem::Get(profile())->app_sorting(); |
| 33 } |
| 34 |
| 35 void ChromeAppListItem::UpdateFromSync( |
| 36 const app_list::AppListSyncableService::SyncItem* sync_item) { |
| 37 DCHECK(sync_item && sync_item->item_ordinal.IsValid()); |
| 38 // An existing synced position exists, use that. |
| 39 set_position(sync_item->item_ordinal); |
| 40 // Only set the name from the sync item if it is empty. |
| 41 if (name().empty()) |
| 42 SetName(sync_item->item_name); |
| 43 } |
| 44 |
| 45 AppListControllerDelegate* ChromeAppListItem::GetController() { |
| 46 return AppListService::Get(chrome::GetActiveDesktop())-> |
| 47 GetControllerDelegate(); |
| 48 } |
OLD | NEW |