Attempt 2 at landing this. Patch is exactly same as last time around.

Adds ability for ImageLoadingTracker to cache images.

BUG=none
TEST=none
[email protected]

Review URL: http://codereview.chromium.org/1534006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43130 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h
index 0129858..f4c797e 100644
--- a/chrome/common/extensions/extension.h
+++ b/chrome/common/extensions/extension.h
@@ -21,6 +21,7 @@
 #include "chrome/common/extensions/url_pattern.h"
 #include "googleurl/src/gurl.h"
 #include "testing/gtest/include/gtest/gtest_prod.h"
+#include "third_party/skia/include/core/SkBitmap.h"
 
 // Represents a Chrome extension.
 class Extension {
@@ -323,7 +324,16 @@
   bool being_upgraded() const { return being_upgraded_; }
   void set_being_upgraded(bool value) { being_upgraded_ = value; }
 
+  // Image cache related methods. These are only valid on the UI thread and
+  // not maintained by this class. See ImageLoadingTracker for usage.
+  void SetCachedImage(const ExtensionResource& source,
+                      const SkBitmap& image);
+  bool HasCachedImage(const ExtensionResource& source);
+  SkBitmap GetCachedImage(const ExtensionResource& source);
+
  private:
+  typedef std::map<FilePath, SkBitmap> ImageCache;
+
   // Helper method that loads a UserScript object from a
   // dictionary in the content_script list of the manifest.
   bool LoadUserScriptHelper(const DictionaryValue* content_script,
@@ -478,6 +488,9 @@
   // The type of container to launch into.
   LaunchContainer launch_container_;
 
+  // Cached images for this extension. This maps from the relative_path of the
+  // resource to the cached image.
+  ImageCache image_cache_;
 
   // Runtime data: