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 ChromeLauncherAppMenuItems | |
34 ArcAppWindowLauncherItemController::GetApplicationList(int event_flags) { | |
35 ChromeLauncherAppMenuItems items = | |
36 AppWindowLauncherItemController::GetApplicationList(event_flags); | |
37 int index = 0; | |
38 for (WindowList::const_iterator iter = windows().begin(); | |
39 iter != windows().end(); ++iter) { | |
xiyuan
2016/03/23 23:22:53
nit: range loop?
khmel
2016/03/24 16:30:38
Done.
| |
40 // TODO(khmel): resolve correct icon here. | |
41 gfx::Image image; | |
42 items.push_back(new ChromeLauncherAppMenuItemV2App( | |
43 GetTitle(), &image, app_id(), launcher_controller(), index, | |
44 index == 0 /* has_leading_separator */)); | |
45 ++index; | |
46 } | |
47 return items; | |
48 } | |
OLD | NEW |