| 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/app_list/extension_app_item.h" | 5 #include "chrome/browser/ui/app_list/extension_app_item.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/extensions/extension_prefs.h" | 8 #include "chrome/browser/extensions/extension_prefs.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/extensions/extension_system.h" | 10 #include "chrome/browser/extensions/extension_system.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 void ExtensionAppItem::StartExtensionUninstall() { | 174 void ExtensionAppItem::StartExtensionUninstall() { |
| 175 // ExtensionUninstall deletes itself when done or aborted. | 175 // ExtensionUninstall deletes itself when done or aborted. |
| 176 ExtensionUninstaller* uninstaller = new ExtensionUninstaller(profile_, | 176 ExtensionUninstaller* uninstaller = new ExtensionUninstaller(profile_, |
| 177 extension_id_); | 177 extension_id_); |
| 178 uninstaller->Run(); | 178 uninstaller->Run(); |
| 179 } | 179 } |
| 180 | 180 |
| 181 void ExtensionAppItem::OnImageLoaded(const gfx::Image& image, | 181 void ExtensionAppItem::OnImageLoaded(const gfx::Image& image, |
| 182 const std::string& extension_id, | 182 const std::string& extension_id, |
| 183 int tracker_index) { | 183 int tracker_index) { |
| 184 if (!image.IsEmpty()) | 184 if (!image.IsEmpty()) { |
| 185 SetIcon(*image.ToImageSkia()); | 185 gfx::ImageSkia image_skia = *image.ToImageSkia(); |
| 186 else | 186 image_skia.MakeThreadSafe(); |
| 187 SetIcon(Extension::GetDefaultIcon(true /* is_app */)); | 187 SetIcon(image_skia); |
| 188 } else { |
| 189 gfx::ImageSkia image_skia(Extension::GetDefaultIcon(true /* is_app */)); |
| 190 image_skia.MakeThreadSafe(); |
| 191 SetIcon(image_skia); |
| 192 } |
| 188 } | 193 } |
| 189 | 194 |
| 190 bool ExtensionAppItem::IsItemForCommandIdDynamic(int command_id) const { | 195 bool ExtensionAppItem::IsItemForCommandIdDynamic(int command_id) const { |
| 191 return command_id == TOGGLE_PIN; | 196 return command_id == TOGGLE_PIN; |
| 192 } | 197 } |
| 193 | 198 |
| 194 string16 ExtensionAppItem::GetLabelForCommandId(int command_id) const { | 199 string16 ExtensionAppItem::GetLabelForCommandId(int command_id) const { |
| 195 if (command_id == TOGGLE_PIN) { | 200 if (command_id == TOGGLE_PIN) { |
| 196 return controller_->IsAppPinned(extension_id_) ? | 201 return controller_->IsAppPinned(extension_id_) ? |
| 197 l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_UNPIN) : | 202 l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_UNPIN) : |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 IDS_APP_CONTEXT_MENU_OPEN_MAXIMIZED); | 303 IDS_APP_CONTEXT_MENU_OPEN_MAXIMIZED); |
| 299 context_menu_model_->AddSeparator(ui::NORMAL_SEPARATOR); | 304 context_menu_model_->AddSeparator(ui::NORMAL_SEPARATOR); |
| 300 context_menu_model_->AddItemWithStringId(OPTIONS, IDS_NEW_TAB_APP_OPTIONS); | 305 context_menu_model_->AddItemWithStringId(OPTIONS, IDS_NEW_TAB_APP_OPTIONS); |
| 301 context_menu_model_->AddItemWithStringId(DETAILS, IDS_NEW_TAB_APP_DETAILS); | 306 context_menu_model_->AddItemWithStringId(DETAILS, IDS_NEW_TAB_APP_DETAILS); |
| 302 context_menu_model_->AddItemWithStringId(UNINSTALL, | 307 context_menu_model_->AddItemWithStringId(UNINSTALL, |
| 303 IDS_EXTENSIONS_UNINSTALL); | 308 IDS_EXTENSIONS_UNINSTALL); |
| 304 } | 309 } |
| 305 | 310 |
| 306 return context_menu_model_.get(); | 311 return context_menu_model_.get(); |
| 307 } | 312 } |
| OLD | NEW |