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

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

Issue 419093002: ui: Remove ResourceBundle::LoadCommonResources(). Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: InitParams changes 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/resource/resource_bundle_android.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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 return gfx::ImageSkiaRep(image, scale); 155 return gfx::ImageSkiaRep(image, scale);
156 } 156 }
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 ResourceBundle::InitParams::InitParams() : delegate(NULL) {}
166
167 ResourceBundle::InitParams::~InitParams() {}
168
165 // static 169 // static
166 std::string ResourceBundle::InitSharedInstanceWithLocale( 170 std::string ResourceBundle::InitSharedInstanceWithLocale(
167 const std::string& pref_locale, Delegate* delegate) { 171 const std::string& pref_locale,
172 Delegate* delegate) {
168 InitSharedInstance(delegate); 173 InitSharedInstance(delegate);
169 g_shared_instance_->LoadCommonResources();
170 std::string result = g_shared_instance_->LoadLocaleResources(pref_locale); 174 std::string result = g_shared_instance_->LoadLocaleResources(pref_locale);
171 InitDefaultFontList(); 175 InitDefaultFontList();
172 return result; 176 return result;
173 } 177 }
174 178
175 // static 179 // static
176 std::string ResourceBundle::InitSharedInstanceLocaleOnly( 180 std::string ResourceBundle::InitSharedInstanceLocaleOnly(
177 const std::string& pref_locale, Delegate* delegate) { 181 const std::string& pref_locale,
182 Delegate* delegate) {
178 InitSharedInstance(delegate); 183 InitSharedInstance(delegate);
179 std::string result = g_shared_instance_->LoadLocaleResources(pref_locale); 184 std::string result = g_shared_instance_->LoadLocaleResources(pref_locale);
180 InitDefaultFontList(); 185 InitDefaultFontList();
181 return result; 186 return result;
182 } 187 }
183 188
184 // static 189 // static
185 void ResourceBundle::InitSharedInstanceWithPakFileRegion( 190 void ResourceBundle::InitSharedInstanceWithPakFileRegion(
186 base::File pak_file, 191 base::File pak_file,
187 const base::MemoryMappedFile::Region& region, 192 const base::MemoryMappedFile::Region& region,
188 bool should_load_common_resources) { 193 bool should_load_common_resources) {
189 InitSharedInstance(NULL); 194 InitSharedInstance(NULL);
190 if (should_load_common_resources)
191 g_shared_instance_->LoadCommonResources();
192 195
193 scoped_ptr<DataPack> data_pack( 196 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)) { 197 if (!data_pack->LoadFromFileRegion(pak_file.Pass(), region)) {
196 NOTREACHED() << "failed to load pak file"; 198 NOTREACHED() << "failed to load pak file";
197 return; 199 return;
198 } 200 }
199 g_shared_instance_->locale_resources_data_.reset(data_pack.release()); 201 g_shared_instance_->locale_resources_data_.reset(data_pack.release());
200 InitDefaultFontList(); 202 InitDefaultFontList();
201 } 203 }
202 204
203 // static 205 // static
204 void ResourceBundle::InitSharedInstanceWithPakPath(const base::FilePath& path) { 206 void ResourceBundle::InitSharedInstanceWithPakPath(const base::FilePath& path) {
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 // static 864 // static
863 bool ResourceBundle::DecodePNG(const unsigned char* buf, 865 bool ResourceBundle::DecodePNG(const unsigned char* buf,
864 size_t size, 866 size_t size,
865 SkBitmap* bitmap, 867 SkBitmap* bitmap,
866 bool* fell_back_to_1x) { 868 bool* fell_back_to_1x) {
867 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); 869 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size);
868 return gfx::PNGCodec::Decode(buf, size, bitmap); 870 return gfx::PNGCodec::Decode(buf, size, bitmap);
869 } 871 }
870 872
871 } // namespace ui 873 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/resource/resource_bundle.h ('k') | ui/base/resource/resource_bundle_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698