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

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

Issue 10151025: Add scale factor tag to data packs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix build Created 8 years, 8 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 <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // Must call InitSharedInstance before this function. 82 // Must call InitSharedInstance before this function.
83 CHECK(g_shared_instance_ != NULL); 83 CHECK(g_shared_instance_ != NULL);
84 return *g_shared_instance_; 84 return *g_shared_instance_;
85 } 85 }
86 86
87 // static 87 // static
88 bool ResourceBundle::LocaleDataPakExists(const std::string& locale) { 88 bool ResourceBundle::LocaleDataPakExists(const std::string& locale) {
89 return !GetLocaleFilePath(locale).empty(); 89 return !GetLocaleFilePath(locale).empty();
90 } 90 }
91 91
92 void ResourceBundle::AddDataPack(const FilePath& path) { 92 void ResourceBundle::AddDataPack(const FilePath& path, float scale_factor) {
93 scoped_ptr<DataPack> data_pack(new DataPack()); 93 scoped_ptr<DataPack> data_pack(new DataPack());
94 if (data_pack->Load(path)) { 94 if (data_pack->Load(path)) {
95 data_pack->set_scale_factor(scale_factor);
95 data_packs_.push_back(data_pack.release()); 96 data_packs_.push_back(data_pack.release());
96 } else { 97 } else {
97 LOG(ERROR) << "Failed to load " << path.value() 98 LOG(ERROR) << "Failed to load " << path.value()
98 << "\nSome features may not be available."; 99 << "\nSome features may not be available.";
99 } 100 }
100 } 101 }
101 102
102 #if !defined(OS_MACOSX) 103 #if !defined(OS_MACOSX)
103 // static 104 // static
104 FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale) { 105 FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale) {
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 SkBitmap* bitmap = new SkBitmap(); 404 SkBitmap* bitmap = new SkBitmap();
404 bitmap->setConfig(SkBitmap::kARGB_8888_Config, 32, 32); 405 bitmap->setConfig(SkBitmap::kARGB_8888_Config, 32, 32);
405 bitmap->allocPixels(); 406 bitmap->allocPixels();
406 bitmap->eraseARGB(255, 255, 0, 0); 407 bitmap->eraseARGB(255, 255, 0, 0);
407 empty_image = new gfx::Image(bitmap); 408 empty_image = new gfx::Image(bitmap);
408 } 409 }
409 return empty_image; 410 return empty_image;
410 } 411 }
411 412
412 } // namespace ui 413 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698