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

Side by Side Diff: chrome/browser/ui/ash/app_list/extension_app_item.cc

Issue 10820049: Load 2x resources on demand (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: For preview Created 8 years, 4 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/app_list/extension_app_item.h" 5 #include "chrome/browser/ui/ash/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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 void ExtensionAppItem::StartExtensionUninstall() { 162 void ExtensionAppItem::StartExtensionUninstall() {
163 // ExtensionUninstall deletes itself when done or aborted. 163 // ExtensionUninstall deletes itself when done or aborted.
164 ExtensionUninstaller* uninstaller = new ExtensionUninstaller(profile_, 164 ExtensionUninstaller* uninstaller = new ExtensionUninstaller(profile_,
165 extension_id_); 165 extension_id_);
166 uninstaller->Run(); 166 uninstaller->Run();
167 } 167 }
168 168
169 void ExtensionAppItem::OnImageLoaded(const gfx::Image& image, 169 void ExtensionAppItem::OnImageLoaded(const gfx::Image& image,
170 const std::string& extension_id, 170 const std::string& extension_id,
171 int tracker_index) { 171 int tracker_index) {
172 if (!image.IsEmpty()) 172 LOG(ERROR) << "empty:" << image.IsEmpty();
173 SetIcon(*image.ToImageSkia()); 173 if (!image.IsEmpty()) {
174 else 174 gfx::ImageSkia image_skia = *image.ToImageSkia();
175 SetIcon(Extension::GetDefaultIcon(true /* is_app */)); 175 image_skia.SetReadOnly();
176 SetIcon(image_skia);
177 } else {
178 gfx::ImageSkia image_skia(Extension::GetDefaultIcon(true /* is_app */));
179 image_skia.SetReadOnly();
180 SetIcon(image_skia);
181 }
176 } 182 }
177 183
178 bool ExtensionAppItem::IsItemForCommandIdDynamic(int command_id) const { 184 bool ExtensionAppItem::IsItemForCommandIdDynamic(int command_id) const {
179 return command_id == TOGGLE_PIN; 185 return command_id == TOGGLE_PIN;
180 } 186 }
181 187
182 string16 ExtensionAppItem::GetLabelForCommandId(int command_id) const { 188 string16 ExtensionAppItem::GetLabelForCommandId(int command_id) const {
183 if (command_id == TOGGLE_PIN) { 189 if (command_id == TOGGLE_PIN) {
184 return controller_->IsAppPinned(extension_id_) ? 190 return controller_->IsAppPinned(extension_id_) ?
185 l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_UNPIN) : 191 l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_UNPIN) :
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 LAUNCH_TYPE_FULLSCREEN, 286 LAUNCH_TYPE_FULLSCREEN,
281 IDS_APP_CONTEXT_MENU_OPEN_MAXIMIZED); 287 IDS_APP_CONTEXT_MENU_OPEN_MAXIMIZED);
282 context_menu_model_->AddSeparator(); 288 context_menu_model_->AddSeparator();
283 context_menu_model_->AddItemWithStringId(OPTIONS, IDS_NEW_TAB_APP_OPTIONS); 289 context_menu_model_->AddItemWithStringId(OPTIONS, IDS_NEW_TAB_APP_OPTIONS);
284 context_menu_model_->AddItemWithStringId(UNINSTALL, 290 context_menu_model_->AddItemWithStringId(UNINSTALL,
285 IDS_EXTENSIONS_UNINSTALL); 291 IDS_EXTENSIONS_UNINSTALL);
286 } 292 }
287 293
288 return context_menu_model_.get(); 294 return context_menu_model_.get();
289 } 295 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698