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_BROWSER_EXTENSIONS_APP_ICON_LOADER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_APP_ICON_LOADER_H_ 7 8 #include <string> 9 10 #include "base/basictypes.h" 11 12 namespace gfx { 13 class ImageSkia; 14 } 15 16 namespace extensions { 17 18 // Interface used to load app icons. This is in its own class so that it can 19 // be mocked. 20 class AppIconLoader { 21 public: 22 class Delegate { 23 public: ~Delegate()24 virtual ~Delegate() {} 25 26 // Called when the image for an app is loaded. 27 virtual void SetAppImage(const std::string& id, 28 const gfx::ImageSkia& image) = 0; 29 }; 30 AppIconLoader()31 AppIconLoader() {} ~AppIconLoader()32 virtual ~AppIconLoader() {} 33 34 // Fetches the image for the specified id. When done (which may be 35 // synchronous), this should invoke SetAppImage() on the delegate. 36 virtual void FetchImage(const std::string& id) = 0; 37 38 // Clears the image for the specified id. 39 virtual void ClearImage(const std::string& id) = 0; 40 41 // Updates the image for the specified id. This is called to re-create 42 // the app icon with latest app state (enabled or disabled/terminiated). 43 // SetAppImage() is called when done. 44 virtual void UpdateImage(const std::string& id) = 0; 45 46 private: 47 DISALLOW_COPY_AND_ASSIGN(AppIconLoader); 48 }; 49 50 } // namespace extensions 51 52 #endif // CHROME_BROWSER_EXTENSIONS_APP_ICON_LOADER_H_ 53