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/common/shelf/shelf_delegate.h" | 7 #include "ash/common/shelf/shelf_delegate.h" |
8 #include "ash/common/shelf/shelf_model.h" | |
9 #include "ash/common/wm_window.h" | 8 #include "ash/common/wm_window.h" |
10 #include "ash/shell.h" | 9 #include "ash/shell.h" |
11 #include "ash/wm/window_properties.h" | 10 #include "ash/wm/window_properties.h" |
12 #include "ash/wm/window_util.h" | 11 #include "ash/wm/window_util.h" |
13 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
14 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
15 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 15 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
17 #include "chrome/browser/ui/ash/launcher/extension_app_window_launcher_item_cont
roller.h" | 16 #include "chrome/browser/ui/ash/launcher/extension_app_window_launcher_item_cont
roller.h" |
18 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" | 17 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 | 187 |
189 if (shelf_id == 0) { | 188 if (shelf_id == 0) { |
190 shelf_id = owner()->CreateAppLauncherItem(std::move(controller), status); | 189 shelf_id = owner()->CreateAppLauncherItem(std::move(controller), status); |
191 // Restore any existing app icon and flag as set. | 190 // Restore any existing app icon and flag as set. |
192 if (app_window->HasCustomIcon() && !app_window->app_icon().IsEmpty()) { | 191 if (app_window->HasCustomIcon() && !app_window->app_icon().IsEmpty()) { |
193 owner()->SetLauncherItemImage(shelf_id, | 192 owner()->SetLauncherItemImage(shelf_id, |
194 app_window->app_icon().AsImageSkia()); | 193 app_window->app_icon().AsImageSkia()); |
195 item_controller->set_image_set_by_controller(true); | 194 item_controller->set_image_set_by_controller(true); |
196 } | 195 } |
197 } else { | 196 } else { |
198 ash::ShelfModel* shelf_model = ash::Shell::Get()->shelf_model(); | 197 owner()->SetShelfItemDelegate(shelf_id, std::move(controller)); |
199 shelf_model->SetShelfItemDelegate(shelf_id, std::move(controller)); | |
200 } | 198 } |
201 | 199 |
202 // We need to change the controller associated with app_shelf_id. | 200 // We need to change the controller associated with app_shelf_id. |
203 app_controller_map_[app_shelf_id] = item_controller; | 201 app_controller_map_[app_shelf_id] = item_controller; |
204 } | 202 } |
205 owner()->SetItemStatus(shelf_id, status); | 203 owner()->SetItemStatus(shelf_id, status); |
206 ash::WmWindow::Get(window)->aura_window()->SetProperty(ash::kShelfIDKey, | 204 ash::WmWindow::Get(window)->aura_window()->SetProperty(ash::kShelfIDKey, |
207 shelf_id); | 205 shelf_id); |
208 } | 206 } |
209 | 207 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 WindowToAppShelfIdMap::iterator window_iter = | 243 WindowToAppShelfIdMap::iterator window_iter = |
246 window_to_app_shelf_id_map_.find(window); | 244 window_to_app_shelf_id_map_.find(window); |
247 if (window_iter == window_to_app_shelf_id_map_.end()) | 245 if (window_iter == window_to_app_shelf_id_map_.end()) |
248 return nullptr; | 246 return nullptr; |
249 AppControllerMap::iterator app_controller_iter = | 247 AppControllerMap::iterator app_controller_iter = |
250 app_controller_map_.find(window_iter->second); | 248 app_controller_map_.find(window_iter->second); |
251 if (app_controller_iter == app_controller_map_.end()) | 249 if (app_controller_iter == app_controller_map_.end()) |
252 return nullptr; | 250 return nullptr; |
253 return app_controller_iter->second; | 251 return app_controller_iter->second; |
254 } | 252 } |
OLD | NEW |