Chromium Code Reviews| Index: chrome/browser/ui/ash/launcher/arc_app_window_launcher_item_controller.cc |
| diff --git a/chrome/browser/ui/ash/launcher/arc_app_window_launcher_item_controller.cc b/chrome/browser/ui/ash/launcher/arc_app_window_launcher_item_controller.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..abd20b94ada9f0a16c09bb584ed19a71c84e9e9f |
| --- /dev/null |
| +++ b/chrome/browser/ui/ash/launcher/arc_app_window_launcher_item_controller.cc |
| @@ -0,0 +1,48 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_item_controller.h" |
| + |
| +#include "base/strings/utf_string_conversions.h" |
| +#include "chrome/browser/profiles/profile.h" |
| +#include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
| +#include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_v2app.h" |
| +#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| + |
| +ArcAppWindowLauncherItemController::ArcAppWindowLauncherItemController( |
| + const std::string& app_id, |
| + ChromeLauncherController* controller) |
| + : AppWindowLauncherItemController(TYPE_APP, app_id, app_id, controller) {} |
| + |
| +ArcAppWindowLauncherItemController::~ArcAppWindowLauncherItemController() {} |
| + |
| +base::string16 ArcAppWindowLauncherItemController::GetTitle() { |
| + ArcAppListPrefs* arc_prefs = |
| + ArcAppListPrefs::Get(launcher_controller()->profile()); |
| + DCHECK(arc_prefs); |
| + scoped_ptr<ArcAppListPrefs::AppInfo> app_info = arc_prefs->GetApp(app_id()); |
| + if (!app_info) { |
| + NOTREACHED(); |
| + return base::string16(); |
| + } |
| + |
| + return base::UTF8ToUTF16(app_info->name); |
| +} |
| + |
| +ChromeLauncherAppMenuItems |
| +ArcAppWindowLauncherItemController::GetApplicationList(int event_flags) { |
| + ChromeLauncherAppMenuItems items = |
| + AppWindowLauncherItemController::GetApplicationList(event_flags); |
| + int index = 0; |
| + for (WindowList::const_iterator iter = windows().begin(); |
| + iter != windows().end(); ++iter) { |
|
xiyuan
2016/03/23 23:22:53
nit: range loop?
khmel
2016/03/24 16:30:38
Done.
|
| + // TODO(khmel): resolve correct icon here. |
| + gfx::Image image; |
| + items.push_back(new ChromeLauncherAppMenuItemV2App( |
| + GetTitle(), &image, app_id(), launcher_controller(), index, |
| + index == 0 /* has_leading_separator */)); |
| + ++index; |
| + } |
| + return items; |
| +} |