| OLD | NEW |
| 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/data_pack.h" | 5 #include "ui/base/resource/data_pack.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/memory_mapped_file.h" | 10 #include "base/files/memory_mapped_file.h" |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 data->set(mmap_->data() + target->file_offset, length); | 193 data->set(mmap_->data() + target->file_offset, length); |
| 194 return true; | 194 return true; |
| 195 } | 195 } |
| 196 | 196 |
| 197 base::RefCountedStaticMemory* DataPack::GetStaticMemory( | 197 base::RefCountedStaticMemory* DataPack::GetStaticMemory( |
| 198 uint16 resource_id) const { | 198 uint16 resource_id) const { |
| 199 base::StringPiece piece; | 199 base::StringPiece piece; |
| 200 if (!GetStringPiece(resource_id, &piece)) | 200 if (!GetStringPiece(resource_id, &piece)) |
| 201 return NULL; | 201 return NULL; |
| 202 | 202 |
| 203 return new base::RefCountedStaticMemory( | 203 return new base::RefCountedStaticMemory(piece.data(), piece.length()); |
| 204 reinterpret_cast<const unsigned char*>(piece.data()), piece.length()); | |
| 205 } | 204 } |
| 206 | 205 |
| 207 ResourceHandle::TextEncodingType DataPack::GetTextEncodingType() const { | 206 ResourceHandle::TextEncodingType DataPack::GetTextEncodingType() const { |
| 208 return text_encoding_type_; | 207 return text_encoding_type_; |
| 209 } | 208 } |
| 210 | 209 |
| 211 ui::ScaleFactor DataPack::GetScaleFactor() const { | 210 ui::ScaleFactor DataPack::GetScaleFactor() const { |
| 212 return scale_factor_; | 211 return scale_factor_; |
| 213 } | 212 } |
| 214 | 213 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 return false; | 296 return false; |
| 298 } | 297 } |
| 299 } | 298 } |
| 300 | 299 |
| 301 base::CloseFile(file); | 300 base::CloseFile(file); |
| 302 | 301 |
| 303 return true; | 302 return true; |
| 304 } | 303 } |
| 305 | 304 |
| 306 } // namespace ui | 305 } // namespace ui |
| OLD | NEW |