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

Side by Side Diff: chrome/browser/extensions/image_loading_tracker.cc

Issue 9949012: Show CWS and FileManager icons in pinned apps (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: undo previous patchset Created 8 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/ui/webui/extensions/extension_icon_source.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/extensions/image_loading_tracker.h" 5 #include "chrome/browser/extensions/image_loading_tracker.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
9 #include "chrome/common/chrome_notification_types.h" 10 #include "chrome/common/chrome_notification_types.h"
10 #include "chrome/common/extensions/extension.h" 11 #include "chrome/common/extensions/extension.h"
12 #include "chrome/common/extensions/extension_constants.h"
11 #include "chrome/common/extensions/extension_resource.h" 13 #include "chrome/common/extensions/extension_resource.h"
12 #include "content/public/browser/browser_thread.h" 14 #include "content/public/browser/browser_thread.h"
13 #include "content/public/browser/notification_service.h" 15 #include "content/public/browser/notification_service.h"
16 #include "grit/component_extension_resources.h"
17 #include "grit/theme_resources.h"
14 #include "skia/ext/image_operations.h" 18 #include "skia/ext/image_operations.h"
15 #include "third_party/skia/include/core/SkBitmap.h" 19 #include "third_party/skia/include/core/SkBitmap.h"
16 #include "ui/gfx/image/image.h" 20 #include "ui/gfx/image/image.h"
17 #include "webkit/glue/image_decoder.h" 21 #include "webkit/glue/image_decoder.h"
18 22
19 using content::BrowserThread; 23 using content::BrowserThread;
20 24
21 //////////////////////////////////////////////////////////////////////////////// 25 ////////////////////////////////////////////////////////////////////////////////
22 // ImageLoadingTracker::Observer 26 // ImageLoadingTracker::Observer
23 27
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 PendingLoadInfo load_info; 181 PendingLoadInfo load_info;
178 load_info.extension = extension; 182 load_info.extension = extension;
179 load_info.cache = cache; 183 load_info.cache = cache;
180 load_info.extension_id = extension->id(); 184 load_info.extension_id = extension->id();
181 load_info.pending_count = info_list.size(); 185 load_info.pending_count = info_list.size();
182 int id = next_id_++; 186 int id = next_id_++;
183 load_map_[id] = load_info; 187 load_map_[id] = load_info;
184 188
185 for (std::vector<ImageInfo>::const_iterator it = info_list.begin(); 189 for (std::vector<ImageInfo>::const_iterator it = info_list.begin();
186 it != info_list.end(); ++it) { 190 it != info_list.end(); ++it) {
191 // Load resources for component extensions.
192 if (load_info.extension_id == extension_misc::kWebStoreAppId) {
193 OnImageLoaded(
194 ExtensionIconSource::LoadImageByResourceId(IDR_WEBSTORE_ICON),
195 it->resource, it->max_size, id, false);
196 continue;
197 } else if (load_info.extension_id == extension_misc::kFileManagerAppId) {
198 OnImageLoaded(
199 ExtensionIconSource::LoadImageByResourceId(IDR_FILE_MANAGER_ICON_128),
200 it->resource, it->max_size, id, false);
201 continue;
202 }
203
187 // If we don't have a path we don't need to do any further work, just 204 // If we don't have a path we don't need to do any further work, just
188 // respond back. 205 // respond back.
189 if (it->resource.relative_path().empty()) { 206 if (it->resource.relative_path().empty()) {
190 OnImageLoaded(NULL, it->resource, it->max_size, id, false); 207 OnImageLoaded(NULL, it->resource, it->max_size, id, false);
191 continue; 208 continue;
192 } 209 }
193 210
194 DCHECK(extension->path() == it->resource.extension_root()); 211 DCHECK(extension->path() == it->resource.extension_root());
195 212
196 // See if the extension has the image already. 213 // See if the extension has the image already.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 // Remove reference to this extension from all pending load entries. This 283 // Remove reference to this extension from all pending load entries. This
267 // ensures we don't attempt to cache the image when the load completes. 284 // ensures we don't attempt to cache the image when the load completes.
268 for (LoadMap::iterator i = load_map_.begin(); i != load_map_.end(); ++i) { 285 for (LoadMap::iterator i = load_map_.begin(); i != load_map_.end(); ++i) {
269 PendingLoadInfo* info = &i->second; 286 PendingLoadInfo* info = &i->second;
270 if (info->extension == extension) { 287 if (info->extension == extension) {
271 info->extension = NULL; 288 info->extension = NULL;
272 info->cache = DONT_CACHE; 289 info->cache = DONT_CACHE;
273 } 290 }
274 } 291 }
275 } 292 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/extensions/extension_icon_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698