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 file_path.FinalExtension() != FILE_PATH_LITERAL(".exe"); | |
hshi
2016/09/08 22:54:43
See filepath.h:
// Returns true if the file pat
meacer
2016/09/09 00:37:14
Oh, great catch! Done, and I updated the crx with
| |
121 } | |
122 | |
118 std::unique_ptr<base::DictionaryValue> Unpacker::ReadManifest() { | 123 std::unique_ptr<base::DictionaryValue> Unpacker::ReadManifest() { |
119 base::FilePath manifest_path = extension_dir_.Append(kManifestFilename); | 124 base::FilePath manifest_path = extension_dir_.Append(kManifestFilename); |
120 if (!base::PathExists(manifest_path)) { | 125 if (!base::PathExists(manifest_path)) { |
121 SetError(errors::kInvalidManifest); | 126 SetError(errors::kInvalidManifest); |
122 return NULL; | 127 return NULL; |
123 } | 128 } |
124 | 129 |
125 JSONFileValueDeserializer deserializer(manifest_path); | 130 JSONFileValueDeserializer deserializer(manifest_path); |
126 std::string error; | 131 std::string error; |
127 std::unique_ptr<base::Value> root = deserializer.Deserialize(NULL, &error); | 132 std::unique_ptr<base::Value> root = deserializer.Deserialize(NULL, &error); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
289 | 294 |
290 void Unpacker::SetError(const std::string& error) { | 295 void Unpacker::SetError(const std::string& error) { |
291 SetUTF16Error(base::UTF8ToUTF16(error)); | 296 SetUTF16Error(base::UTF8ToUTF16(error)); |
292 } | 297 } |
293 | 298 |
294 void Unpacker::SetUTF16Error(const base::string16& error) { | 299 void Unpacker::SetUTF16Error(const base::string16& error) { |
295 error_message_ = error; | 300 error_message_ = error; |
296 } | 301 } |
297 | 302 |
298 } // namespace extensions | 303 } // namespace extensions |
OLD | NEW |