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

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

Issue 162813003: Restore ShellWindow app icon in RegisterApp (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/shell_window_launcher_controller.h" 5 #include "chrome/browser/ui/ash/launcher/shell_window_launcher_controller.h"
6 6
7 #include "apps/shell_window.h" 7 #include "apps/shell_window.h"
8 #include "ash/shelf/shelf_util.h" 8 #include "ash/shelf/shelf_util.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/wm/window_util.h" 10 #include "ash/wm/window_util.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 ? LauncherItemController::TYPE_APP_PANEL 163 ? LauncherItemController::TYPE_APP_PANEL
164 : LauncherItemController::TYPE_APP; 164 : LauncherItemController::TYPE_APP;
165 ShellWindowLauncherItemController* controller = 165 ShellWindowLauncherItemController* controller =
166 new ShellWindowLauncherItemController( 166 new ShellWindowLauncherItemController(
167 type, app_shelf_id, app_id, owner_); 167 type, app_shelf_id, app_id, owner_);
168 controller->AddShellWindow(shell_window, status); 168 controller->AddShellWindow(shell_window, status);
169 // If the app shelf id is not unique, and there is already a shelf 169 // If the app shelf id is not unique, and there is already a shelf
170 // item for this app id (e.g. pinned), use that shelf item. 170 // item for this app id (e.g. pinned), use that shelf item.
171 if (app_shelf_id == app_id) 171 if (app_shelf_id == app_id)
172 shelf_id = owner_->GetShelfIDForAppID(app_id); 172 shelf_id = owner_->GetShelfIDForAppID(app_id);
173 if (shelf_id == 0) 173 if (shelf_id == 0) {
174 shelf_id = owner_->CreateAppLauncherItem(controller, app_id, status); 174 shelf_id = owner_->CreateAppLauncherItem(controller, app_id, status);
175 else 175 // Restore any existing app icon and flag as set.
176 const gfx::Image& app_icon = shell_window->app_icon();
177 if (!app_icon.IsEmpty()) {
178 owner_->SetLauncherItemImage(shelf_id, app_icon.AsImageSkia());
179 controller->set_image_set_by_controller(true);
180 }
181 } else {
176 owner_->SetItemController(shelf_id, controller); 182 owner_->SetItemController(shelf_id, controller);
183 }
177 const std::string app_shelf_id = GetAppShelfId(shell_window); 184 const std::string app_shelf_id = GetAppShelfId(shell_window);
178 app_controller_map_[app_shelf_id] = controller; 185 app_controller_map_[app_shelf_id] = controller;
179 } 186 }
180 owner_->SetItemStatus(shelf_id, status); 187 owner_->SetItemStatus(shelf_id, status);
181 ash::SetShelfIDForWindow(shelf_id, window); 188 ash::SetShelfIDForWindow(shelf_id, window);
182 } 189 }
183 190
184 void ShellWindowLauncherController::UnregisterApp(aura::Window* window) { 191 void ShellWindowLauncherController::UnregisterApp(aura::Window* window) {
185 WindowToAppShelfIdMap::iterator iter1 = 192 WindowToAppShelfIdMap::iterator iter1 =
186 window_to_app_shelf_id_map_.find(window); 193 window_to_app_shelf_id_map_.find(window);
(...skipping 28 matching lines...) Expand all
215 WindowToAppShelfIdMap::iterator iter1 = 222 WindowToAppShelfIdMap::iterator iter1 =
216 window_to_app_shelf_id_map_.find(window); 223 window_to_app_shelf_id_map_.find(window);
217 if (iter1 == window_to_app_shelf_id_map_.end()) 224 if (iter1 == window_to_app_shelf_id_map_.end())
218 return NULL; 225 return NULL;
219 std::string app_shelf_id = iter1->second; 226 std::string app_shelf_id = iter1->second;
220 AppControllerMap::iterator iter2 = app_controller_map_.find(app_shelf_id); 227 AppControllerMap::iterator iter2 = app_controller_map_.find(app_shelf_id);
221 if (iter2 == app_controller_map_.end()) 228 if (iter2 == app_controller_map_.end())
222 return NULL; 229 return NULL;
223 return iter2->second; 230 return iter2->second;
224 } 231 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698