Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1057)

Unified Diff: chrome/browser/ui/app_list/chrome_app_list_item.cc

Issue 1507873006: Implement base class for app_list items. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits addressed Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/app_list/chrome_app_list_item.h ('k') | chrome/browser/ui/app_list/extension_app_item.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/app_list/chrome_app_list_item.cc
diff --git a/chrome/browser/ui/app_list/chrome_app_list_item.cc b/chrome/browser/ui/app_list/chrome_app_list_item.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0c8fbd59d0d6011895de136dcc70359c913f744f
--- /dev/null
+++ b/chrome/browser/ui/app_list/chrome_app_list_item.cc
@@ -0,0 +1,48 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/app_list/chrome_app_list_item.h"
+
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/app_list/app_list_service.h"
+#include "chrome/browser/ui/host_desktop.h"
+#include "extensions/browser/app_sorting.h"
+#include "extensions/browser/extension_system.h"
+#include "ui/gfx/color_utils.h"
+#include "ui/gfx/image/image_skia_operations.h"
+
+// static
+gfx::ImageSkia ChromeAppListItem::CreateDisabledIcon(
+ const gfx::ImageSkia& icon) {
+ const color_utils::HSL shift = {-1, 0, 0.6};
+ return gfx::ImageSkiaOperations::CreateHSLShiftedImage(icon, shift);
+}
+
+ChromeAppListItem::ChromeAppListItem(Profile* profile,
+ const std::string& app_id)
+ : app_list::AppListItem(app_id),
+ profile_(profile) {
+}
+
+ChromeAppListItem::~ChromeAppListItem() {
+}
+
+extensions::AppSorting* ChromeAppListItem::GetAppSorting() {
+ return extensions::ExtensionSystem::Get(profile())->app_sorting();
+}
+
+void ChromeAppListItem::UpdateFromSync(
+ const app_list::AppListSyncableService::SyncItem* sync_item) {
+ DCHECK(sync_item && sync_item->item_ordinal.IsValid());
+ // An existing synced position exists, use that.
+ set_position(sync_item->item_ordinal);
+ // Only set the name from the sync item if it is empty.
+ if (name().empty())
+ SetName(sync_item->item_name);
+}
+
+AppListControllerDelegate* ChromeAppListItem::GetController() {
+ return AppListService::Get(chrome::GetActiveDesktop())->
+ GetControllerDelegate();
+}
« no previous file with comments | « chrome/browser/ui/app_list/chrome_app_list_item.h ('k') | chrome/browser/ui/app_list/extension_app_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698