| 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_VIEWS_ASH_LAUNCHER_LAUNCHER_APP_ICON_LOADER_H_ | 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_ | 6 #define CHROME_BROWSER_UI_VIEWS_ASH_LAUNCHER_LAUNCHER_APP_ICON_LOADER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 // Default implementation of LauncherUpdater::AppIconLoader that interacts | 23 // Default implementation of LauncherUpdater::AppIconLoader that interacts |
| 24 // with the ExtensionService and ImageLoadingTracker to load images. | 24 // with the ExtensionService and ImageLoadingTracker to load images. |
| 25 class LauncherAppIconLoader : public ChromeLauncherController::AppIconLoader, | 25 class LauncherAppIconLoader : public ChromeLauncherController::AppIconLoader, |
| 26 public ImageLoadingTracker::Observer { | 26 public ImageLoadingTracker::Observer { |
| 27 public: | 27 public: |
| 28 LauncherAppIconLoader(Profile* profile, ChromeLauncherController* host); | 28 LauncherAppIconLoader(Profile* profile, ChromeLauncherController* host); |
| 29 virtual ~LauncherAppIconLoader(); | 29 virtual ~LauncherAppIconLoader(); |
| 30 | 30 |
| 31 // AppIconLoader: | 31 // AppIconLoader: |
| 32 virtual std::string GetAppID(TabContentsWrapper* tab) OVERRIDE; | 32 virtual std::string GetAppID(TabContents* tab) OVERRIDE; |
| 33 virtual bool IsValidID(const std::string& id) OVERRIDE; | 33 virtual bool IsValidID(const std::string& id) OVERRIDE; |
| 34 virtual void FetchImage(const std::string& id) OVERRIDE; | 34 virtual void FetchImage(const std::string& id) OVERRIDE; |
| 35 | 35 |
| 36 // ImageLoadingTracker::Observer: | 36 // ImageLoadingTracker::Observer: |
| 37 virtual void OnImageLoaded(const gfx::Image& image, | 37 virtual void OnImageLoaded(const gfx::Image& image, |
| 38 const std::string& extension_id, | 38 const std::string& extension_id, |
| 39 int index) OVERRIDE; | 39 int index) OVERRIDE; |
| 40 | 40 |
| 41 private: | 41 private: |
| 42 typedef std::map<int, std::string> ImageLoaderIDToExtensionIDMap; | 42 typedef std::map<int, std::string> ImageLoaderIDToExtensionIDMap; |
| 43 | 43 |
| 44 // Returns the extension for the specified tab. | 44 // Returns the extension for the specified tab. |
| 45 const extensions::Extension* GetExtensionForTab(TabContentsWrapper* tab); | 45 const extensions::Extension* GetExtensionForTab(TabContents* tab); |
| 46 | 46 |
| 47 // Returns the extension by ID. | 47 // Returns the extension by ID. |
| 48 const extensions::Extension* GetExtensionByID(const std::string& id); | 48 const extensions::Extension* GetExtensionByID(const std::string& id); |
| 49 | 49 |
| 50 Profile* profile_; | 50 Profile* profile_; |
| 51 | 51 |
| 52 // ChromeLauncherController we're associated with (and owned by). | 52 // ChromeLauncherController we're associated with (and owned by). |
| 53 ChromeLauncherController* host_; | 53 ChromeLauncherController* host_; |
| 54 | 54 |
| 55 // Used to load images. | 55 // Used to load images. |
| 56 scoped_ptr<ImageLoadingTracker> image_loader_; | 56 scoped_ptr<ImageLoadingTracker> image_loader_; |
| 57 | 57 |
| 58 // Maps from id from the ImageLoadingTracker to the extension id. | 58 // Maps from id from the ImageLoadingTracker to the extension id. |
| 59 ImageLoaderIDToExtensionIDMap map_; | 59 ImageLoaderIDToExtensionIDMap map_; |
| 60 | 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(LauncherAppIconLoader); | 61 DISALLOW_COPY_AND_ASSIGN(LauncherAppIconLoader); |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 #endif // CHROME_BROWSER_UI_VIEWS_ASH_LAUNCHER_LAUNCHER_APP_ICON_LOADER_H_ | 64 #endif // CHROME_BROWSER_UI_VIEWS_ASH_LAUNCHER_LAUNCHER_APP_ICON_LOADER_H_ |
| OLD | NEW |