| OLD | NEW |
| 1 // Copyright (c) 2011 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 "chrome/common/extensions/extension_unpacker.h" | 5 #include "chrome/common/extensions/extension_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/memory/scoped_handle.h" | 10 #include "base/memory/scoped_handle.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 } | 100 } |
| 101 | 101 |
| 102 JSONFileValueSerializer serializer(manifest_path); | 102 JSONFileValueSerializer serializer(manifest_path); |
| 103 std::string error; | 103 std::string error; |
| 104 scoped_ptr<Value> root(serializer.Deserialize(NULL, &error)); | 104 scoped_ptr<Value> root(serializer.Deserialize(NULL, &error)); |
| 105 if (!root.get()) { | 105 if (!root.get()) { |
| 106 SetError(error); | 106 SetError(error); |
| 107 return NULL; | 107 return NULL; |
| 108 } | 108 } |
| 109 | 109 |
| 110 if (!root->IsType(Value::TYPE_DICTIONARY)) { | 110 if (!root->IsDictionary()) { |
| 111 SetError(errors::kInvalidManifest); | 111 SetError(errors::kInvalidManifest); |
| 112 return NULL; | 112 return NULL; |
| 113 } | 113 } |
| 114 | 114 |
| 115 return static_cast<DictionaryValue*>(root.release()); | 115 return static_cast<DictionaryValue*>(root.release()); |
| 116 } | 116 } |
| 117 | 117 |
| 118 bool ExtensionUnpacker::ReadAllMessageCatalogs( | 118 bool ExtensionUnpacker::ReadAllMessageCatalogs( |
| 119 const std::string& default_locale) { | 119 const std::string& default_locale) { |
| 120 FilePath locales_path = | 120 FilePath locales_path = |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 return false; | 316 return false; |
| 317 } | 317 } |
| 318 parsed_catalogs_->Set(dir_name, root.release()); | 318 parsed_catalogs_->Set(dir_name, root.release()); |
| 319 | 319 |
| 320 return true; | 320 return true; |
| 321 } | 321 } |
| 322 | 322 |
| 323 void ExtensionUnpacker::SetError(const std::string &error) { | 323 void ExtensionUnpacker::SetError(const std::string &error) { |
| 324 error_message_ = error; | 324 error_message_ = error; |
| 325 } | 325 } |
| OLD | NEW |