OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/common/file_util.h" | 5 #include "extensions/common/file_util.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 125 |
126 // Get a temp directory on the same file system as the profile. | 126 // Get a temp directory on the same file system as the profile. |
127 base::FilePath install_temp_dir = GetInstallTempDir(extensions_dir); | 127 base::FilePath install_temp_dir = GetInstallTempDir(extensions_dir); |
128 base::ScopedTempDir extension_temp_dir; | 128 base::ScopedTempDir extension_temp_dir; |
129 if (install_temp_dir.empty() || | 129 if (install_temp_dir.empty() || |
130 !extension_temp_dir.CreateUniqueTempDirUnderPath(install_temp_dir)) { | 130 !extension_temp_dir.CreateUniqueTempDirUnderPath(install_temp_dir)) { |
131 LOG(ERROR) << "Creating of temp dir under in the profile failed."; | 131 LOG(ERROR) << "Creating of temp dir under in the profile failed."; |
132 return base::FilePath(); | 132 return base::FilePath(); |
133 } | 133 } |
134 base::FilePath crx_temp_source = | 134 base::FilePath crx_temp_source = |
135 extension_temp_dir.path().Append(unpacked_source_dir.BaseName()); | 135 extension_temp_dir.GetPath().Append(unpacked_source_dir.BaseName()); |
136 if (!base::Move(unpacked_source_dir, crx_temp_source)) { | 136 if (!base::Move(unpacked_source_dir, crx_temp_source)) { |
137 LOG(ERROR) << "Moving extension from : " << unpacked_source_dir.value() | 137 LOG(ERROR) << "Moving extension from : " << unpacked_source_dir.value() |
138 << " to : " << crx_temp_source.value() << " failed."; | 138 << " to : " << crx_temp_source.value() << " failed."; |
139 return base::FilePath(); | 139 return base::FilePath(); |
140 } | 140 } |
141 | 141 |
142 // Try to find a free directory. There can be legitimate conflicts in the case | 142 // Try to find a free directory. There can be legitimate conflicts in the case |
143 // of overinstallation of the same version. | 143 // of overinstallation of the same version. |
144 const int kMaxAttempts = 100; | 144 const int kMaxAttempts = 100; |
145 for (int i = 0; i < kMaxAttempts; ++i) { | 145 for (int i = 0; i < kMaxAttempts; ++i) { |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 base::FilePath GetVerifiedContentsPath(const base::FilePath& extension_path) { | 620 base::FilePath GetVerifiedContentsPath(const base::FilePath& extension_path) { |
621 return extension_path.Append(kMetadataFolder) | 621 return extension_path.Append(kMetadataFolder) |
622 .Append(kVerifiedContentsFilename); | 622 .Append(kVerifiedContentsFilename); |
623 } | 623 } |
624 base::FilePath GetComputedHashesPath(const base::FilePath& extension_path) { | 624 base::FilePath GetComputedHashesPath(const base::FilePath& extension_path) { |
625 return extension_path.Append(kMetadataFolder).Append(kComputedHashesFilename); | 625 return extension_path.Append(kMetadataFolder).Append(kComputedHashesFilename); |
626 } | 626 } |
627 | 627 |
628 } // namespace file_util | 628 } // namespace file_util |
629 } // namespace extensions | 629 } // namespace extensions |
OLD | NEW |