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