Index: chrome/browser/ui/ash/launcher/app_window_launcher_controller.cc |
diff --git a/chrome/browser/ui/ash/launcher/app_window_launcher_controller.cc b/chrome/browser/ui/ash/launcher/app_window_launcher_controller.cc |
index 4e46569bc33dfccd2ac56a7ba41eeb480e7c2a19..bd4fb51a4d4a155ca8139d5617ab5c0caadf4e1b 100644 |
--- a/chrome/browser/ui/ash/launcher/app_window_launcher_controller.cc |
+++ b/chrome/browser/ui/ash/launcher/app_window_launcher_controller.cc |
@@ -151,7 +151,8 @@ void AppWindowLauncherController::RegisterApp(AppWindow* app_window) { |
: ash::STATUS_RUNNING; |
AppControllerMap::iterator iter = app_controller_map_.find(app_shelf_id); |
ash::ShelfID shelf_id = 0; |
- if (iter != app_controller_map_.end()) { |
+ |
+ if (!app_window->show_in_shelf() && iter != app_controller_map_.end()) { |
AppWindowLauncherItemController* controller = iter->second; |
DCHECK(controller->app_id() == app_id); |
shelf_id = controller->shelf_id(); |
@@ -165,10 +166,11 @@ void AppWindowLauncherController::RegisterApp(AppWindow* app_window) { |
new AppWindowLauncherItemController(type, app_shelf_id, app_id, owner_); |
controller->AddAppWindow(app_window, status); |
// If the app shelf id is not unique, and there is already a shelf |
- // item for this app id (e.g. pinned), use that shelf item. |
+ // item for this app id (e.g. pinned), use that shelf item, except for the |
+ // case when the showInShelf parameter is true. |
if (app_shelf_id == app_id) |
shelf_id = owner_->GetShelfIDForAppID(app_id); |
- if (shelf_id == 0) { |
+ if (shelf_id == 0 || app_window->show_in_shelf()) { |
stevenjb
2016/03/17 23:36:15
I think this logic would be more clear in the if s
|
shelf_id = owner_->CreateAppLauncherItem(controller, app_id, status); |
// Restore any existing app icon and flag as set. |
const gfx::Image& app_icon = app_window->app_icon(); |
@@ -179,8 +181,12 @@ void AppWindowLauncherController::RegisterApp(AppWindow* app_window) { |
} else { |
owner_->SetItemController(shelf_id, controller); |
} |
- const std::string app_shelf_id = GetAppShelfId(app_window); |
- app_controller_map_[app_shelf_id] = controller; |
+ // We only need to change the controller associated with the app if the |
+ // showInShelf parameter is false. |
stevenjb
2016/03/17 23:36:15
Is this true? What if the first window created for
|
+ if (!app_window->show_in_shelf()) { |
+ const std::string app_shelf_id = GetAppShelfId(app_window); |
+ app_controller_map_[app_shelf_id] = controller; |
+ } |
} |
owner_->SetItemStatus(shelf_id, status); |
ash::SetShelfIDForWindow(shelf_id, window); |