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

Side by Side Diff: chrome/common/extensions/api/icons/icons_handler.h

Issue 11786003: Move Icons out of Extension class (Closed) Base URL: http://git.chromium.org/chromium/src.git@dc_unref_browser_action
Patch Set: License year update Created 7 years, 11 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
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_COMMON_EXTENSIONS_API_ICONS_ICONS_HANDLER_H_
6 #define CHROME_COMMON_EXTENSIONS_API_ICONS_ICONS_HANDLER_H_
7
8 #include <string>
9
10 #include "chrome/common/extensions/extension.h"
11 #include "chrome/common/extensions/extension_icon_set.h"
12 #include "chrome/common/extensions/extension_resource.h"
13 #include "chrome/common/extensions/manifest_handler.h"
14
15 namespace extensions {
16
17 class Extension;
18
19 struct IconsInfo : public Extension::ManifestData {
20 // Max size (both dimensions) for browser and page actions.
21 static const int kPageActionIconMaxSize;
22 static const int kBrowserActionIconMaxSize;
23
24 // The icons for the extension.
25 ExtensionIconSet icons;
26
27 // Return the icon set for the given |extension|.
28 static const ExtensionIconSet& GetIcons(const Extension* extension);
29
30 // Given an extension, icon size, and match type, read a valid icon if present
31 // and decode it into result. In the browser process, this will DCHECK if not
32 // called on the file thread. To easily load extension images on the UI
33 // thread, see ImageLoadingTracker.
34 static void DecodeIcon(const Extension* extension,
35 int icon_size,
36 ExtensionIconSet::MatchType match_type,
37 scoped_ptr<SkBitmap>* result);
38
39 // Given an extension and icon size, read it if present and decode it into
40 // result. In the browser process, this will DCHECK if not called on the
41 // file thread. To easily load extension images on the UI thread, see
42 // ImageLoadingTracker.
43 static void DecodeIcon(const Extension* extension,
44 int icon_size,
45 scoped_ptr<SkBitmap>* result);
46
47 // Given an icon_path and icon size, read it if present and decode it into
48 // result. In the browser process, this will DCHECK if not called on the
49 // file thread. To easily load extension images on the UI thread, see
50 // ImageLoadingTracker.
51 static void DecodeIconFromPath(const FilePath& icon_path,
52 int icon_size,
53 scoped_ptr<SkBitmap>* result);
54
55 // Returns the default extension/app icon (for extensions or apps that don't
56 // have one).
57 static const gfx::ImageSkia& GetDefaultIcon(bool is_app);
58
59 // Get an extension icon as a resource or URL.
60 static ExtensionResource GetIconResource(
61 const Extension* extension,
62 int size,
63 ExtensionIconSet::MatchType match_type);
64 static GURL GetIconURL(const Extension* extension,
65 int size,
66 ExtensionIconSet::MatchType match_type);
67 };
68
69 // Parses the "icons" manifest key.
70 class IconsHandler : public ManifestHandler {
71 public:
72 IconsHandler();
73 virtual ~IconsHandler();
74
75 virtual bool Parse(const base::Value* value,
76 Extension* extension,
77 string16* error) OVERRIDE;
78 };
79
80 } // namespace extensions
81
82 #endif // CHROME_COMMON_EXTENSIONS_API_ICONS_ICONS_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698