| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/resource_bundle.h" |
| 6 | 6 |
| 7 #include "base/data_pack.h" | 7 #include "app/data_pack.h" |
| 8 #include "base/lock.h" | 8 #include "base/lock.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "gfx/codec/png_codec.h" | 12 #include "gfx/codec/png_codec.h" |
| 13 #include "gfx/font.h" | 13 #include "gfx/font.h" |
| 14 #include "third_party/skia/include/core/SkBitmap.h" | 14 #include "third_party/skia/include/core/SkBitmap.h" |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 : path_(path) { | 239 : path_(path) { |
| 240 // Always preload the data packs so we can maintain constness. | 240 // Always preload the data packs so we can maintain constness. |
| 241 Load(); | 241 Load(); |
| 242 } | 242 } |
| 243 | 243 |
| 244 ResourceBundle::LoadedDataPack::~LoadedDataPack() { | 244 ResourceBundle::LoadedDataPack::~LoadedDataPack() { |
| 245 } | 245 } |
| 246 | 246 |
| 247 void ResourceBundle::LoadedDataPack::Load() { | 247 void ResourceBundle::LoadedDataPack::Load() { |
| 248 DCHECK(!data_pack_.get()); | 248 DCHECK(!data_pack_.get()); |
| 249 data_pack_.reset(new base::DataPack); | 249 data_pack_.reset(new app::DataPack); |
| 250 bool success = data_pack_->Load(path_); | 250 bool success = data_pack_->Load(path_); |
| 251 CHECK(success) << "Failed to load " << path_.value(); | 251 CHECK(success) << "Failed to load " << path_.value(); |
| 252 } | 252 } |
| 253 | 253 |
| 254 bool ResourceBundle::LoadedDataPack::GetStringPiece( | 254 bool ResourceBundle::LoadedDataPack::GetStringPiece( |
| 255 int resource_id, base::StringPiece* data) const { | 255 int resource_id, base::StringPiece* data) const { |
| 256 return data_pack_->GetStringPiece(static_cast<uint32>(resource_id), data); | 256 return data_pack_->GetStringPiece(static_cast<uint32>(resource_id), data); |
| 257 } | 257 } |
| 258 | 258 |
| 259 RefCountedStaticMemory* ResourceBundle::LoadedDataPack::GetStaticMemory( | 259 RefCountedStaticMemory* ResourceBundle::LoadedDataPack::GetStaticMemory( |
| 260 int resource_id) const { | 260 int resource_id) const { |
| 261 return data_pack_->GetStaticMemory(resource_id); | 261 return data_pack_->GetStaticMemory(resource_id); |
| 262 } | 262 } |
| OLD | NEW |