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& app_id, | 14 const std::string& app_id, |
15 ChromeLauncherController* controller) | 15 ChromeLauncherController* controller) |
16 : AppWindowLauncherItemController(TYPE_APP, app_id, app_id, controller) {} | 16 : AppWindowLauncherItemController(TYPE_APP, app_id, app_id, controller) {} |
17 | 17 |
18 ArcAppWindowLauncherItemController::~ArcAppWindowLauncherItemController() {} | 18 ArcAppWindowLauncherItemController::~ArcAppWindowLauncherItemController() {} |
19 | 19 |
20 base::string16 ArcAppWindowLauncherItemController::GetTitle() { | 20 base::string16 ArcAppWindowLauncherItemController::GetTitle() { |
21 ArcAppListPrefs* arc_prefs = | 21 ArcAppListPrefs* arc_prefs = |
22 ArcAppListPrefs::Get(launcher_controller()->profile()); | 22 ArcAppListPrefs::Get(launcher_controller()->profile()); |
23 DCHECK(arc_prefs); | 23 DCHECK(arc_prefs); |
24 scoped_ptr<ArcAppListPrefs::AppInfo> app_info = arc_prefs->GetApp(app_id()); | 24 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = |
| 25 arc_prefs->GetApp(app_id()); |
25 if (!app_info) { | 26 if (!app_info) { |
26 NOTREACHED(); | 27 NOTREACHED(); |
27 return base::string16(); | 28 return base::string16(); |
28 } | 29 } |
29 | 30 |
30 return base::UTF8ToUTF16(app_info->name); | 31 return base::UTF8ToUTF16(app_info->name); |
31 } | 32 } |
32 | 33 |
33 ash::ShelfMenuModel* ArcAppWindowLauncherItemController::CreateApplicationMenu( | 34 ash::ShelfMenuModel* ArcAppWindowLauncherItemController::CreateApplicationMenu( |
34 int event_flags) { | 35 int event_flags) { |
35 return nullptr; | 36 return nullptr; |
36 } | 37 } |
37 | 38 |
38 ChromeLauncherAppMenuItems | 39 ChromeLauncherAppMenuItems |
39 ArcAppWindowLauncherItemController::GetApplicationList(int event_flags) { | 40 ArcAppWindowLauncherItemController::GetApplicationList(int event_flags) { |
40 ChromeLauncherAppMenuItems items = | 41 ChromeLauncherAppMenuItems items = |
41 AppWindowLauncherItemController::GetApplicationList(event_flags); | 42 AppWindowLauncherItemController::GetApplicationList(event_flags); |
42 for (size_t i = 0; i < windows().size(); ++i) { | 43 for (size_t i = 0; i < windows().size(); ++i) { |
43 // TODO(khmel): resolve correct icon here. | 44 // TODO(khmel): resolve correct icon here. |
44 gfx::Image image; | 45 gfx::Image image; |
45 items.push_back(new ChromeLauncherAppMenuItemV2App( | 46 items.push_back(new ChromeLauncherAppMenuItemV2App( |
46 GetTitle(), &image, app_id(), launcher_controller(), i, | 47 GetTitle(), &image, app_id(), launcher_controller(), i, |
47 i == 0 /* has_leading_separator */)); | 48 i == 0 /* has_leading_separator */)); |
48 } | 49 } |
49 return items; | 50 return items; |
50 } | 51 } |
OLD | NEW |