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

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

Issue 10917026: Switch Extensions::TabHelper to use WebContents, WebContentsUserData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase only Created 8 years, 3 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
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/browser_launcher_item_controller.h" 5 #include "chrome/browser/ui/ash/launcher/browser_launcher_item_controller.h"
6 6
7 #include "ash/launcher/launcher.h" 7 #include "ash/launcher/launcher.h"
8 #include "ash/launcher/launcher_model.h" 8 #include "ash/launcher/launcher_model.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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 return; 244 return;
245 245
246 ash::LauncherItem item = launcher_model()->items()[item_index]; 246 ash::LauncherItem item = launcher_model()->items()[item_index];
247 if (type() == TYPE_EXTENSION_PANEL) { 247 if (type() == TYPE_EXTENSION_PANEL) {
248 if (!favicon_loader_.get() || 248 if (!favicon_loader_.get() ||
249 favicon_loader_->web_contents() != tab->web_contents()) { 249 favicon_loader_->web_contents() != tab->web_contents()) {
250 favicon_loader_.reset( 250 favicon_loader_.reset(
251 new LauncherFaviconLoader(this, tab->web_contents())); 251 new LauncherFaviconLoader(this, tab->web_contents()));
252 } 252 }
253 // Update the icon for extension panels. 253 // Update the icon for extension panels.
254 extensions::TabHelper* extensions_tab_helper =
255 extensions::TabHelper::FromWebContents(tab->web_contents());
254 SkBitmap new_image = favicon_loader_->GetFavicon(); 256 SkBitmap new_image = favicon_loader_->GetFavicon();
255 if (new_image.isNull() && 257 if (new_image.isNull() && extensions_tab_helper->GetExtensionAppIcon())
256 tab->extension_tab_helper()->GetExtensionAppIcon()) { 258 new_image = *extensions_tab_helper->GetExtensionAppIcon();
257 new_image = *tab->extension_tab_helper()->GetExtensionAppIcon();
258 }
259 // Only update the icon if we have a new image, or none has been set yet. 259 // Only update the icon if we have a new image, or none has been set yet.
260 // This avoids flickering to an empty image when a pinned app is opened. 260 // This avoids flickering to an empty image when a pinned app is opened.
261 if (!new_image.isNull()) 261 if (!new_image.isNull())
262 item.image = new_image; 262 item.image = new_image;
263 else if (item.image.isNull()) 263 else if (item.image.isNull())
264 item.image = extensions::Extension::GetDefaultIcon(true); 264 item.image = extensions::Extension::GetDefaultIcon(true);
265 } else { 265 } else {
266 DCHECK_EQ(TYPE_TABBED, type()); 266 DCHECK_EQ(TYPE_TABBED, type());
267 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 267 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
268 if (tab->favicon_tab_helper()->ShouldDisplayFavicon()) { 268 if (tab->favicon_tab_helper()->ShouldDisplayFavicon()) {
(...skipping 20 matching lines...) Expand all
289 app_state = ChromeLauncherController::APP_STATE_ACTIVE; 289 app_state = ChromeLauncherController::APP_STATE_ACTIVE;
290 } else { 290 } else {
291 app_state = ChromeLauncherController::APP_STATE_INACTIVE; 291 app_state = ChromeLauncherController::APP_STATE_INACTIVE;
292 } 292 }
293 launcher_controller()->UpdateAppState(tab, app_state); 293 launcher_controller()->UpdateAppState(tab, app_state);
294 } 294 }
295 295
296 ash::LauncherModel* BrowserLauncherItemController::launcher_model() { 296 ash::LauncherModel* BrowserLauncherItemController::launcher_model() {
297 return launcher_controller()->model(); 297 return launcher_controller()->model();
298 } 298 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/session_change_processor.cc ('k') | chrome/browser/ui/browser_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698