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

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

Issue 2321823002: Exclude exe files while unzipping CRXes (Closed)
Patch Set: Ignore case 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 !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
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
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