1 // Copyright (c) 2012 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.
5 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h"
7 #include "base/basictypes.h"
8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
12 #include "extensions/common/extension.h"
14 LauncherItemController::LauncherItemController(
16 const std::string
& app_id
,
17 ChromeLauncherController
* launcher_controller
)
21 launcher_controller_(launcher_controller
),
23 image_set_by_controller_(false) {
26 LauncherItemController::~LauncherItemController() {
29 const std::string
& LauncherItemController::app_id() const {
33 base::string16
LauncherItemController::GetAppTitle() const {
35 return base::string16();
36 const extensions::Extension
* extension
=
37 launcher_controller_
->profile()->GetExtensionService()->
38 GetInstalledExtension(app_id_
);
39 return extension
? base::UTF8ToUTF16(extension
->name()) : base::string16();
42 ash::LauncherItemType
LauncherItemController::GetLauncherItemType() const {
44 case LauncherItemController::TYPE_SHORTCUT
:
45 case LauncherItemController::TYPE_WINDOWED_APP
:
46 return ash::TYPE_APP_SHORTCUT
;
47 case LauncherItemController::TYPE_APP
:
48 return ash::TYPE_PLATFORM_APP
;
49 case LauncherItemController::TYPE_APP_PANEL
:
50 return ash::TYPE_APP_PANEL
;
53 return ash::TYPE_APP_SHORTCUT
;