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

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

Issue 2484413002: Enhance chrome.app.window API with title property
Patch Set: Rebase Created 4 years, 1 month 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/chrome_launcher_controller_impl.cc
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc
index adab8a8350f032c538d6c6183b9f0339322fd9be..98c499af135944b545f8da7c5643912eeef4893e 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc
@@ -335,8 +335,9 @@ void ChromeLauncherControllerImpl::CloseLauncherItem(ash::ShelfID id) {
SetItemStatus(id, ash::STATUS_CLOSED);
std::string app_id = iter->second->app_id();
std::string launch_id = iter->second->launch_id();
- iter->second =
- AppShortcutLauncherItemController::Create(app_id, launch_id, this);
+ std::string title = iter->second->title();
+ iter->second = AppShortcutLauncherItemController::Create(app_id, launch_id,
+ title, this);
iter->second->set_shelf_id(id);
// Existing controller is destroyed and replaced by registering again.
SetShelfItemDelegate(id, iter->second);
@@ -421,7 +422,7 @@ void ChromeLauncherControllerImpl::LockV1AppWithID(const std::string& app_id) {
ash::ShelfID id = GetShelfIDForAppID(app_id);
if (!IsPinned(id) && !IsWindowedAppInLauncher(app_id)) {
CreateAppShortcutLauncherItemWithType(ash::launcher::AppLauncherId(app_id),
- model_->item_count(),
+ "", model_->item_count(),
ash::TYPE_WINDOWED_APP);
id = GetShelfIDForAppID(app_id);
}
@@ -484,7 +485,7 @@ void ChromeLauncherControllerImpl::ActivateApp(const std::string& app_id,
// Create a temporary application launcher item and use it to see if there are
// running instances.
std::unique_ptr<AppShortcutLauncherItemController> app_controller(
- AppShortcutLauncherItemController::Create(app_id, "", this));
+ AppShortcutLauncherItemController::Create(app_id, "", "", this));
if (!app_controller->GetRunningApplications().empty())
app_controller->Activate(source);
else
@@ -844,6 +845,12 @@ const std::string& ChromeLauncherControllerImpl::GetLaunchIDForShelfID(
return controller ? controller->launch_id() : base::EmptyString();
}
+const std::string& ChromeLauncherControllerImpl::GetTitleForShelfID(
+ ash::ShelfID id) {
+ LauncherItemController* controller = GetLauncherItemController(id);
+ return controller ? controller->title() : base::EmptyString();
+}
+
void ChromeLauncherControllerImpl::AttachProfile(Profile* profile_to_attach) {
// The base class implementation updates the helper and app icon loaders.
ChromeLauncherController::AttachProfile(profile_to_attach);
@@ -1018,8 +1025,9 @@ void ChromeLauncherControllerImpl::OnAppUninstalledPrepared(
ash::ShelfID ChromeLauncherControllerImpl::CreateAppShortcutLauncherItem(
const ash::launcher::AppLauncherId& app_launcher_id,
+ const std::string& title,
int index) {
- return CreateAppShortcutLauncherItemWithType(app_launcher_id, index,
+ return CreateAppShortcutLauncherItemWithType(app_launcher_id, title, index,
ash::TYPE_APP_SHORTCUT);
}
@@ -1066,11 +1074,12 @@ void ChromeLauncherControllerImpl::RestoreUnpinnedRunningApplicationOrder(
ash::ShelfID
ChromeLauncherControllerImpl::CreateAppShortcutLauncherItemWithType(
const ash::launcher::AppLauncherId& app_launcher_id,
+ const std::string& title,
int index,
ash::ShelfItemType shelf_item_type) {
AppShortcutLauncherItemController* controller =
AppShortcutLauncherItemController::Create(
- app_launcher_id.app_id(), app_launcher_id.launch_id(), this);
+ app_launcher_id.app_id(), app_launcher_id.launch_id(), title, this);
ash::ShelfID shelf_id =
InsertAppLauncherItem(controller, app_launcher_id.app_id(),
ash::STATUS_CLOSED, index, shelf_item_type);
@@ -1105,7 +1114,7 @@ void ChromeLauncherControllerImpl::DoPinAppWithID(const std::string& app_id) {
} else {
// Otherwise, create a shortcut item for it.
shelf_id = CreateAppShortcutLauncherItem(
- ash::launcher::AppLauncherId(app_id), model_->item_count());
+ ash::launcher::AppLauncherId(app_id), "", model_->item_count());
SyncPinPosition(shelf_id);
}
}
@@ -1266,7 +1275,7 @@ void ChromeLauncherControllerImpl::UpdateAppLaunchersFromPref() {
} else {
// This is fresh pin. Create new one.
DCHECK_NE(app_id, extension_misc::kChromeAppId);
- CreateAppShortcutLauncherItem(pref_app_launcher_id, index);
+ CreateAppShortcutLauncherItem(pref_app_launcher_id, "", index);
}
++index;
}

Powered by Google App Engine
This is Rietveld 408576698