Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: extensions/utility/unpacker.cc

Issue 2321823002: Exclude exe files while unzipping CRXes (Closed)
Patch Set: Devlin comments Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « extensions/utility/unpacker.h ('k') | extensions/utility/unpacker_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « extensions/utility/unpacker.h ('k') | extensions/utility/unpacker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698