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

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

Issue 1811523002: Enhance chrome.app.window API with better shelf integration Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed test comment Created 4 years, 9 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
« no previous file with comments | « no previous file | extensions/browser/api/app_window/app_window_api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | extensions/browser/api/app_window/app_window_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698