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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 private: | 94 private: |
95 friend class base::RefCounted<ActivityIconLoader>; | 95 friend class base::RefCounted<ActivityIconLoader>; |
96 ~ActivityIconLoader(); | 96 ~ActivityIconLoader(); |
97 | 97 |
98 // A function called when the mojo IPC returns. | 98 // A function called when the mojo IPC returns. |
99 void OnIconsReady(std::unique_ptr<ActivityToIconsMap> cached_result, | 99 void OnIconsReady(std::unique_ptr<ActivityToIconsMap> cached_result, |
100 const OnIconsReadyCallback& cb, | 100 const OnIconsReadyCallback& cb, |
101 std::vector<mojom::ActivityIconPtr> icons); | 101 std::vector<mojom::ActivityIconPtr> icons); |
102 | 102 |
103 // Resizes and encodes |icons| and returns the results as ActivityToIconsMap. | 103 // Resizes and encodes |icons| and returns the results as ActivityToIconsMap. |
104 std::unique_ptr<ActivityToIconsMap> ResizeAndEncodeIcons( | 104 static std::unique_ptr<ActivityToIconsMap> ResizeAndEncodeIcons( |
105 std::vector<mojom::ActivityIconPtr> icons); | 105 std::vector<mojom::ActivityIconPtr> icons); |
106 | 106 |
107 // A function called when ResizeIcons finishes. Append items in |result| to | 107 // A function called when ResizeIcons finishes. Append items in |result| to |
108 // |cached_icons_|. | 108 // |cached_icons_|. |
109 void OnIconsResized(std::unique_ptr<ActivityToIconsMap> cached_result, | 109 void OnIconsResized(std::unique_ptr<ActivityToIconsMap> cached_result, |
110 const OnIconsReadyCallback& cb, | 110 const OnIconsReadyCallback& cb, |
111 std::unique_ptr<ActivityToIconsMap> result); | 111 std::unique_ptr<ActivityToIconsMap> result); |
112 | 112 |
113 // The maximum scale factor the current platform supports. | 113 // The maximum scale factor the current platform supports. |
114 const ui::ScaleFactor scale_factor_; | 114 const ui::ScaleFactor scale_factor_; |
115 // A map which holds icons in a scale-factor independent form (gfx::Image). | 115 // A map which holds icons in a scale-factor independent form (gfx::Image). |
116 ActivityToIconsMap cached_icons_; | 116 ActivityToIconsMap cached_icons_; |
117 | 117 |
118 base::ThreadChecker thread_checker_; | 118 base::ThreadChecker thread_checker_; |
119 | 119 |
120 DISALLOW_COPY_AND_ASSIGN(ActivityIconLoader); | 120 DISALLOW_COPY_AND_ASSIGN(ActivityIconLoader); |
121 }; | 121 }; |
122 | 122 |
123 } // namespace arc | 123 } // namespace arc |
124 | 124 |
125 #endif // COMPONENTS_ARC_INTENT_HELPER_ACTIVITY_ICON_LOADER_H_ | 125 #endif // COMPONENTS_ARC_INTENT_HELPER_ACTIVITY_ICON_LOADER_H_ |
OLD | NEW |