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

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: REBASE 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
« no previous file with comments | « ui/base/resource/resource_bundle.h ('k') | ui/base/test/run_all_unittests.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 InitSharedInstance(NULL); 182 InitSharedInstance(NULL);
189 scoped_ptr<DataPack> data_pack(new DataPack(SCALE_FACTOR_100P)); 183 scoped_ptr<DataPack> data_pack(new DataPack(SCALE_FACTOR_100P));
190 if (!data_pack->LoadFromFileRegion(pak_file.Pass(), region)) { 184 if (!data_pack->LoadFromFileRegion(pak_file.Pass(), region)) {
191 NOTREACHED() << "failed to load pak file"; 185 NOTREACHED() << "failed to load pak file";
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 // static 851 // static
858 bool ResourceBundle::DecodePNG(const unsigned char* buf, 852 bool ResourceBundle::DecodePNG(const unsigned char* buf,
859 size_t size, 853 size_t size,
860 SkBitmap* bitmap, 854 SkBitmap* bitmap,
861 bool* fell_back_to_1x) { 855 bool* fell_back_to_1x) {
862 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); 856 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size);
863 return gfx::PNGCodec::Decode(buf, size, bitmap); 857 return gfx::PNGCodec::Decode(buf, size, bitmap);
864 } 858 }
865 859
866 } // namespace ui 860 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/resource/resource_bundle.h ('k') | ui/base/test/run_all_unittests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698