| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_APP_ICON_LOADER_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_APP_ICON_LOADER_H_ |
| 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_APP_ICON_LOADER_H_ | 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_APP_ICON_LOADER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "chrome/browser/extensions/extension_icon_image.h" |
| 12 #include "chrome/browser/extensions/image_loading_tracker.h" | |
| 13 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 12 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 14 | 13 |
| 15 class Profile; | 14 class Profile; |
| 16 | 15 |
| 17 namespace extensions { | 16 namespace extensions { |
| 18 class Extension; | 17 class Extension; |
| 19 } | 18 } |
| 20 | 19 |
| 21 | 20 |
| 22 // Default implementation of LauncherUpdater::AppIconLoader that interacts | 21 // Default implementation of LauncherUpdater::AppIconLoader that interacts |
| 23 // with the ExtensionService and ImageLoadingTracker to load images. | 22 // with the ExtensionService and ImageLoadingTracker to load images. |
| 24 class LauncherAppIconLoader : public ChromeLauncherController::AppIconLoader, | 23 class LauncherAppIconLoader : public ChromeLauncherController::AppIconLoader, |
| 25 public ImageLoadingTracker::Observer { | 24 public extensions::IconImage::Observer { |
| 26 public: | 25 public: |
| 27 LauncherAppIconLoader(Profile* profile, ChromeLauncherController* host); | 26 LauncherAppIconLoader(Profile* profile, ChromeLauncherController* host); |
| 28 virtual ~LauncherAppIconLoader(); | 27 virtual ~LauncherAppIconLoader(); |
| 29 | 28 |
| 30 // AppIconLoader: | 29 // AppIconLoader overrides: |
| 31 virtual void FetchImage(const std::string& id) OVERRIDE; | 30 virtual void FetchImage(const std::string& id) OVERRIDE; |
| 31 virtual void ClearImage(const std::string& id) OVERRIDE; |
| 32 | 32 |
| 33 // ImageLoadingTracker::Observer: | 33 // extensions::IconImage::Observer overrides: |
| 34 virtual void OnImageLoaded(const gfx::Image& image, | 34 virtual void OnExtensionIconImageChanged( |
| 35 const std::string& extension_id, | 35 extensions::IconImage* image) OVERRIDE; |
| 36 int index) OVERRIDE; | |
| 37 | 36 |
| 38 private: | 37 private: |
| 39 typedef std::map<int, std::string> ImageLoaderIDToExtensionIDMap; | 38 typedef std::map<extensions::IconImage*, std::string> ImageToExtensionIDMap; |
| 40 | 39 |
| 41 Profile* profile_; | 40 Profile* profile_; |
| 42 | 41 |
| 43 // ChromeLauncherController we're associated with (and owned by). | 42 // ChromeLauncherController we're associated with (and owned by). |
| 44 ChromeLauncherController* host_; | 43 ChromeLauncherController* host_; |
| 45 | 44 |
| 46 // Used to load images. | 45 // Maps from IconImage pointer to the extension id. |
| 47 scoped_ptr<ImageLoadingTracker> image_loader_; | 46 ImageToExtensionIDMap map_; |
| 48 | |
| 49 // Maps from id from the ImageLoadingTracker to the extension id. | |
| 50 ImageLoaderIDToExtensionIDMap map_; | |
| 51 | 47 |
| 52 DISALLOW_COPY_AND_ASSIGN(LauncherAppIconLoader); | 48 DISALLOW_COPY_AND_ASSIGN(LauncherAppIconLoader); |
| 53 }; | 49 }; |
| 54 | 50 |
| 55 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_APP_ICON_LOADER_H_ | 51 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_APP_ICON_LOADER_H_ |
| OLD | NEW |