1 // Copyright 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_UI_WEBUI_CHROMEOS_LOGIN_SCREENLOCK_ICON_PROVIDER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SCREENLOCK_ICON_PROVIDER_H_ 7 8 #include <map> 9 10 #include "base/memory/weak_ptr.h" 11 #include "ui/gfx/image/image.h" 12 13 namespace chromeos { 14 15 // Stores icon images used by the screenlockPrivate API. This class is 16 // separate from ScreenlockIconSource for finer memory management. 17 class ScreenlockIconProvider 18 : public base::SupportsWeakPtr<ScreenlockIconProvider> { 19 public: 20 ScreenlockIconProvider(); 21 ~ScreenlockIconProvider(); 22 23 // Adds an icon image for |username| to be stored. 24 void AddIcon(const std::string& username, const gfx::Image& icon); 25 26 // Removes icon image for |username|. 27 void RemoveIcon(const std::string& username); 28 29 // Returns the icon image set for |username|. If no icon is found, then 30 // this function returns an empty image. 31 gfx::Image GetIcon(const std::string& username); 32 33 // Removes all stored icon images. 34 void Clear(); 35 36 private: 37 // Map of icons for the user pod buttons set by screenlockPrivate.showButton. 38 std::map<std::string, gfx::Image> user_icon_map_; 39 40 DISALLOW_COPY_AND_ASSIGN(ScreenlockIconProvider); 41 }; 42 43 } // namespace chromeos 44 45 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SCREENLOCK_ICON_PROVIDER_H_ 46