| 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 "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 29 matching lines...) Expand all Loading... |
| 40 const base::FilePath& private_key_output_path, | 40 const base::FilePath& private_key_output_path, |
| 41 int run_flags) { | 41 int run_flags) { |
| 42 // Validate input |extension_dir|. | 42 // Validate input |extension_dir|. |
| 43 if (extension_dir.value().empty() || | 43 if (extension_dir.value().empty() || |
| 44 !file_util::DirectoryExists(extension_dir)) { | 44 !file_util::DirectoryExists(extension_dir)) { |
| 45 error_message_ = | 45 error_message_ = |
| 46 l10n_util::GetStringUTF8(IDS_EXTENSION_DIRECTORY_NO_EXISTS); | 46 l10n_util::GetStringUTF8(IDS_EXTENSION_DIRECTORY_NO_EXISTS); |
| 47 return false; | 47 return false; |
| 48 } | 48 } |
| 49 | 49 |
| 50 base::FilePath absolute_extension_dir = extension_dir; | 50 base::FilePath absolute_extension_dir = |
| 51 if (!file_util::AbsolutePath(&absolute_extension_dir)) { | 51 base::MakeAbsoluteFilePath(extension_dir); |
| 52 if (absolute_extension_dir.empty()) { |
| 52 error_message_ = | 53 error_message_ = |
| 53 l10n_util::GetStringUTF8(IDS_EXTENSION_CANT_GET_ABSOLUTE_PATH); | 54 l10n_util::GetStringUTF8(IDS_EXTENSION_CANT_GET_ABSOLUTE_PATH); |
| 54 return false; | 55 return false; |
| 55 } | 56 } |
| 56 | 57 |
| 57 // Validate input |private_key| (if provided). | 58 // Validate input |private_key| (if provided). |
| 58 if (!private_key_path.value().empty() && | 59 if (!private_key_path.value().empty() && |
| 59 !file_util::PathExists(private_key_path)) { | 60 !file_util::PathExists(private_key_path)) { |
| 60 error_message_ = | 61 error_message_ = |
| 61 l10n_util::GetStringUTF8(IDS_EXTENSION_PRIVATE_KEY_INVALID_PATH); | 62 l10n_util::GetStringUTF8(IDS_EXTENSION_PRIVATE_KEY_INVALID_PATH); |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 SignZip(zip_path, key_pair.get(), &signature) && | 320 SignZip(zip_path, key_pair.get(), &signature) && |
| 320 WriteCRX(zip_path, key_pair.get(), signature, crx_path)) { | 321 WriteCRX(zip_path, key_pair.get(), signature, crx_path)) { |
| 321 result = true; | 322 result = true; |
| 322 } | 323 } |
| 323 | 324 |
| 324 file_util::Delete(zip_path, false); | 325 file_util::Delete(zip_path, false); |
| 325 return result; | 326 return result; |
| 326 } | 327 } |
| 327 | 328 |
| 328 } // namespace extensions | 329 } // namespace extensions |
| OLD | NEW |