| OLD | NEW |
| 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/app_list/extension_app_item.h" | 5 #include "chrome/browser/ui/app_list/extension_app_item.h" |
| 6 | 6 |
| 7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
| 8 #include "chrome/browser/extensions/context_menu_matcher.h" | 8 #include "chrome/browser/extensions/context_menu_matcher.h" |
| 9 #include "chrome/browser/extensions/extension_prefs.h" | 9 #include "chrome/browser/extensions/extension_prefs.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| 11 #include "chrome/browser/extensions/extension_sorting.h" | 11 #include "chrome/browser/extensions/extension_sorting.h" |
| 12 #include "chrome/browser/extensions/extension_system.h" | 12 #include "chrome/browser/extensions/extension_system.h" |
| 13 #include "chrome/browser/extensions/extension_uninstall_dialog.h" | 13 #include "chrome/browser/extensions/extension_uninstall_dialog.h" |
| 14 #include "chrome/browser/extensions/management_policy.h" | 14 #include "chrome/browser/extensions/management_policy.h" |
| 15 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 15 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 16 #include "chrome/browser/prefs/pref_service.h" | 16 #include "chrome/browser/prefs/pref_service.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/ui/app_list/app_list_controller.h" | 18 #include "chrome/browser/ui/app_list/app_list_controller.h" |
| 19 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
| 20 #include "chrome/browser/ui/browser_navigator.h" | 20 #include "chrome/browser/ui/browser_navigator.h" |
| 21 #include "chrome/browser/ui/browser_tabstrip.h" | 21 #include "chrome/browser/ui/browser_tabstrip.h" |
| 22 #include "chrome/browser/ui/browser_window.h" | 22 #include "chrome/browser/ui/browser_window.h" |
| 23 #include "chrome/common/extensions/api/icons/icons_handler.h" |
| 23 #include "chrome/common/extensions/extension.h" | 24 #include "chrome/common/extensions/extension.h" |
| 24 #include "chrome/common/extensions/extension_constants.h" | 25 #include "chrome/common/extensions/extension_constants.h" |
| 25 #include "chrome/common/extensions/extension_icon_set.h" | 26 #include "chrome/common/extensions/extension_icon_set.h" |
| 26 #include "content/public/common/context_menu_params.h" | 27 #include "content/public/common/context_menu_params.h" |
| 27 #include "grit/chromium_strings.h" | 28 #include "grit/chromium_strings.h" |
| 28 #include "grit/generated_resources.h" | 29 #include "grit/generated_resources.h" |
| 29 #include "grit/theme_resources.h" | 30 #include "grit/theme_resources.h" |
| 30 #include "ui/base/l10n/l10n_util.h" | 31 #include "ui/base/l10n/l10n_util.h" |
| 31 #include "ui/base/resource/resource_bundle.h" | 32 #include "ui/base/resource/resource_bundle.h" |
| 32 #include "ui/gfx/canvas.h" | 33 #include "ui/gfx/canvas.h" |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 std::string()); | 216 std::string()); |
| 216 } | 217 } |
| 217 | 218 |
| 218 void ExtensionAppItem::LoadImage(const Extension* extension) { | 219 void ExtensionAppItem::LoadImage(const Extension* extension) { |
| 219 int icon_size = extension_misc::EXTENSION_ICON_MEDIUM; | 220 int icon_size = extension_misc::EXTENSION_ICON_MEDIUM; |
| 220 if (HasOverlay()) | 221 if (HasOverlay()) |
| 221 icon_size = extension_misc::EXTENSION_ICON_SMALL; | 222 icon_size = extension_misc::EXTENSION_ICON_SMALL; |
| 222 | 223 |
| 223 icon_.reset(new extensions::IconImage( | 224 icon_.reset(new extensions::IconImage( |
| 224 extension, | 225 extension, |
| 225 extension->icons(), | 226 IconsInfo::GetIcons(extension), |
| 226 icon_size, | 227 icon_size, |
| 227 Extension::GetDefaultIcon(true), | 228 IconsInfo::GetDefaultIcon(true), |
| 228 this)); | 229 this)); |
| 229 SetIconWithOverlay(icon_->image_skia()); | 230 SetIconWithOverlay(icon_->image_skia()); |
| 230 } | 231 } |
| 231 | 232 |
| 232 bool ExtensionAppItem::HasOverlay() { | 233 bool ExtensionAppItem::HasOverlay() { |
| 233 #if defined(OS_CHROMEOS) | 234 #if defined(OS_CHROMEOS) |
| 234 return false; | 235 return false; |
| 235 #else | 236 #else |
| 236 return !GetExtension()->is_platform_app(); | 237 return !GetExtension()->is_platform_app(); |
| 237 #endif | 238 #endif |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 } | 497 } |
| 497 | 498 |
| 498 context_menu_model_->AddItemWithStringId(UNINSTALL, | 499 context_menu_model_->AddItemWithStringId(UNINSTALL, |
| 499 extension->is_platform_app() ? | 500 extension->is_platform_app() ? |
| 500 IDS_APP_LIST_UNINSTALL_ITEM : | 501 IDS_APP_LIST_UNINSTALL_ITEM : |
| 501 IDS_EXTENSIONS_UNINSTALL); | 502 IDS_EXTENSIONS_UNINSTALL); |
| 502 } | 503 } |
| 503 | 504 |
| 504 return context_menu_model_.get(); | 505 return context_menu_model_.get(); |
| 505 } | 506 } |
| OLD | NEW |