Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / extensions / app_icon_loader_impl.h
blobd68962e496e3a2425aac86ac2c520445abf612b1
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.
5 #ifndef CHROME_BROWSER_EXTENSIONS_APP_ICON_LOADER_IMPL_H_
6 #define CHROME_BROWSER_EXTENSIONS_APP_ICON_LOADER_IMPL_H_
8 #include <map>
9 #include <string>
11 #include "chrome/browser/extensions/app_icon_loader.h"
12 #include "chrome/browser/extensions/extension_icon_image.h"
14 class Profile;
16 namespace extensions {
17 class Extension;
19 // Default implementation of ash::AppIconLoader that interacts with the
20 // ExtensionService and ImageLoader to load images.
21 class AppIconLoaderImpl : public AppIconLoader,
22 public extensions::IconImage::Observer {
23 public:
24 AppIconLoaderImpl(Profile* profile, int icon_size,
25 AppIconLoader::Delegate* delegate);
26 virtual ~AppIconLoaderImpl();
28 // AppIconLoader overrides:
29 virtual void FetchImage(const std::string& id) OVERRIDE;
30 virtual void ClearImage(const std::string& id) OVERRIDE;
31 virtual void UpdateImage(const std::string& id) OVERRIDE;
33 // extensions::IconImage::Observer overrides:
34 virtual void OnExtensionIconImageChanged(
35 extensions::IconImage* image) OVERRIDE;
37 private:
38 typedef std::map<extensions::IconImage*, std::string> ImageToExtensionIDMap;
40 // Builds image for given |id| and |icon|.
41 void BuildImage(const std::string& id, const gfx::ImageSkia& icon);
43 Profile* profile_;
45 // The delegate object which receives the icon images. No ownership.
46 AppIconLoader::Delegate* delegate_;
48 // Maps from IconImage pointer to the extension id.
49 ImageToExtensionIDMap map_;
51 const int icon_size_;
53 DISALLOW_COPY_AND_ASSIGN(AppIconLoaderImpl);
56 } // namespace extensions
58 #endif // CHROME_BROWSER_EXTENSIONS_APP_ICON_LOADER_IMPL_H_