| 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/startup_helper.h" | 5 #include "chrome/browser/extensions/startup_helper.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 // Input Paths. | 45 // Input Paths. |
| 46 FilePath src_dir = cmd_line.GetSwitchValuePath(switches::kPackExtension); | 46 FilePath src_dir = cmd_line.GetSwitchValuePath(switches::kPackExtension); |
| 47 FilePath private_key_path; | 47 FilePath private_key_path; |
| 48 if (cmd_line.HasSwitch(switches::kPackExtensionKey)) { | 48 if (cmd_line.HasSwitch(switches::kPackExtensionKey)) { |
| 49 private_key_path = cmd_line.GetSwitchValuePath(switches::kPackExtensionKey); | 49 private_key_path = cmd_line.GetSwitchValuePath(switches::kPackExtensionKey); |
| 50 } | 50 } |
| 51 | 51 |
| 52 // Launch a job to perform the packing on the file thread. Ignore warnings | 52 // Launch a job to perform the packing on the file thread. Ignore warnings |
| 53 // from the packing process. (e.g. Overwrite any existing crx file.) | 53 // from the packing process. (e.g. Overwrite any existing crx file.) |
| 54 pack_job_ = new PackExtensionJob(this, src_dir, private_key_path, | 54 int run_flags = |
| 55 ExtensionCreator::kOverwriteCRX); | 55 ExtensionCreator::kOverwriteCRX | |
| 56 ExtensionCreator::kRequireModernManifestVersion; |
| 57 pack_job_ = new PackExtensionJob(this, src_dir, private_key_path, run_flags); |
| 56 pack_job_->set_asynchronous(false); | 58 pack_job_->set_asynchronous(false); |
| 57 pack_job_->Start(); | 59 pack_job_->Start(); |
| 58 | 60 |
| 59 return pack_job_succeeded_; | 61 return pack_job_succeeded_; |
| 60 } | 62 } |
| 61 | 63 |
| 62 bool StartupHelper::UninstallExtension(const CommandLine& cmd_line, | 64 bool StartupHelper::UninstallExtension(const CommandLine& cmd_line, |
| 63 Profile* profile) { | 65 Profile* profile) { |
| 64 DCHECK(profile); | 66 DCHECK(profile); |
| 65 | 67 |
| 66 if (!cmd_line.HasSwitch(switches::kUninstallExtension)) | 68 if (!cmd_line.HasSwitch(switches::kUninstallExtension)) |
| 67 return false; | 69 return false; |
| 68 | 70 |
| 69 ExtensionService* extension_service = profile->GetExtensionService(); | 71 ExtensionService* extension_service = profile->GetExtensionService(); |
| 70 if (!extension_service) | 72 if (!extension_service) |
| 71 return false; | 73 return false; |
| 72 | 74 |
| 73 std::string extension_id = cmd_line.GetSwitchValueASCII( | 75 std::string extension_id = cmd_line.GetSwitchValueASCII( |
| 74 switches::kUninstallExtension); | 76 switches::kUninstallExtension); |
| 75 return ExtensionService::UninstallExtensionHelper(extension_service, | 77 return ExtensionService::UninstallExtensionHelper(extension_service, |
| 76 extension_id); | 78 extension_id); |
| 77 } | 79 } |
| 78 | 80 |
| 79 StartupHelper::~StartupHelper() { | 81 StartupHelper::~StartupHelper() { |
| 80 if (pack_job_.get()) | 82 if (pack_job_.get()) |
| 81 pack_job_->ClearClient(); | 83 pack_job_->ClearClient(); |
| 82 } | 84 } |
| 83 | 85 |
| 84 } // namespace extensions | 86 } // namespace extensions |
| OLD | NEW |