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 "chrome/utility/extensions/unpacker.h" | 5 #include "chrome/utility/extensions/unpacker.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_enumerator.h" | 10 #include "base/files/file_enumerator.h" |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 internal_data_->decoded_images.push_back(MakeTuple(image_bitmap, path)); | 282 internal_data_->decoded_images.push_back(MakeTuple(image_bitmap, path)); |
283 return true; | 283 return true; |
284 } | 284 } |
285 | 285 |
286 bool Unpacker::ReadMessageCatalog(const base::FilePath& message_path) { | 286 bool Unpacker::ReadMessageCatalog(const base::FilePath& message_path) { |
287 std::string error; | 287 std::string error; |
288 JSONFileValueSerializer serializer(message_path); | 288 JSONFileValueSerializer serializer(message_path); |
289 scoped_ptr<base::DictionaryValue> root(static_cast<base::DictionaryValue*>( | 289 scoped_ptr<base::DictionaryValue> root(static_cast<base::DictionaryValue*>( |
290 serializer.Deserialize(NULL, &error))); | 290 serializer.Deserialize(NULL, &error))); |
291 if (!root.get()) { | 291 if (!root.get()) { |
292 string16 messages_file = message_path.LossyDisplayName(); | 292 base::string16 messages_file = message_path.LossyDisplayName(); |
293 if (error.empty()) { | 293 if (error.empty()) { |
294 // If file is missing, Deserialize will fail with empty error. | 294 // If file is missing, Deserialize will fail with empty error. |
295 SetError(base::StringPrintf("%s %s", errors::kLocalesMessagesFileMissing, | 295 SetError(base::StringPrintf("%s %s", errors::kLocalesMessagesFileMissing, |
296 UTF16ToUTF8(messages_file).c_str())); | 296 UTF16ToUTF8(messages_file).c_str())); |
297 } else { | 297 } else { |
298 SetError(base::StringPrintf("%s: %s", | 298 SetError(base::StringPrintf("%s: %s", |
299 UTF16ToUTF8(messages_file).c_str(), | 299 UTF16ToUTF8(messages_file).c_str(), |
300 error.c_str())); | 300 error.c_str())); |
301 } | 301 } |
302 return false; | 302 return false; |
(...skipping 13 matching lines...) Expand all Loading... |
316 } | 316 } |
317 parsed_catalogs_->Set(dir_name, root.release()); | 317 parsed_catalogs_->Set(dir_name, root.release()); |
318 | 318 |
319 return true; | 319 return true; |
320 } | 320 } |
321 | 321 |
322 void Unpacker::SetError(const std::string &error) { | 322 void Unpacker::SetError(const std::string &error) { |
323 SetUTF16Error(UTF8ToUTF16(error)); | 323 SetUTF16Error(UTF8ToUTF16(error)); |
324 } | 324 } |
325 | 325 |
326 void Unpacker::SetUTF16Error(const string16 &error) { | 326 void Unpacker::SetUTF16Error(const base::string16& error) { |
327 error_message_ = error; | 327 error_message_ = error; |
328 } | 328 } |
329 | 329 |
330 } // namespace extensions | 330 } // namespace extensions |
OLD | NEW |