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