OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "ui/base/resource/resource_bundle.h" | 5 #include "ui/base/resource/resource_bundle.h" |
6 | 6 |
7 #import <AppKit/AppKit.h> | 7 #import <AppKit/AppKit.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 } | 66 } |
67 | 67 |
68 // The Material Design data packs contain some of the same asset IDs as in | 68 // The Material Design data packs contain some of the same asset IDs as in |
69 // the non-Material Design data packs. Set aside the current packs and add the | 69 // the non-Material Design data packs. Set aside the current packs and add the |
70 // Material Design packs so that they are searched first when a request for an | 70 // Material Design packs so that they are searched first when a request for an |
71 // asset is made. The Material Design packs cannot be loaded in | 71 // asset is made. The Material Design packs cannot be loaded in |
72 // LoadCommonResources() because the MaterialDesignController is not always | 72 // LoadCommonResources() because the MaterialDesignController is not always |
73 // initialized at the time it is called. | 73 // initialized at the time it is called. |
74 // TODO(shrike) - remove this method and restore loading of Material Design | 74 // TODO(shrike) - remove this method and restore loading of Material Design |
75 // packs to LoadCommonResources() when the MaterialDesignController goes away. | 75 // packs to LoadCommonResources() when the MaterialDesignController goes away. |
76 std::vector<scoped_ptr<ResourceHandle>> tmp_packs; | 76 std::vector<std::unique_ptr<ResourceHandle>> tmp_packs; |
77 for (auto it = data_packs_.begin(); it != data_packs_.end(); ++it) { | 77 for (auto it = data_packs_.begin(); it != data_packs_.end(); ++it) { |
78 scoped_ptr<ResourceHandle> next_pack(*it); | 78 std::unique_ptr<ResourceHandle> next_pack(*it); |
79 tmp_packs.push_back(std::move(next_pack)); | 79 tmp_packs.push_back(std::move(next_pack)); |
80 } | 80 } |
81 data_packs_.weak_clear(); | 81 data_packs_.weak_clear(); |
82 | 82 |
83 AddMaterialDesignDataPackFromPath( | 83 AddMaterialDesignDataPackFromPath( |
84 GetResourcesPakFilePath(@"chrome_material_100_percent", nil), | 84 GetResourcesPakFilePath(@"chrome_material_100_percent", nil), |
85 SCALE_FACTOR_100P); | 85 SCALE_FACTOR_100P); |
86 | 86 |
87 AddOptionalMaterialDesignDataPackFromPath( | 87 AddOptionalMaterialDesignDataPackFromPath( |
88 GetResourcesPakFilePath(@"chrome_material_200_percent", nil), | 88 GetResourcesPakFilePath(@"chrome_material_200_percent", nil), |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 205 |
206 // Another thread raced the load and has already cached the image. | 206 // Another thread raced the load and has already cached the image. |
207 if (images_.count(resource_id)) | 207 if (images_.count(resource_id)) |
208 return images_[resource_id]; | 208 return images_[resource_id]; |
209 | 209 |
210 images_[resource_id] = image; | 210 images_[resource_id] = image; |
211 return images_[resource_id]; | 211 return images_[resource_id]; |
212 } | 212 } |
213 | 213 |
214 } // namespace ui | 214 } // namespace ui |
OLD | NEW |