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

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: Created 7 years, 10 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 struct IconsInfo : public Extension::ManifestData {
18 // Max size (both dimensions) for browser and page actions.
19 static const int kPageActionIconMaxSize;
20 static const int kBrowserActionIconMaxSize;
21
22 // The icons for the extension.
23 ExtensionIconSet icons;
24
25 // Return the icon set for the given |extension|.
26 static const ExtensionIconSet& GetIcons(const Extension* extension);
27
28 // Given an extension, icon size, and match type, read a valid icon if present
29 // and decode it into result. In the browser process, this will DCHECK if not
30 // called on the file thread. To easily load extension images on the UI
31 // thread, see ImageLoadingTracker.
32 static void DecodeIcon(const Extension* extension,
33 int icon_size,
34 ExtensionIconSet::MatchType match_type,
35 scoped_ptr<SkBitmap>* result);
36
37 // Given an extension and icon size, read it if present and decode it into
38 // result. In the browser process, this will DCHECK if not called on the
39 // file thread. To easily load extension images on the UI thread, see
40 // ImageLoadingTracker.
41 static void DecodeIcon(const Extension* extension,
42 int icon_size,
43 scoped_ptr<SkBitmap>* result);
44
45 // Given an icon_path and icon size, read it if present and decode it into
46 // result. In the browser process, this will DCHECK if not called on the
47 // file thread. To easily load extension images on the UI thread, see
48 // ImageLoadingTracker.
49 static void DecodeIconFromPath(const FilePath& icon_path,
50 int icon_size,
51 scoped_ptr<SkBitmap>* result);
52
53 // Returns the default extension/app icon (for extensions or apps that don't
54 // have one).
55 static const gfx::ImageSkia& GetDefaultExtensionIcon();
56 static const gfx::ImageSkia& GetDefaultAppIcon();
57
58 // Get an extension icon as a resource or URL.
59 static ExtensionResource GetIconResource(
60 const Extension* extension,
61 int size,
62 ExtensionIconSet::MatchType match_type);
63 static GURL GetIconURL(const Extension* extension,
64 int size,
65 ExtensionIconSet::MatchType match_type);
66 };
67
68 // Parses the "icons" manifest key.
69 class IconsHandler : public ManifestHandler {
70 public:
71 IconsHandler();
72 virtual ~IconsHandler();
73
74 virtual bool Parse(const base::Value* value,
75 Extension* extension,
76 string16* error) OVERRIDE;
nilesh 2013/01/28 22:42:57 DISALLOW_COPY_AND_ASSIGN here too? http://google-s
77 };
78
79 } // namespace extensions
80
81 #endif // CHROME_COMMON_EXTENSIONS_API_ICONS_ICONS_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698