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

Unified Diff: chrome/browser/extensions/extension_icon_manager.h

Issue 2973006: Use the extension icon for extension omnibox results instead of the generic (Closed)
Patch Set: fixed mac Created 10 years, 5 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
Index: chrome/browser/extensions/extension_icon_manager.h
diff --git a/chrome/browser/extensions/extension_icon_manager.h b/chrome/browser/extensions/extension_icon_manager.h
new file mode 100755
index 0000000000000000000000000000000000000000..abf719207288edc0a7f953b8771121735f7a9ffb
--- /dev/null
+++ b/chrome/browser/extensions/extension_icon_manager.h
@@ -0,0 +1,66 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_ICON_MANAGER_H_
+#define CHROME_BROWSER_EXTENSIONS_EXTENSION_ICON_MANAGER_H_
+
+#include <map>
+#include <set>
+#include <string>
+
+#include "base/basictypes.h"
+#include "chrome/browser/extensions/image_loading_tracker.h"
+#include "third_party/skia/include/core/SkBitmap.h"
+
+class Extension;
+
+class ExtensionIconManager : public ImageLoadingTracker::Observer {
+ public:
+ ExtensionIconManager();
+
+ // Start loading the icon for the given extension.
+ void LoadIcon(Extension* extension);
+
+ // This returns a bitmap of width/height kFavIconSize, loaded either from an
+ // entry specified in the extension's 'icon' section of the manifest, or a
+ // default extension icon.
+ const SkBitmap& GetIcon(const std::string& extension_id);
+
+ // Removes the extension's icon from memory.
+ void RemoveIcon(const std::string& extension_id);
+
+ // Implements the ImageLoadingTracker::Observer interface.
+ virtual void OnImageLoaded(SkBitmap* image, ExtensionResource resource,
+ int index);
+
+ void set_monochrome(bool value) { monochrome_ = value; }
+
+ private:
+ // Makes sure we've done one-time initialization of the default extension icon
+ // default_icon_.
+ void EnsureDefaultIcon();
+
+ // Helper function to return a copy of |src| with the proper scaling and
+ // coloring.
+ SkBitmap ApplyTransforms(const SkBitmap& src);
+
+ // Used for loading extension icons.
+ ImageLoadingTracker image_tracker_;
+
+ // Maps extension id to an SkBitmap with the icon for that extension.
+ std::map<std::string, SkBitmap> icons_;
+
+ // Set of extension IDs waiting for icons to load.
+ std::set<std::string> pending_icons_;
+
+ // The default icon we'll use if an extension doesn't have one.
+ SkBitmap default_icon_;
+
+ // If true, we will desaturate the icons to make them monochromatic.
+ bool monochrome_;
+
+ DISALLOW_COPY_AND_ASSIGN(ExtensionIconManager);
+};
+
+#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ICON_MANAGER_H_
« no previous file with comments | « chrome/browser/cocoa/location_bar/selected_keyword_decoration.mm ('k') | chrome/browser/extensions/extension_icon_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698