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

Side by Side Diff: chrome/common/extensions/unpacker.cc

Issue 12093036: Move Extension Location and Type enums to Manifest, and move InstallWarning to its own file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/extensions/unpacker.h ('k') | chrome/common/extensions/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 "chrome/common/extensions/unpacker.h" 5 #include "chrome/common/extensions/unpacker.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
11 #include "base/i18n/rtl.h" 11 #include "base/i18n/rtl.h"
12 #include "base/json/json_file_value_serializer.h" 12 #include "base/json/json_file_value_serializer.h"
13 #include "base/memory/scoped_handle.h" 13 #include "base/memory/scoped_handle.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "base/threading/thread.h" 15 #include "base/threading/thread.h"
16 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
17 #include "base/values.h" 17 #include "base/values.h"
18 #include "chrome/common/extensions/api/i18n/default_locale_handler.h" 18 #include "chrome/common/extensions/api/i18n/default_locale_handler.h"
19 #include "chrome/common/extensions/extension.h" 19 #include "chrome/common/extensions/extension.h"
20 #include "chrome/common/extensions/extension_file_util.h" 20 #include "chrome/common/extensions/extension_file_util.h"
21 #include "chrome/common/extensions/extension_l10n_util.h" 21 #include "chrome/common/extensions/extension_l10n_util.h"
22 #include "chrome/common/extensions/extension_manifest_constants.h" 22 #include "chrome/common/extensions/extension_manifest_constants.h"
23 #include "chrome/common/extensions/manifest.h"
23 #include "chrome/common/url_constants.h" 24 #include "chrome/common/url_constants.h"
24 #include "chrome/common/zip.h" 25 #include "chrome/common/zip.h"
25 #include "content/public/common/common_param_traits.h" 26 #include "content/public/common/common_param_traits.h"
26 #include "grit/generated_resources.h" 27 #include "grit/generated_resources.h"
27 #include "ipc/ipc_message_utils.h" 28 #include "ipc/ipc_message_utils.h"
28 #include "net/base/file_stream.h" 29 #include "net/base/file_stream.h"
29 #include "third_party/skia/include/core/SkBitmap.h" 30 #include "third_party/skia/include/core/SkBitmap.h"
30 #include "ui/base/l10n/l10n_util.h" 31 #include "ui/base/l10n/l10n_util.h"
31 #include "webkit/glue/image_decoder.h" 32 #include "webkit/glue/image_decoder.h"
32 33
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 78
78 return false; 79 return false;
79 } 80 }
80 81
81 } // namespace 82 } // namespace
82 83
83 namespace extensions { 84 namespace extensions {
84 85
85 Unpacker::Unpacker(const FilePath& extension_path, 86 Unpacker::Unpacker(const FilePath& extension_path,
86 const std::string& extension_id, 87 const std::string& extension_id,
87 Extension::Location location, 88 Manifest::Location location,
88 int creation_flags) 89 int creation_flags)
89 : extension_path_(extension_path), 90 : extension_path_(extension_path),
90 extension_id_(extension_id), 91 extension_id_(extension_id),
91 location_(location), 92 location_(location),
92 creation_flags_(creation_flags) { 93 creation_flags_(creation_flags) {
93 } 94 }
94 95
95 Unpacker::~Unpacker() { 96 Unpacker::~Unpacker() {
96 } 97 }
97 98
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 location_, 179 location_,
179 *parsed_manifest_, 180 *parsed_manifest_,
180 creation_flags_, 181 creation_flags_,
181 extension_id_, 182 extension_id_,
182 &error)); 183 &error));
183 if (!extension.get()) { 184 if (!extension.get()) {
184 SetError(error); 185 SetError(error);
185 return false; 186 return false;
186 } 187 }
187 188
188 Extension::InstallWarningVector warnings; 189 std::vector<InstallWarning> warnings;
189 if (!extension_file_util::ValidateExtension(extension.get(), 190 if (!extension_file_util::ValidateExtension(extension.get(),
190 &error, &warnings)) { 191 &error, &warnings)) {
191 SetError(error); 192 SetError(error);
192 return false; 193 return false;
193 } 194 }
194 extension->AddInstallWarnings(warnings); 195 extension->AddInstallWarnings(warnings);
195 196
196 // Decode any images that the browser needs to display. 197 // Decode any images that the browser needs to display.
197 std::set<FilePath> image_paths = extension->GetBrowserImages(); 198 std::set<FilePath> image_paths = extension->GetBrowserImages();
198 for (std::set<FilePath>::iterator it = image_paths.begin(); 199 for (std::set<FilePath>::iterator it = image_paths.begin();
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 332
332 void Unpacker::SetError(const std::string &error) { 333 void Unpacker::SetError(const std::string &error) {
333 SetUTF16Error(UTF8ToUTF16(error)); 334 SetUTF16Error(UTF8ToUTF16(error));
334 } 335 }
335 336
336 void Unpacker::SetUTF16Error(const string16 &error) { 337 void Unpacker::SetUTF16Error(const string16 &error) {
337 error_message_ = error; 338 error_message_ = error;
338 } 339 }
339 340
340 } // namespace extensions 341 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/unpacker.h ('k') | chrome/common/extensions/unpacker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698