Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: ui/base/resource/resource_bundle.cc

Issue 457103003: Merge ResourceBundle's InitSharedInstanceLocaleOnly with InitSharedInstanceWithLocale(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <limits> 7 #include <limits>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/big_endian.h" 10 #include "base/big_endian.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 157
158 private: 158 private:
159 ResourceBundle* rb_; 159 ResourceBundle* rb_;
160 const int resource_id_; 160 const int resource_id_;
161 161
162 DISALLOW_COPY_AND_ASSIGN(ResourceBundleImageSource); 162 DISALLOW_COPY_AND_ASSIGN(ResourceBundleImageSource);
163 }; 163 };
164 164
165 // static 165 // static
166 std::string ResourceBundle::InitSharedInstanceWithLocale( 166 std::string ResourceBundle::InitSharedInstanceWithLocale(
167 const std::string& pref_locale, Delegate* delegate) { 167 const std::string& pref_locale,
168 Delegate* delegate,
169 LoadResources load_resources) {
168 InitSharedInstance(delegate); 170 InitSharedInstance(delegate);
169 g_shared_instance_->LoadCommonResources(); 171 if (load_resources == LOAD_COMMON_RESOURCES)
172 g_shared_instance_->LoadCommonResources();
170 std::string result = g_shared_instance_->LoadLocaleResources(pref_locale); 173 std::string result = g_shared_instance_->LoadLocaleResources(pref_locale);
171 InitDefaultFontList(); 174 InitDefaultFontList();
172 return result; 175 return result;
173 }
174
175 // static
176 std::string ResourceBundle::InitSharedInstanceLocaleOnly(
177 const std::string& pref_locale, Delegate* delegate) {
178 InitSharedInstance(delegate);
179 std::string result = g_shared_instance_->LoadLocaleResources(pref_locale);
180 InitDefaultFontList();
181 return result;
182 } 176 }
183 177
184 // static 178 // static
185 void ResourceBundle::InitSharedInstanceWithPakFileRegion( 179 void ResourceBundle::InitSharedInstanceWithPakFileRegion(
186 base::File pak_file, 180 base::File pak_file,
187 const base::MemoryMappedFile::Region& region, 181 const base::MemoryMappedFile::Region& region,
188 bool should_load_common_resources) { 182 bool should_load_common_resources) {
189 InitSharedInstance(NULL); 183 InitSharedInstance(NULL);
190 if (should_load_common_resources) 184 if (should_load_common_resources)
191 g_shared_instance_->LoadCommonResources(); 185 g_shared_instance_->LoadCommonResources();
192 186
193 scoped_ptr<DataPack> data_pack( 187 scoped_ptr<DataPack> data_pack(new DataPack(SCALE_FACTOR_100P));
194 new DataPack(SCALE_FACTOR_100P));
195 if (!data_pack->LoadFromFileRegion(pak_file.Pass(), region)) { 188 if (!data_pack->LoadFromFileRegion(pak_file.Pass(), region)) {
196 NOTREACHED() << "failed to load pak file"; 189 NOTREACHED() << "failed to load pak file";
197 return; 190 return;
198 } 191 }
199 g_shared_instance_->locale_resources_data_.reset(data_pack.release()); 192 g_shared_instance_->locale_resources_data_.reset(data_pack.release());
200 InitDefaultFontList(); 193 InitDefaultFontList();
201 } 194 }
202 195
203 // static 196 // static
204 void ResourceBundle::InitSharedInstanceWithPakPath(const base::FilePath& path) { 197 void ResourceBundle::InitSharedInstanceWithPakPath(const base::FilePath& path) {
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 // static 855 // static
863 bool ResourceBundle::DecodePNG(const unsigned char* buf, 856 bool ResourceBundle::DecodePNG(const unsigned char* buf,
864 size_t size, 857 size_t size,
865 SkBitmap* bitmap, 858 SkBitmap* bitmap,
866 bool* fell_back_to_1x) { 859 bool* fell_back_to_1x) {
867 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); 860 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size);
868 return gfx::PNGCodec::Decode(buf, size, bitmap); 861 return gfx::PNGCodec::Decode(buf, size, bitmap);
869 } 862 }
870 863
871 } // namespace ui 864 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698