| 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/utility/extensions/unpacker.h" | 5 #include "chrome/utility/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/file_enumerator.h" | 10 #include "base/files/file_enumerator.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 return true; | 163 return true; |
| 164 } | 164 } |
| 165 | 165 |
| 166 bool Unpacker::Run() { | 166 bool Unpacker::Run() { |
| 167 DVLOG(1) << "Installing extension " << extension_path_.value(); | 167 DVLOG(1) << "Installing extension " << extension_path_.value(); |
| 168 | 168 |
| 169 // <profile>/Extensions/CRX_INSTALL | 169 // <profile>/Extensions/CRX_INSTALL |
| 170 temp_install_dir_ = | 170 temp_install_dir_ = |
| 171 extension_path_.DirName().AppendASCII(kTempExtensionName); | 171 extension_path_.DirName().AppendASCII(kTempExtensionName); |
| 172 | 172 |
| 173 if (!file_util::CreateDirectory(temp_install_dir_)) { | 173 if (!base::CreateDirectory(temp_install_dir_)) { |
| 174 SetUTF16Error( | 174 SetUTF16Error( |
| 175 l10n_util::GetStringFUTF16( | 175 l10n_util::GetStringFUTF16( |
| 176 IDS_EXTENSION_PACKAGE_DIRECTORY_ERROR, | 176 IDS_EXTENSION_PACKAGE_DIRECTORY_ERROR, |
| 177 base::i18n::GetDisplayStringInLTRDirectionality( | 177 base::i18n::GetDisplayStringInLTRDirectionality( |
| 178 temp_install_dir_.LossyDisplayName()))); | 178 temp_install_dir_.LossyDisplayName()))); |
| 179 return false; | 179 return false; |
| 180 } | 180 } |
| 181 | 181 |
| 182 if (!zip::Unzip(extension_path_, temp_install_dir_)) { | 182 if (!zip::Unzip(extension_path_, temp_install_dir_)) { |
| 183 SetUTF16Error(l10n_util::GetStringUTF16(IDS_EXTENSION_PACKAGE_UNZIP_ERROR)); | 183 SetUTF16Error(l10n_util::GetStringUTF16(IDS_EXTENSION_PACKAGE_UNZIP_ERROR)); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 | 321 |
| 322 void Unpacker::SetError(const std::string &error) { | 322 void Unpacker::SetError(const std::string &error) { |
| 323 SetUTF16Error(UTF8ToUTF16(error)); | 323 SetUTF16Error(UTF8ToUTF16(error)); |
| 324 } | 324 } |
| 325 | 325 |
| 326 void Unpacker::SetUTF16Error(const string16 &error) { | 326 void Unpacker::SetUTF16Error(const string16 &error) { |
| 327 error_message_ = error; | 327 error_message_ = error; |
| 328 } | 328 } |
| 329 | 329 |
| 330 } // namespace extensions | 330 } // namespace extensions |
| OLD | NEW |