| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 helper->Start(); | 188 helper->Start(); |
| 189 if (!helper->finished()) | 189 if (!helper->finished()) |
| 190 run_loop.Run(); | 190 run_loop.Run(); |
| 191 | 191 |
| 192 bool success = helper->success(); | 192 bool success = helper->success(); |
| 193 if (!success) | 193 if (!success) |
| 194 *error = base::UTF16ToUTF8(helper->error()); | 194 *error = base::UTF16ToUTF8(helper->error()); |
| 195 return success; | 195 return success; |
| 196 } | 196 } |
| 197 | 197 |
| 198 bool StartupHelper::UninstallExtension(const CommandLine& cmd_line, | |
| 199 Profile* profile) { | |
| 200 DCHECK(profile); | |
| 201 | |
| 202 if (!cmd_line.HasSwitch(switches::kUninstallExtension)) | |
| 203 return false; | |
| 204 | |
| 205 ExtensionService* extension_service = profile->GetExtensionService(); | |
| 206 if (!extension_service) | |
| 207 return false; | |
| 208 | |
| 209 std::string extension_id = cmd_line.GetSwitchValueASCII( | |
| 210 switches::kUninstallExtension); | |
| 211 return ExtensionService::UninstallExtensionHelper(extension_service, | |
| 212 extension_id); | |
| 213 } | |
| 214 | |
| 215 namespace { | 198 namespace { |
| 216 | 199 |
| 217 class AppInstallHelper { | 200 class AppInstallHelper { |
| 218 public: | 201 public: |
| 219 // A callback for when the install process is done. | 202 // A callback for when the install process is done. |
| 220 typedef base::Callback<void()> DoneCallback; | 203 typedef base::Callback<void()> DoneCallback; |
| 221 | 204 |
| 222 AppInstallHelper(); | 205 AppInstallHelper(); |
| 223 virtual ~AppInstallHelper(); | 206 virtual ~AppInstallHelper(); |
| 224 bool success() { return success_; } | 207 bool success() { return success_; } |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 } | 314 } |
| 332 return id; | 315 return id; |
| 333 } | 316 } |
| 334 | 317 |
| 335 StartupHelper::~StartupHelper() { | 318 StartupHelper::~StartupHelper() { |
| 336 if (pack_job_.get()) | 319 if (pack_job_.get()) |
| 337 pack_job_->ClearClient(); | 320 pack_job_->ClearClient(); |
| 338 } | 321 } |
| 339 | 322 |
| 340 } // namespace extensions | 323 } // namespace extensions |
| OLD | NEW |