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

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

Issue 2290603002: Enhance chrome.app.window API for shelf integration with pinning support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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/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);
}

Powered by Google App Engine
This is Rietveld 408576698