| OLD | NEW |
| 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" |
| 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 favicon_loader_->GetFavicon()); | 282 favicon_loader_->GetFavicon()); |
| 282 if (new_image.isNull() && extensions_tab_helper->GetExtensionAppIcon()) { | 283 if (new_image.isNull() && extensions_tab_helper->GetExtensionAppIcon()) { |
| 283 new_image = gfx::ImageSkia::CreateFrom1xBitmap( | 284 new_image = gfx::ImageSkia::CreateFrom1xBitmap( |
| 284 *extensions_tab_helper->GetExtensionAppIcon()); | 285 *extensions_tab_helper->GetExtensionAppIcon()); |
| 285 } | 286 } |
| 286 // Only update the icon if we have a new image, or none has been set yet. | 287 // Only update the icon if we have a new image, or none has been set yet. |
| 287 // This avoids flickering to an empty image when a pinned app is opened. | 288 // This avoids flickering to an empty image when a pinned app is opened. |
| 288 if (!new_image.isNull()) | 289 if (!new_image.isNull()) |
| 289 item.image = new_image; | 290 item.image = new_image; |
| 290 else if (item.image.isNull()) | 291 else if (item.image.isNull()) |
| 291 item.image = extensions::Extension::GetDefaultIcon(true); | 292 item.image = extensions::IconsInfo::GetDefaultAppIcon(); |
| 292 } else { | 293 } else { |
| 293 DCHECK_EQ(TYPE_TABBED, type()); | 294 DCHECK_EQ(TYPE_TABBED, type()); |
| 294 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 295 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 295 FaviconTabHelper* favicon_tab_helper = | 296 FaviconTabHelper* favicon_tab_helper = |
| 296 FaviconTabHelper::FromWebContents(tab); | 297 FaviconTabHelper::FromWebContents(tab); |
| 297 if (favicon_tab_helper->ShouldDisplayFavicon()) { | 298 if (favicon_tab_helper->ShouldDisplayFavicon()) { |
| 298 item.image = favicon_tab_helper->GetFavicon().AsImageSkia(); | 299 item.image = favicon_tab_helper->GetFavicon().AsImageSkia(); |
| 299 if (item.image.isNull()) { | 300 if (item.image.isNull()) { |
| 300 item.image = *rb.GetImageSkiaNamed(IDR_DEFAULT_FAVICON); | 301 item.image = *rb.GetImageSkiaNamed(IDR_DEFAULT_FAVICON); |
| 301 } | 302 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 319 app_state = ChromeLauncherController::APP_STATE_ACTIVE; | 320 app_state = ChromeLauncherController::APP_STATE_ACTIVE; |
| 320 } else { | 321 } else { |
| 321 app_state = ChromeLauncherController::APP_STATE_INACTIVE; | 322 app_state = ChromeLauncherController::APP_STATE_INACTIVE; |
| 322 } | 323 } |
| 323 launcher_controller()->UpdateAppState(tab, app_state); | 324 launcher_controller()->UpdateAppState(tab, app_state); |
| 324 } | 325 } |
| 325 | 326 |
| 326 ash::LauncherModel* BrowserLauncherItemController::launcher_model() { | 327 ash::LauncherModel* BrowserLauncherItemController::launcher_model() { |
| 327 return launcher_controller()->model(); | 328 return launcher_controller()->model(); |
| 328 } | 329 } |
| OLD | NEW |