| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/ash/launcher/launcher_item_controller.h" | 5 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 9 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 10 #include "extensions/browser/extension_registry.h" | 10 #include "extensions/browser/extension_registry.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 base::string16 title; | 37 base::string16 title; |
| 38 if (app_id_.empty()) | 38 if (app_id_.empty()) |
| 39 return title; | 39 return title; |
| 40 | 40 |
| 41 #if defined(OS_CHROMEOS) | 41 #if defined(OS_CHROMEOS) |
| 42 // Get title if the app is an Arc app | 42 // Get title if the app is an Arc app |
| 43 ArcAppListPrefs* arc_prefs = | 43 ArcAppListPrefs* arc_prefs = |
| 44 ArcAppListPrefs::Get(launcher_controller_->profile()); | 44 ArcAppListPrefs::Get(launcher_controller_->profile()); |
| 45 DCHECK(arc_prefs); | 45 DCHECK(arc_prefs); |
| 46 if (arc_prefs->IsRegistered(app_id_)) { | 46 if (arc_prefs->IsRegistered(app_id_)) { |
| 47 scoped_ptr<ArcAppListPrefs::AppInfo> app_info = arc_prefs->GetApp(app_id_); | 47 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = |
| 48 arc_prefs->GetApp(app_id_); |
| 48 DCHECK(app_info.get()); | 49 DCHECK(app_info.get()); |
| 49 if (app_info) | 50 if (app_info) |
| 50 title = base::UTF8ToUTF16(app_info->name); | 51 title = base::UTF8ToUTF16(app_info->name); |
| 51 return title; | 52 return title; |
| 52 } | 53 } |
| 53 #endif // defined(OS_CHROMEOS) | 54 #endif // defined(OS_CHROMEOS) |
| 54 | 55 |
| 55 const extensions::Extension* extension = | 56 const extensions::Extension* extension = |
| 56 extensions::ExtensionRegistry::Get( | 57 extensions::ExtensionRegistry::Get( |
| 57 launcher_controller_->profile())->GetExtensionById( | 58 launcher_controller_->profile())->GetExtensionById( |
| 58 app_id_, extensions::ExtensionRegistry::EVERYTHING); | 59 app_id_, extensions::ExtensionRegistry::EVERYTHING); |
| 59 if (extension) | 60 if (extension) |
| 60 title = base::UTF8ToUTF16(extension->name()); | 61 title = base::UTF8ToUTF16(extension->name()); |
| 61 return title; | 62 return title; |
| 62 } | 63 } |
| 63 | 64 |
| 64 ash::ShelfItemType LauncherItemController::GetShelfItemType() const { | 65 ash::ShelfItemType LauncherItemController::GetShelfItemType() const { |
| 65 switch (type_) { | 66 switch (type_) { |
| 66 case LauncherItemController::TYPE_SHORTCUT: | 67 case LauncherItemController::TYPE_SHORTCUT: |
| 67 case LauncherItemController::TYPE_WINDOWED_APP: | 68 case LauncherItemController::TYPE_WINDOWED_APP: |
| 68 return ash::TYPE_APP_SHORTCUT; | 69 return ash::TYPE_APP_SHORTCUT; |
| 69 case LauncherItemController::TYPE_APP: | 70 case LauncherItemController::TYPE_APP: |
| 70 return ash::TYPE_PLATFORM_APP; | 71 return ash::TYPE_PLATFORM_APP; |
| 71 case LauncherItemController::TYPE_APP_PANEL: | 72 case LauncherItemController::TYPE_APP_PANEL: |
| 72 return ash::TYPE_APP_PANEL; | 73 return ash::TYPE_APP_PANEL; |
| 73 } | 74 } |
| 74 NOTREACHED(); | 75 NOTREACHED(); |
| 75 return ash::TYPE_APP_SHORTCUT; | 76 return ash::TYPE_APP_SHORTCUT; |
| 76 } | 77 } |
| OLD | NEW |