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

Side by Side Diff: chrome/browser/extensions/extension_creator.cc

Issue 16950028: Move file_util::Delete to the base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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
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/browser/extensions/extension_creator.h" 5 #include "chrome/browser/extensions/extension_creator.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 230
231 signature_creator->Final(signature); 231 signature_creator->Final(signature);
232 return true; 232 return true;
233 } 233 }
234 234
235 bool ExtensionCreator::WriteCRX(const base::FilePath& zip_path, 235 bool ExtensionCreator::WriteCRX(const base::FilePath& zip_path,
236 crypto::RSAPrivateKey* private_key, 236 crypto::RSAPrivateKey* private_key,
237 const std::vector<uint8>& signature, 237 const std::vector<uint8>& signature,
238 const base::FilePath& crx_path) { 238 const base::FilePath& crx_path) {
239 if (file_util::PathExists(crx_path)) 239 if (file_util::PathExists(crx_path))
240 file_util::Delete(crx_path, false); 240 base::Delete(crx_path, false);
241 ScopedStdioHandle crx_handle(file_util::OpenFile(crx_path, "wb")); 241 ScopedStdioHandle crx_handle(file_util::OpenFile(crx_path, "wb"));
242 if (!crx_handle.get()) { 242 if (!crx_handle.get()) {
243 error_message_ = l10n_util::GetStringUTF8(IDS_EXTENSION_SHARING_VIOLATION); 243 error_message_ = l10n_util::GetStringUTF8(IDS_EXTENSION_SHARING_VIOLATION);
244 return false; 244 return false;
245 } 245 }
246 246
247 std::vector<uint8> public_key; 247 std::vector<uint8> public_key;
248 CHECK(private_key->ExportPublicKey(&public_key)); 248 CHECK(private_key->ExportPublicKey(&public_key));
249 249
250 CrxFile::Error error; 250 CrxFile::Error error;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 // Zip up the extension. 315 // Zip up the extension.
316 base::FilePath zip_path; 316 base::FilePath zip_path;
317 std::vector<uint8> signature; 317 std::vector<uint8> signature;
318 bool result = false; 318 bool result = false;
319 if (CreateZip(extension_dir, temp_dir.path(), &zip_path) && 319 if (CreateZip(extension_dir, temp_dir.path(), &zip_path) &&
320 SignZip(zip_path, key_pair.get(), &signature) && 320 SignZip(zip_path, key_pair.get(), &signature) &&
321 WriteCRX(zip_path, key_pair.get(), signature, crx_path)) { 321 WriteCRX(zip_path, key_pair.get(), signature, crx_path)) {
322 result = true; 322 result = true;
323 } 323 }
324 324
325 file_util::Delete(zip_path, false); 325 base::Delete(zip_path, false);
326 return result; 326 return result;
327 } 327 }
328 328
329 } // namespace extensions 329 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_browsertest.cc ('k') | chrome/browser/extensions/extension_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698