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 5eaee8fdf60c61d4d1b4ce6f51700dfdd90f9dc0..ba6d8b3844fedc3929433d5a56ba9407ae3065fb 100644 |
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc |
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc |
@@ -354,7 +354,9 @@ void ChromeLauncherControllerImpl::CloseLauncherItem(ash::ShelfID id) { |
CHECK(iter != id_to_item_controller_map_.end()); |
SetItemStatus(id, ash::STATUS_CLOSED); |
std::string app_id = iter->second->app_id(); |
- iter->second = AppShortcutLauncherItemController::Create(app_id, this); |
+ std::string launch_id = iter->second->launch_id(); |
+ iter->second = |
+ AppShortcutLauncherItemController::Create(app_id, launch_id, this); |
iter->second->set_shelf_id(id); |
// Existing controller is destroyed and replaced by registering again. |
SetShelfItemDelegate(id, iter->second); |
@@ -500,7 +502,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 |
@@ -895,13 +897,21 @@ void ChromeLauncherControllerImpl::OnShelfVisibilityStateChanged( |
ash::ShelfID ChromeLauncherControllerImpl::GetShelfIDForAppID( |
const std::string& app_id) { |
- for (IDToItemControllerMap::const_iterator i = |
- id_to_item_controller_map_.begin(); |
- i != id_to_item_controller_map_.end(); ++i) { |
- if (i->second->type() == LauncherItemController::TYPE_APP_PANEL) |
+ // Get shelf id for app_id and empty launch_id. |
+ return GetShelfIDForAppIDAndLaunchID(app_id, ""); |
+} |
+ |
+ash::ShelfID ChromeLauncherControllerImpl::GetShelfIDForAppIDAndLaunchID( |
+ const std::string& app_id, |
+ const std::string& launch_id) { |
+ for (const auto& id_to_item_controller_pair : id_to_item_controller_map_) { |
+ if (id_to_item_controller_pair.second->type() == |
+ LauncherItemController::TYPE_APP_PANEL) |
continue; // Don't include panels |
- if (i->second->app_id() == app_id) |
- return i->first; |
+ if ((id_to_item_controller_pair.second->app_id() == app_id) && |
James Cook
2016/09/01 04:27:52
nit: no need for extra () around == condition
Andra Paraschiv
2016/09/01 08:27:25
Done.
|
+ (id_to_item_controller_pair.second->launch_id() == launch_id)) { |
+ return id_to_item_controller_pair.first; |
+ } |
} |
return 0; |
} |
@@ -1061,7 +1071,7 @@ ChromeLauncherControllerImpl::CreateAppShortcutLauncherItemWithType( |
int index, |
ash::ShelfItemType shelf_item_type) { |
AppShortcutLauncherItemController* controller = |
- AppShortcutLauncherItemController::Create(app_id, this); |
+ AppShortcutLauncherItemController::Create(app_id, "", this); |
ash::ShelfID shelf_id = InsertAppLauncherItem( |
controller, app_id, ash::STATUS_CLOSED, index, shelf_item_type); |
return shelf_id; |