OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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/ash/launcher/arc_app_window_launcher_item_controller
.h" |
| 6 |
| 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
| 10 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_v2app.h" |
| 11 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 12 |
| 13 ArcAppWindowLauncherItemController::ArcAppWindowLauncherItemController( |
| 14 const std::string& app_id, |
| 15 ChromeLauncherController* controller) |
| 16 : AppWindowLauncherItemController(TYPE_APP, app_id, app_id, controller) {} |
| 17 |
| 18 ArcAppWindowLauncherItemController::~ArcAppWindowLauncherItemController() {} |
| 19 |
| 20 base::string16 ArcAppWindowLauncherItemController::GetTitle() { |
| 21 ArcAppListPrefs* arc_prefs = |
| 22 ArcAppListPrefs::Get(launcher_controller()->profile()); |
| 23 DCHECK(arc_prefs); |
| 24 scoped_ptr<ArcAppListPrefs::AppInfo> app_info = arc_prefs->GetApp(app_id()); |
| 25 if (!app_info) { |
| 26 NOTREACHED(); |
| 27 return base::string16(); |
| 28 } |
| 29 |
| 30 return base::UTF8ToUTF16(app_info->name); |
| 31 } |
| 32 |
| 33 ash::ShelfMenuModel* ArcAppWindowLauncherItemController::CreateApplicationMenu( |
| 34 int event_flags) { |
| 35 return nullptr; |
| 36 } |
| 37 |
| 38 ChromeLauncherAppMenuItems |
| 39 ArcAppWindowLauncherItemController::GetApplicationList(int event_flags) { |
| 40 ChromeLauncherAppMenuItems items = |
| 41 AppWindowLauncherItemController::GetApplicationList(event_flags); |
| 42 for (size_t i = 0; i < windows().size(); ++i) { |
| 43 // TODO(khmel): resolve correct icon here. |
| 44 gfx::Image image; |
| 45 items.push_back(new ChromeLauncherAppMenuItemV2App( |
| 46 GetTitle(), &image, app_id(), launcher_controller(), i, |
| 47 i == 0 /* has_leading_separator */)); |
| 48 } |
| 49 return items; |
| 50 } |
OLD | NEW |