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 "extensions/utility/unpacker.h" | 5 #include "extensions/utility/unpacker.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <tuple> | 10 #include <tuple> |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 extension_dir_(extension_dir), | 108 extension_dir_(extension_dir), |
109 extension_id_(extension_id), | 109 extension_id_(extension_id), |
110 location_(location), | 110 location_(location), |
111 creation_flags_(creation_flags) { | 111 creation_flags_(creation_flags) { |
112 internal_data_.reset(new InternalData()); | 112 internal_data_.reset(new InternalData()); |
113 } | 113 } |
114 | 114 |
115 Unpacker::~Unpacker() { | 115 Unpacker::~Unpacker() { |
116 } | 116 } |
117 | 117 |
| 118 // static |
| 119 bool Unpacker::ShouldExtractFile(const base::FilePath& file_path) { |
| 120 return !base::FilePath::CompareEqualIgnoreCase(file_path.FinalExtension(), |
| 121 FILE_PATH_LITERAL(".exe")); |
| 122 } |
| 123 |
118 std::unique_ptr<base::DictionaryValue> Unpacker::ReadManifest() { | 124 std::unique_ptr<base::DictionaryValue> Unpacker::ReadManifest() { |
119 base::FilePath manifest_path = extension_dir_.Append(kManifestFilename); | 125 base::FilePath manifest_path = extension_dir_.Append(kManifestFilename); |
120 if (!base::PathExists(manifest_path)) { | 126 if (!base::PathExists(manifest_path)) { |
121 SetError(errors::kInvalidManifest); | 127 SetError(errors::kInvalidManifest); |
122 return NULL; | 128 return NULL; |
123 } | 129 } |
124 | 130 |
125 JSONFileValueDeserializer deserializer(manifest_path); | 131 JSONFileValueDeserializer deserializer(manifest_path); |
126 std::string error; | 132 std::string error; |
127 std::unique_ptr<base::Value> root = deserializer.Deserialize(NULL, &error); | 133 std::unique_ptr<base::Value> root = deserializer.Deserialize(NULL, &error); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 | 295 |
290 void Unpacker::SetError(const std::string& error) { | 296 void Unpacker::SetError(const std::string& error) { |
291 SetUTF16Error(base::UTF8ToUTF16(error)); | 297 SetUTF16Error(base::UTF8ToUTF16(error)); |
292 } | 298 } |
293 | 299 |
294 void Unpacker::SetUTF16Error(const base::string16& error) { | 300 void Unpacker::SetUTF16Error(const base::string16& error) { |
295 error_message_ = error; | 301 error_message_ = error; |
296 } | 302 } |
297 | 303 |
298 } // namespace extensions | 304 } // namespace extensions |
OLD | NEW |