| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/utility/utility_handler.h" | 5 #include "extensions/utility/utility_handler.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "content/public/utility/utility_thread.h" | 9 #include "content/public/utility/utility_thread.h" |
| 10 #include "extensions/common/constants.h" | 10 #include "extensions/common/constants.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 const UnpackCallback& callback) override { | 56 const UnpackCallback& callback) override { |
| 57 CHECK_GT(location, Manifest::INVALID_LOCATION); | 57 CHECK_GT(location, Manifest::INVALID_LOCATION); |
| 58 CHECK_LT(location, Manifest::NUM_LOCATIONS); | 58 CHECK_LT(location, Manifest::NUM_LOCATIONS); |
| 59 DCHECK(ExtensionsClient::Get()); | 59 DCHECK(ExtensionsClient::Get()); |
| 60 | 60 |
| 61 content::UtilityThread::Get()->EnsureBlinkInitialized(); | 61 content::UtilityThread::Get()->EnsureBlinkInitialized(); |
| 62 | 62 |
| 63 Unpacker unpacker(path.DirName(), path, extension_id, location, | 63 Unpacker unpacker(path.DirName(), path, extension_id, location, |
| 64 creation_flags); | 64 creation_flags); |
| 65 if (unpacker.Run()) { | 65 if (unpacker.Run()) { |
| 66 callback.Run(base::string16(), unpacker.TakeParsedManifest()); | 66 callback.Run(base::string16(), std::move(*unpacker.TakeParsedManifest())); |
| 67 } else { | 67 } else { |
| 68 callback.Run(unpacker.error_message(), nullptr); | 68 callback.Run(unpacker.error_message(), base::nullopt); |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 | 71 |
| 72 static bool UnzipFileManifestIntoPath( | 72 static bool UnzipFileManifestIntoPath( |
| 73 const base::FilePath& file, | 73 const base::FilePath& file, |
| 74 const base::FilePath& path, | 74 const base::FilePath& path, |
| 75 std::unique_ptr<base::DictionaryValue>* manifest) { | 75 std::unique_ptr<base::DictionaryValue>* manifest) { |
| 76 if (zip::UnzipWithFilterCallback( | 76 if (zip::UnzipWithFilterCallback( |
| 77 file, path, base::Bind(&Unpacker::IsManifestFile), false)) { | 77 file, path, base::Bind(&Unpacker::IsManifestFile), false)) { |
| 78 std::string error; | 78 std::string error; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 if (running_elevated) | 141 if (running_elevated) |
| 142 return; | 142 return; |
| 143 | 143 |
| 144 registry->AddInterface(base::Bind(&ExtensionUnpackerImpl::Create)); | 144 registry->AddInterface(base::Bind(&ExtensionUnpackerImpl::Create)); |
| 145 registry->AddInterface(base::Bind(&ManifestParserImpl::Create)); | 145 registry->AddInterface(base::Bind(&ManifestParserImpl::Create)); |
| 146 } | 146 } |
| 147 | 147 |
| 148 } // namespace utility_handler | 148 } // namespace utility_handler |
| 149 | 149 |
| 150 } // namespace extensions | 150 } // namespace extensions |
| OLD | NEW |