OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 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_BROWSER_UI_VIEWS_ASH_LAUNCHER_LAUNCHER_APP_ICON_LOADER_H_ | |
6 #define CHROME_BROWSER_UI_VIEWS_ASH_LAUNCHER_LAUNCHER_APP_ICON_LOADER_H_ | |
7 | |
8 #include <map> | |
9 #include <string> | |
10 | |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "chrome/browser/extensions/image_loading_tracker.h" | |
13 #include "chrome/browser/ui/views/ash/launcher/chrome_launcher_controller.h" | |
14 | |
15 class Profile; | |
16 | |
17 namespace extensions { | |
18 class Extension; | |
19 } | |
20 | |
21 | |
22 // Default implementation of LauncherUpdater::AppIconLoader that interacts | |
23 // with the ExtensionService and ImageLoadingTracker to load images. | |
24 class LauncherAppIconLoader : public ChromeLauncherController::AppIconLoader, | |
25 public ImageLoadingTracker::Observer { | |
26 public: | |
27 LauncherAppIconLoader(Profile* profile, ChromeLauncherController* host); | |
28 virtual ~LauncherAppIconLoader(); | |
29 | |
30 // AppIconLoader: | |
31 virtual void FetchImage(const std::string& id) OVERRIDE; | |
32 | |
33 // ImageLoadingTracker::Observer: | |
34 virtual void OnImageLoaded(const gfx::Image& image, | |
35 const std::string& extension_id, | |
36 int index) OVERRIDE; | |
37 | |
38 private: | |
39 typedef std::map<int, std::string> ImageLoaderIDToExtensionIDMap; | |
40 | |
41 Profile* profile_; | |
42 | |
43 // ChromeLauncherController we're associated with (and owned by). | |
44 ChromeLauncherController* host_; | |
45 | |
46 // Used to load images. | |
47 scoped_ptr<ImageLoadingTracker> image_loader_; | |
48 | |
49 // Maps from id from the ImageLoadingTracker to the extension id. | |
50 ImageLoaderIDToExtensionIDMap map_; | |
51 | |
52 DISALLOW_COPY_AND_ASSIGN(LauncherAppIconLoader); | |
53 }; | |
54 | |
55 #endif // CHROME_BROWSER_UI_VIEWS_ASH_LAUNCHER_LAUNCHER_APP_ICON_LOADER_H_ | |
OLD | NEW |