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

Side by Side Diff: chrome/browser/ui/ash/launcher/extension_app_window_launcher_controller.cc

Issue 2798173002: mash: Remove ChromeLauncherController's |id_to_item_controller_map_|. (Closed)
Patch Set: Address comment; fix browser tests. Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/ash/launcher/chrome_launcher_controller_mus.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
8 #include "ash/common/wm_window.h" 9 #include "ash/common/wm_window.h"
9 #include "ash/shell.h" 10 #include "ash/shell.h"
10 #include "ash/wm/window_properties.h" 11 #include "ash/wm/window_properties.h"
11 #include "ash/wm/window_util.h" 12 #include "ash/wm/window_util.h"
12 #include "base/stl_util.h" 13 #include "base/stl_util.h"
13 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
14 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 16 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
16 #include "chrome/browser/ui/ash/launcher/extension_app_window_launcher_item_cont roller.h" 17 #include "chrome/browser/ui/ash/launcher/extension_app_window_launcher_item_cont roller.h"
17 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" 18 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 188
188 if (shelf_id == 0) { 189 if (shelf_id == 0) {
189 shelf_id = owner()->CreateAppLauncherItem(std::move(controller), status); 190 shelf_id = owner()->CreateAppLauncherItem(std::move(controller), status);
190 // Restore any existing app icon and flag as set. 191 // Restore any existing app icon and flag as set.
191 if (app_window->HasCustomIcon() && !app_window->app_icon().IsEmpty()) { 192 if (app_window->HasCustomIcon() && !app_window->app_icon().IsEmpty()) {
192 owner()->SetLauncherItemImage(shelf_id, 193 owner()->SetLauncherItemImage(shelf_id,
193 app_window->app_icon().AsImageSkia()); 194 app_window->app_icon().AsImageSkia());
194 item_controller->set_image_set_by_controller(true); 195 item_controller->set_image_set_by_controller(true);
195 } 196 }
196 } else { 197 } else {
197 owner()->SetShelfItemDelegate(shelf_id, std::move(controller)); 198 ash::ShelfModel* shelf_model = ash::Shell::Get()->shelf_model();
199 shelf_model->SetShelfItemDelegate(shelf_id, std::move(controller));
198 } 200 }
199 201
200 // We need to change the controller associated with app_shelf_id. 202 // We need to change the controller associated with app_shelf_id.
201 app_controller_map_[app_shelf_id] = item_controller; 203 app_controller_map_[app_shelf_id] = item_controller;
202 } 204 }
203 owner()->SetItemStatus(shelf_id, status); 205 owner()->SetItemStatus(shelf_id, status);
204 ash::WmWindow::Get(window)->aura_window()->SetProperty(ash::kShelfIDKey, 206 ash::WmWindow::Get(window)->aura_window()->SetProperty(ash::kShelfIDKey,
205 shelf_id); 207 shelf_id);
206 } 208 }
207 209
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 WindowToAppShelfIdMap::iterator window_iter = 245 WindowToAppShelfIdMap::iterator window_iter =
244 window_to_app_shelf_id_map_.find(window); 246 window_to_app_shelf_id_map_.find(window);
245 if (window_iter == window_to_app_shelf_id_map_.end()) 247 if (window_iter == window_to_app_shelf_id_map_.end())
246 return nullptr; 248 return nullptr;
247 AppControllerMap::iterator app_controller_iter = 249 AppControllerMap::iterator app_controller_iter =
248 app_controller_map_.find(window_iter->second); 250 app_controller_map_.find(window_iter->second);
249 if (app_controller_iter == app_controller_map_.end()) 251 if (app_controller_iter == app_controller_map_.end())
250 return nullptr; 252 return nullptr;
251 return app_controller_iter->second; 253 return app_controller_iter->second;
252 } 254 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/launcher/chrome_launcher_controller_mus.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698