OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/ash/launcher/extension_app_window_launcher_controlle
r.h" | 5 #include "chrome/browser/ui/ash/launcher/extension_app_window_launcher_controlle
r.h" |
6 | 6 |
7 #include "ash/aura/wm_window_aura.h" | 7 #include "ash/aura/wm_window_aura.h" |
8 #include "ash/common/shelf/shelf_delegate.h" | 8 #include "ash/common/shelf/shelf_delegate.h" |
9 #include "ash/common/wm_shell.h" | 9 #include "ash/common/wm_shell.h" |
10 #include "ash/common/wm_window_property.h" | 10 #include "ash/common/wm_window_property.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 app_controller_map_.find(app_shelf_id); | 158 app_controller_map_.find(app_shelf_id); |
159 ash::ShelfID shelf_id = 0; | 159 ash::ShelfID shelf_id = 0; |
160 | 160 |
161 if (app_controller_iter != app_controller_map_.end()) { | 161 if (app_controller_iter != app_controller_map_.end()) { |
162 ExtensionAppWindowLauncherItemController* controller = | 162 ExtensionAppWindowLauncherItemController* controller = |
163 app_controller_iter->second; | 163 app_controller_iter->second; |
164 DCHECK(controller->app_id() == app_id); | 164 DCHECK(controller->app_id() == app_id); |
165 shelf_id = controller->shelf_id(); | 165 shelf_id = controller->shelf_id(); |
166 controller->AddAppWindow(app_window); | 166 controller->AddAppWindow(app_window); |
167 } else { | 167 } else { |
168 LauncherItemController::Type type = LauncherItemController::TYPE_APP; | |
169 std::string launch_id = GetLaunchId(app_window); | 168 std::string launch_id = GetLaunchId(app_window); |
170 ExtensionAppWindowLauncherItemController* controller = | 169 ExtensionAppWindowLauncherItemController* controller = |
171 new ExtensionAppWindowLauncherItemController(type, app_id, launch_id, | 170 new ExtensionAppWindowLauncherItemController(app_id, launch_id, |
172 owner()); | 171 owner()); |
173 controller->AddAppWindow(app_window); | 172 controller->AddAppWindow(app_window); |
174 // If there is already a shelf id mapped to this app_shelf_id (e.g. pinned), | 173 // If there is already a shelf id mapped to this app_shelf_id (e.g. pinned), |
175 // use that shelf item. | 174 // use that shelf item. |
176 shelf_id = | 175 shelf_id = |
177 ash::WmShell::Get()->shelf_delegate()->GetShelfIDForAppIDAndLaunchID( | 176 ash::WmShell::Get()->shelf_delegate()->GetShelfIDForAppIDAndLaunchID( |
178 app_id, launch_id); | 177 app_id, launch_id); |
179 | 178 |
180 if (shelf_id == 0) { | 179 if (shelf_id == 0) { |
181 shelf_id = owner()->CreateAppLauncherItem(controller, app_id, status); | 180 shelf_id = owner()->CreateAppLauncherItem(controller, app_id, status); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 WindowToAppShelfIdMap::iterator window_iter = | 234 WindowToAppShelfIdMap::iterator window_iter = |
236 window_to_app_shelf_id_map_.find(window); | 235 window_to_app_shelf_id_map_.find(window); |
237 if (window_iter == window_to_app_shelf_id_map_.end()) | 236 if (window_iter == window_to_app_shelf_id_map_.end()) |
238 return nullptr; | 237 return nullptr; |
239 AppControllerMap::iterator app_controller_iter = | 238 AppControllerMap::iterator app_controller_iter = |
240 app_controller_map_.find(window_iter->second); | 239 app_controller_map_.find(window_iter->second); |
241 if (app_controller_iter == app_controller_map_.end()) | 240 if (app_controller_iter == app_controller_map_.end()) |
242 return nullptr; | 241 return nullptr; |
243 return app_controller_iter->second; | 242 return app_controller_iter->second; |
244 } | 243 } |
OLD | NEW |