OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 COMPONENTS_ARC_INTENT_HELPER_ACTIVITY_ICON_LOADER_H_ | 5 #ifndef COMPONENTS_ARC_INTENT_HELPER_ACTIVITY_ICON_LOADER_H_ |
6 #define COMPONENTS_ARC_INTENT_HELPER_ACTIVITY_ICON_LOADER_H_ | 6 #define COMPONENTS_ARC_INTENT_HELPER_ACTIVITY_ICON_LOADER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 16 matching lines...) Expand all Loading... |
27 struct Icons { | 27 struct Icons { |
28 Icons(const gfx::Image& icon16, const gfx::Image& icon48); | 28 Icons(const gfx::Image& icon16, const gfx::Image& icon48); |
29 const gfx::Image icon16; // 16 dip | 29 const gfx::Image icon16; // 16 dip |
30 const gfx::Image icon48; // 48 dip | 30 const gfx::Image icon48; // 48 dip |
31 }; | 31 }; |
32 | 32 |
33 struct ActivityName { | 33 struct ActivityName { |
34 ActivityName(const std::string& package_name, | 34 ActivityName(const std::string& package_name, |
35 const std::string& activity_name); | 35 const std::string& activity_name); |
36 bool operator<(const ActivityName& other) const; | 36 bool operator<(const ActivityName& other) const; |
| 37 |
37 // TODO(yusukes): Add const to these variables later. At this point, | 38 // TODO(yusukes): Add const to these variables later. At this point, |
38 // doing so seems to confuse g++ 4.6 on builders. | 39 // doing so seems to confuse g++ 4.6 on builders. |
39 std::string package_name; | 40 std::string package_name; |
| 41 |
| 42 // Can be empty. When |activity_name| is empty, the loader tries to fetch |
| 43 // the package's default icon. |
40 std::string activity_name; | 44 std::string activity_name; |
41 }; | 45 }; |
42 | 46 |
43 using ActivityToIconsMap = std::map<ActivityName, Icons>; | 47 using ActivityToIconsMap = std::map<ActivityName, Icons>; |
44 using OnIconsReadyCallback = | 48 using OnIconsReadyCallback = |
45 base::Callback<void(std::unique_ptr<ActivityToIconsMap>)>; | 49 base::Callback<void(std::unique_ptr<ActivityToIconsMap>)>; |
46 | 50 |
47 ActivityIconLoader(); | 51 ActivityIconLoader(); |
48 | 52 |
49 // Removes icons associated with |package_name| from the cache. | 53 // Removes icons associated with |package_name| from the cache. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 ActivityToIconsMap cached_icons_; | 93 ActivityToIconsMap cached_icons_; |
90 | 94 |
91 base::ThreadChecker thread_checker_; | 95 base::ThreadChecker thread_checker_; |
92 | 96 |
93 DISALLOW_COPY_AND_ASSIGN(ActivityIconLoader); | 97 DISALLOW_COPY_AND_ASSIGN(ActivityIconLoader); |
94 }; | 98 }; |
95 | 99 |
96 } // namespace arc | 100 } // namespace arc |
97 | 101 |
98 #endif // COMPONENTS_ARC_INTENT_HELPER_ACTIVITY_ICON_LOADER_H_ | 102 #endif // COMPONENTS_ARC_INTENT_HELPER_ACTIVITY_ICON_LOADER_H_ |
OLD | NEW |