Index: chrome/browser/ui/ash/launcher/extension_app_window_launcher_controller.cc |
diff --git a/chrome/browser/ui/ash/launcher/extension_app_window_launcher_controller.cc b/chrome/browser/ui/ash/launcher/extension_app_window_launcher_controller.cc |
index eba8e08d10b8dbf54c1b839830cd7c97f2279284..12f992f613798e85a724c7f04843a25e8b9fe90c 100644 |
--- a/chrome/browser/ui/ash/launcher/extension_app_window_launcher_controller.cc |
+++ b/chrome/browser/ui/ash/launcher/extension_app_window_launcher_controller.cc |
@@ -152,31 +152,8 @@ void ExtensionAppWindowLauncherController::RegisterApp(AppWindow* app_window) { |
controller->AddAppWindow(app_window); |
// If there is already a shelf id mapped to this app_shelf_id (e.g. pinned), |
// use that shelf item. |
- AppShelfIdToShelfIdMap::iterator app_shelf_id_iter = |
- app_shelf_id_to_shelf_id_map_.find(app_shelf_id); |
- if (app_shelf_id_iter != app_shelf_id_to_shelf_id_map_.end()) { |
- if (owner()->IsPinned(app_shelf_id_iter->second)) { |
- shelf_id = app_shelf_id_iter->second; |
- } else { |
- app_shelf_id_to_shelf_id_map_.erase(app_shelf_id); |
- } |
- } else if (app_shelf_id == app_id) { |
- // show_in_shelf in false and not a panel |
- shelf_id = |
- ash::WmShell::Get()->shelf_delegate()->GetShelfIDForAppID(app_id); |
- // Check if the shelf_id corresponds to an already opened |
- // showInShelf=true window that has the same app_id. The current |
- // showInShelf=false window should not fold under this shelf item, |
- // so the shelf_id is set to 0 to get a new shelf_id. |
- auto&& id_map = app_shelf_id_to_shelf_id_map_; |
- if (std::find_if( |
- id_map.begin(), id_map.end(), |
- [shelf_id](const AppShelfIdToShelfIdMap::value_type& pair) { |
- return pair.second == shelf_id; |
- }) != id_map.end()) { |
- shelf_id = 0; |
- } |
- } |
+ shelf_id = ash::WmShell::Get()->shelf_delegate()->GetShelfIDForAppID( |
+ app_id, app_shelf_id); |
if (shelf_id == 0) { |
shelf_id = owner()->CreateAppLauncherItem(controller, app_id, status); |
@@ -192,7 +169,6 @@ void ExtensionAppWindowLauncherController::RegisterApp(AppWindow* app_window) { |
// We need to change the controller associated with app_shelf_id. |
app_controller_map_[app_shelf_id] = controller; |
- app_shelf_id_to_shelf_id_map_[app_shelf_id] = shelf_id; |
} |
owner()->SetItemStatus(shelf_id, status); |
ash::SetShelfIDForWindow(shelf_id, window); |
@@ -217,9 +193,6 @@ void ExtensionAppWindowLauncherController::UnregisterApp(aura::Window* window) { |
// If this is the last window associated with the app window shelf id, |
// close the shelf item. |
ash::ShelfID shelf_id = controller->shelf_id(); |
- if (!owner()->IsPinned(shelf_id)) { |
- app_shelf_id_to_shelf_id_map_.erase(app_shelf_id); |
- } |
owner()->CloseLauncherItem(shelf_id); |
app_controller_map_.erase(app_controller_iter); |
} |