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

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

Issue 11786003: Move Icons out of Extension class (Closed) Base URL: http://git.chromium.org/chromium/src.git@dc_unref_browser_action
Patch Set: License year update Created 7 years, 11 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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"
11 #include "chrome/browser/extensions/extension_service.h" 11 #include "chrome/browser/extensions/extension_service.h"
12 #include "chrome/browser/extensions/tab_helper.h" 12 #include "chrome/browser/extensions/tab_helper.h"
13 #include "chrome/browser/favicon/favicon_tab_helper.h" 13 #include "chrome/browser/favicon/favicon_tab_helper.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 15 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
16 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_list.h" 17 #include "chrome/browser/ui/browser_list.h"
18 #include "chrome/browser/ui/browser_window.h" 18 #include "chrome/browser/ui/browser_window.h"
19 #include "chrome/browser/ui/tabs/tab_strip_model.h" 19 #include "chrome/browser/ui/tabs/tab_strip_model.h"
20 #include "chrome/browser/web_applications/web_app.h" 20 #include "chrome/browser/web_applications/web_app.h"
21 #include "chrome/common/extensions/api/icons/icons_handler.h"
21 #include "content/public/browser/web_contents.h" 22 #include "content/public/browser/web_contents.h"
22 #include "grit/ui_resources.h" 23 #include "grit/ui_resources.h"
23 #include "ui/aura/client/aura_constants.h" 24 #include "ui/aura/client/aura_constants.h"
24 #include "ui/aura/window.h" 25 #include "ui/aura/window.h"
25 #include "ui/base/resource/resource_bundle.h" 26 #include "ui/base/resource/resource_bundle.h"
26 #include "ui/views/widget/widget.h" 27 #include "ui/views/widget/widget.h"
27 28
28 using extensions::Extension; 29 using extensions::Extension;
29 30
30 BrowserLauncherItemController::BrowserLauncherItemController( 31 BrowserLauncherItemController::BrowserLauncherItemController(
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 extensions::TabHelper* extensions_tab_helper = 279 extensions::TabHelper* extensions_tab_helper =
279 extensions::TabHelper::FromWebContents(tab); 280 extensions::TabHelper::FromWebContents(tab);
280 gfx::ImageSkia new_image = gfx::ImageSkia(favicon_loader_->GetFavicon()); 281 gfx::ImageSkia new_image = gfx::ImageSkia(favicon_loader_->GetFavicon());
281 if (new_image.isNull() && extensions_tab_helper->GetExtensionAppIcon()) 282 if (new_image.isNull() && extensions_tab_helper->GetExtensionAppIcon())
282 new_image = gfx::ImageSkia(*extensions_tab_helper->GetExtensionAppIcon()); 283 new_image = gfx::ImageSkia(*extensions_tab_helper->GetExtensionAppIcon());
283 // Only update the icon if we have a new image, or none has been set yet. 284 // Only update the icon if we have a new image, or none has been set yet.
284 // This avoids flickering to an empty image when a pinned app is opened. 285 // This avoids flickering to an empty image when a pinned app is opened.
285 if (!new_image.isNull()) 286 if (!new_image.isNull())
286 item.image = new_image; 287 item.image = new_image;
287 else if (item.image.isNull()) 288 else if (item.image.isNull())
288 item.image = extensions::Extension::GetDefaultIcon(true); 289 item.image = extensions::IconsInfo::GetDefaultIcon(true); // is app
Yoyo Zhou 2013/01/08 01:26:13 This is silly. Can we have GetDefaultAppIcon GetDe
Devlin 2013/01/16 23:32:29 Done.
289 } else { 290 } else {
290 DCHECK_EQ(TYPE_TABBED, type()); 291 DCHECK_EQ(TYPE_TABBED, type());
291 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 292 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
292 FaviconTabHelper* favicon_tab_helper = 293 FaviconTabHelper* favicon_tab_helper =
293 FaviconTabHelper::FromWebContents(tab); 294 FaviconTabHelper::FromWebContents(tab);
294 if (favicon_tab_helper->ShouldDisplayFavicon()) { 295 if (favicon_tab_helper->ShouldDisplayFavicon()) {
295 item.image = favicon_tab_helper->GetFavicon().AsImageSkia(); 296 item.image = favicon_tab_helper->GetFavicon().AsImageSkia();
296 if (item.image.isNull()) { 297 if (item.image.isNull()) {
297 item.image = *rb.GetImageSkiaNamed(IDR_DEFAULT_FAVICON); 298 item.image = *rb.GetImageSkiaNamed(IDR_DEFAULT_FAVICON);
298 } 299 }
(...skipping 17 matching lines...) Expand all
316 app_state = ChromeLauncherController::APP_STATE_ACTIVE; 317 app_state = ChromeLauncherController::APP_STATE_ACTIVE;
317 } else { 318 } else {
318 app_state = ChromeLauncherController::APP_STATE_INACTIVE; 319 app_state = ChromeLauncherController::APP_STATE_INACTIVE;
319 } 320 }
320 launcher_controller()->UpdateAppState(tab, app_state); 321 launcher_controller()->UpdateAppState(tab, app_state);
321 } 322 }
322 323
323 ash::LauncherModel* BrowserLauncherItemController::launcher_model() { 324 ash::LauncherModel* BrowserLauncherItemController::launcher_model() {
324 return launcher_controller()->model(); 325 return launcher_controller()->model();
325 } 326 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698