Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(435)

Unified Diff: chrome/browser/ui/ash/launcher/arc_app_window_launcher_item_controller.cc

Issue 2627533002: Replace ShelfItemDelegate::GetTitle() with ShelfItem::title. (Closed)
Patch Set: Address comments. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
index 88cf6a5018b8190b8b4e83fd71ae4c495996c62f..6e3d940824baab352bf267540a2cbfa0616641cc 100644
--- 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
@@ -13,6 +13,7 @@
#include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_v2app.h"
#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
#include "chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h"
+#include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h"
#include "ui/aura/window.h"
#include "ui/base/base_window.h"
@@ -49,20 +50,6 @@ ArcAppWindowLauncherItemController::ItemSelected(const ui::Event& event) {
}
}
-base::string16 ArcAppWindowLauncherItemController::GetTitle() {
- ArcAppListPrefs* arc_prefs =
- ArcAppListPrefs::Get(launcher_controller()->profile());
- DCHECK(arc_prefs);
- std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = arc_prefs->GetApp(
- ArcAppWindowLauncherController::GetArcAppIdFromShelfAppId(app_id()));
- if (!app_info) {
- NOTREACHED();
- return base::string16();
- }
-
- return base::UTF8ToUTF16(app_info->name);
-}
-
ash::ShelfMenuModel* ArcAppWindowLauncherItemController::CreateApplicationMenu(
int event_flags) {
return new LauncherApplicationMenuItemModel(GetApplicationList(event_flags));
@@ -72,6 +59,8 @@ ChromeLauncherAppMenuItems
ArcAppWindowLauncherItemController::GetApplicationList(int event_flags) {
ChromeLauncherAppMenuItems items =
AppWindowLauncherItemController::GetApplicationList(event_flags);
+ base::string16 app_title = LauncherControllerHelper::GetAppTitle(
+ launcher_controller()->profile(), app_id());
for (auto it = windows().begin(); it != windows().end(); ++it) {
// TODO(khmel): resolve correct icon here.
size_t i = std::distance(windows().begin(), it);
@@ -79,7 +68,7 @@ ArcAppWindowLauncherItemController::GetApplicationList(int event_flags) {
aura::Window* window = (*it)->GetNativeWindow();
items.push_back(base::MakeUnique<ChromeLauncherAppMenuItemV2App>(
((window && !window->GetTitle().empty()) ? window->GetTitle()
- : GetTitle()),
+ : app_title),
&image, app_id(), launcher_controller(), i,
i == 0 /* has_leading_separator */));
}

Powered by Google App Engine
This is Rietveld 408576698