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

Unified Diff: chrome/browser/extensions/image_loading_tracker.cc

Issue 256022: Loads local resources from current locale subtree if available, if not it fal... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/image_loading_tracker.h ('k') | chrome/browser/extensions/user_script_master.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/image_loading_tracker.cc
===================================================================
--- chrome/browser/extensions/image_loading_tracker.cc (revision 28157)
+++ chrome/browser/extensions/image_loading_tracker.cc (working copy)
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/image_loading_tracker.h"
+#include "chrome/browser/extensions/image_loading_tracker.h"
#include "app/gfx/favicon_size.h"
#include "base/file_util.h"
@@ -12,6 +12,7 @@
#include "base/task.h"
#include "base/thread.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/common/extensions/extension_resource.h"
#include "skia/ext/image_operations.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "webkit/glue/image_decoder.h"
@@ -29,11 +30,11 @@
// decode it. |path| is the path to load the image from. |index| is an
// identifier for the image that we pass back to the caller.
LoadImageTask(ImageLoadingTracker* tracker,
- const FilePath& path,
+ const ExtensionResource& resource,
size_t index)
: callback_loop_(MessageLoop::current()),
tracker_(tracker),
- path_(path),
+ resource_(resource),
index_(index) {}
void ReportBack(SkBitmap* image) {
@@ -47,8 +48,8 @@
virtual void Run() {
// Read the file from disk.
std::string file_contents;
- if (!file_util::PathExists(path_) ||
- !file_util::ReadFileToString(path_, &file_contents)) {
+ FilePath path = resource_.GetFilePath();
+ if (path.empty() || !file_util::ReadFileToString(path, &file_contents)) {
ReportBack(NULL);
return;
}
@@ -85,8 +86,8 @@
// The object that is waiting for us to respond back.
ImageLoadingTracker* tracker_;
- // The path to the image to load asynchronously.
- FilePath path_;
+ // The image resource to load asynchronously.
+ ExtensionResource resource_;
// The index of the icon being loaded.
size_t index_;
@@ -95,9 +96,9 @@
////////////////////////////////////////////////////////////////////////////////
// ImageLoadingTracker
-void ImageLoadingTracker::PostLoadImageTask(FilePath path) {
+void ImageLoadingTracker::PostLoadImageTask(const ExtensionResource& resource) {
MessageLoop* file_loop = g_browser_process->file_thread()->message_loop();
- file_loop->PostTask(FROM_HERE, new LoadImageTask(this, path,
+ file_loop->PostTask(FROM_HERE, new LoadImageTask(this, resource,
posted_count_++));
}
« no previous file with comments | « chrome/browser/extensions/image_loading_tracker.h ('k') | chrome/browser/extensions/user_script_master.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698