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

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

Issue 6263008: Move ResourceBundle, DataPack to ui/base (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 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_dummy.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "app/resource_bundle.h" 5 #include "ui/base/resource/resource_bundle.h"
6 6
7 #include "app/data_pack.h"
8 #include "base/lock.h" 7 #include "base/lock.h"
9 #include "base/logging.h" 8 #include "base/logging.h"
10 #include "base/stl_util-inl.h" 9 #include "base/stl_util-inl.h"
11 #include "base/string_piece.h" 10 #include "base/string_piece.h"
12 #include "build/build_config.h" 11 #include "build/build_config.h"
13 #include "gfx/codec/png_codec.h" 12 #include "gfx/codec/png_codec.h"
14 #include "gfx/font.h" 13 #include "gfx/font.h"
15 #include "third_party/skia/include/core/SkBitmap.h" 14 #include "third_party/skia/include/core/SkBitmap.h"
15 #include "ui/base/resource/data_pack.h"
16
17 namespace ui {
16 18
17 namespace { 19 namespace {
18 20
19 // Font sizes relative to base font. 21 // Font sizes relative to base font.
20 #if defined(OS_CHROMEOS) && defined(CROS_FONTS_USING_BCI) 22 #if defined(OS_CHROMEOS) && defined(CROS_FONTS_USING_BCI)
21 const int kSmallFontSizeDelta = -3; 23 const int kSmallFontSizeDelta = -3;
22 const int kMediumFontSizeDelta = 2; 24 const int kMediumFontSizeDelta = 2;
23 const int kLargeFontSizeDelta = 7; 25 const int kLargeFontSizeDelta = 7;
24 #else 26 #else
25 const int kSmallFontSizeDelta = -2; 27 const int kSmallFontSizeDelta = -2;
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 : path_(path) { 242 : path_(path) {
241 // Always preload the data packs so we can maintain constness. 243 // Always preload the data packs so we can maintain constness.
242 Load(); 244 Load();
243 } 245 }
244 246
245 ResourceBundle::LoadedDataPack::~LoadedDataPack() { 247 ResourceBundle::LoadedDataPack::~LoadedDataPack() {
246 } 248 }
247 249
248 void ResourceBundle::LoadedDataPack::Load() { 250 void ResourceBundle::LoadedDataPack::Load() {
249 DCHECK(!data_pack_.get()); 251 DCHECK(!data_pack_.get());
250 data_pack_.reset(new app::DataPack); 252 data_pack_.reset(new ui::DataPack);
251 bool success = data_pack_->Load(path_); 253 bool success = data_pack_->Load(path_);
252 LOG_IF(ERROR, !success) << "Failed to load " << path_.value() 254 LOG_IF(ERROR, !success) << "Failed to load " << path_.value()
253 << "\nYou will not be able to use the Bookmarks Manager or " 255 << "\nYou will not be able to use the Bookmarks Manager or "
254 << "about:net-internals."; 256 << "about:net-internals.";
255 } 257 }
256 258
257 bool ResourceBundle::LoadedDataPack::GetStringPiece( 259 bool ResourceBundle::LoadedDataPack::GetStringPiece(
258 int resource_id, base::StringPiece* data) const { 260 int resource_id, base::StringPiece* data) const {
259 return data_pack_->GetStringPiece(static_cast<uint32>(resource_id), data); 261 return data_pack_->GetStringPiece(static_cast<uint32>(resource_id), data);
260 } 262 }
261 263
262 RefCountedStaticMemory* ResourceBundle::LoadedDataPack::GetStaticMemory( 264 RefCountedStaticMemory* ResourceBundle::LoadedDataPack::GetStaticMemory(
263 int resource_id) const { 265 int resource_id) const {
264 return data_pack_->GetStaticMemory(resource_id); 266 return data_pack_->GetStaticMemory(resource_id);
265 } 267 }
268
269 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/resource/resource_bundle.h ('k') | ui/base/resource/resource_bundle_dummy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698