| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "extensions/common/file_util.h" | 5 #include "extensions/common/file_util.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/json/json_string_value_serializer.h" | 10 #include "base/json/json_string_value_serializer.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 return extension; | 37 return extension; |
| 38 } | 38 } |
| 39 | 39 |
| 40 scoped_refptr<Extension> LoadExtensionManifest( | 40 scoped_refptr<Extension> LoadExtensionManifest( |
| 41 const std::string& manifest_value, | 41 const std::string& manifest_value, |
| 42 const base::FilePath& manifest_dir, | 42 const base::FilePath& manifest_dir, |
| 43 Manifest::Location location, | 43 Manifest::Location location, |
| 44 int extra_flags, | 44 int extra_flags, |
| 45 std::string* error) { | 45 std::string* error) { |
| 46 JSONStringValueDeserializer deserializer(manifest_value); | 46 JSONStringValueDeserializer deserializer(manifest_value); |
| 47 scoped_ptr<base::Value> result(deserializer.Deserialize(NULL, error)); | 47 scoped_ptr<base::Value> result = deserializer.Deserialize(NULL, error); |
| 48 if (!result.get()) | 48 if (!result.get()) |
| 49 return NULL; | 49 return NULL; |
| 50 CHECK_EQ(base::Value::TYPE_DICTIONARY, result->GetType()); | 50 CHECK_EQ(base::Value::TYPE_DICTIONARY, result->GetType()); |
| 51 return LoadExtensionManifest( | 51 return LoadExtensionManifest( |
| 52 *base::DictionaryValue::From(result.Pass()).get(), manifest_dir, location, | 52 *base::DictionaryValue::From(result.Pass()).get(), manifest_dir, location, |
| 53 extra_flags, error); | 53 extra_flags, error); |
| 54 } | 54 } |
| 55 | 55 |
| 56 } // namespace | 56 } // namespace |
| 57 | 57 |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 base::FilePath actual_path = | 532 base::FilePath actual_path = |
| 533 extensions::file_util::ExtensionResourceURLToFilePath(url, root_path); | 533 extensions::file_util::ExtensionResourceURLToFilePath(url, root_path); |
| 534 EXPECT_EQ(expected_path.value(), actual_path.value()) << | 534 EXPECT_EQ(expected_path.value(), actual_path.value()) << |
| 535 " For the path " << url; | 535 " For the path " << url; |
| 536 } | 536 } |
| 537 // Remove temp files. | 537 // Remove temp files. |
| 538 ASSERT_TRUE(base::DeleteFile(root_path, true)); | 538 ASSERT_TRUE(base::DeleteFile(root_path, true)); |
| 539 } | 539 } |
| 540 | 540 |
| 541 } // namespace extensions | 541 } // namespace extensions |
| OLD | NEW |