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