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 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/ref_counted_memory.h" | 9 #include "base/memory/ref_counted_memory.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 // Return just the name of the pack file. | 61 // Return just the name of the pack file. |
62 return FilePath(pak_name.c_str()); | 62 return FilePath(pak_name.c_str()); |
63 } | 63 } |
64 | 64 |
65 } // namespace | 65 } // namespace |
66 | 66 |
67 void ResourceBundle::LoadCommonResources() { | 67 void ResourceBundle::LoadCommonResources() { |
68 AddDataPackFromPath(GetResourcesPakFilePath("chrome.pak"), | 68 AddDataPackFromPath(GetResourcesPakFilePath("chrome.pak"), |
69 SCALE_FACTOR_100P); | 69 SCALE_FACTOR_100P); |
70 AddDataPackFromPath(GetResourcesPakFilePath( | 70 AddDataPackFromPath(GetResourcesPakFilePath("theme_resources_standard.pak"), |
71 "theme_resources_100_percent.pak"), | |
72 SCALE_FACTOR_100P); | 71 SCALE_FACTOR_100P); |
73 AddDataPackFromPath(GetResourcesPakFilePath( | 72 AddDataPackFromPath(GetResourcesPakFilePath("ui_resources_standard.pak"), |
74 "ui_resources_100_percent.pak"), | |
75 SCALE_FACTOR_100P); | 73 SCALE_FACTOR_100P); |
76 } | 74 } |
77 | 75 |
78 gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) { | 76 gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) { |
79 // Use the negative |resource_id| for the key for BIDI-aware images. | 77 // Use the negative |resource_id| for the key for BIDI-aware images. |
80 int key = rtl == RTL_ENABLED ? -resource_id : resource_id; | 78 int key = rtl == RTL_ENABLED ? -resource_id : resource_id; |
81 | 79 |
82 // Check to see if the image is already in the cache. | 80 // Check to see if the image is already in the cache. |
83 { | 81 { |
84 base::AutoLock lock_scope(*images_and_fonts_lock_); | 82 base::AutoLock lock_scope(*images_and_fonts_lock_); |
(...skipping 23 matching lines...) Expand all Loading... |
108 | 106 |
109 // Another thread raced the load and has already cached the image. | 107 // Another thread raced the load and has already cached the image. |
110 if (images_.count(key)) | 108 if (images_.count(key)) |
111 return images_[key]; | 109 return images_[key]; |
112 | 110 |
113 images_[key] = image; | 111 images_[key] = image; |
114 return images_[key]; | 112 return images_[key]; |
115 } | 113 } |
116 | 114 |
117 } // namespace ui | 115 } // namespace ui |
OLD | NEW |