| 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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 bool StartupHelper::InstallFromWebstore(const CommandLine& cmd_line, | 293 bool StartupHelper::InstallFromWebstore(const CommandLine& cmd_line, |
| 294 Profile* profile) { | 294 Profile* profile) { |
| 295 std::string id = cmd_line.GetSwitchValueASCII(switches::kInstallFromWebstore); | 295 std::string id = cmd_line.GetSwitchValueASCII(switches::kInstallFromWebstore); |
| 296 if (!Extension::IdIsValid(id)) { | 296 if (!Extension::IdIsValid(id)) { |
| 297 LOG(ERROR) << "Invalid id for " << switches::kInstallFromWebstore | 297 LOG(ERROR) << "Invalid id for " << switches::kInstallFromWebstore |
| 298 << " : '" << id << "'"; | 298 << " : '" << id << "'"; |
| 299 return false; | 299 return false; |
| 300 } | 300 } |
| 301 | 301 |
| 302 AppInstallHelper helper; | 302 AppInstallHelper helper; |
| 303 helper.BeginInstall(profile, id, | 303 helper.BeginInstall(profile, |
| 304 id, |
| 304 !cmd_line.HasSwitch(switches::kForceAppMode), | 305 !cmd_line.HasSwitch(switches::kForceAppMode), |
| 305 MessageLoop::QuitWhenIdleClosure()); | 306 base::MessageLoop::QuitWhenIdleClosure()); |
| 306 | 307 |
| 307 MessageLoop::current()->Run(); | 308 base::MessageLoop::current()->Run(); |
| 308 if (!helper.success()) | 309 if (!helper.success()) |
| 309 LOG(ERROR) << "InstallFromWebstore failed with error: " << helper.error(); | 310 LOG(ERROR) << "InstallFromWebstore failed with error: " << helper.error(); |
| 310 return helper.success(); | 311 return helper.success(); |
| 311 } | 312 } |
| 312 | 313 |
| 313 void StartupHelper::LimitedInstallFromWebstore( | 314 void StartupHelper::LimitedInstallFromWebstore( |
| 314 const CommandLine& cmd_line, | 315 const CommandLine& cmd_line, |
| 315 Profile* profile, | 316 Profile* profile, |
| 316 base::Callback<void()> done_callback) { | 317 base::Callback<void()> done_callback) { |
| 317 std::string id = WebStoreIdFromLimitedInstallCmdLine(cmd_line); | 318 std::string id = WebStoreIdFromLimitedInstallCmdLine(cmd_line); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 339 } | 340 } |
| 340 return id; | 341 return id; |
| 341 } | 342 } |
| 342 | 343 |
| 343 StartupHelper::~StartupHelper() { | 344 StartupHelper::~StartupHelper() { |
| 344 if (pack_job_) | 345 if (pack_job_) |
| 345 pack_job_->ClearClient(); | 346 pack_job_->ClearClient(); |
| 346 } | 347 } |
| 347 | 348 |
| 348 } // namespace extensions | 349 } // namespace extensions |
| OLD | NEW |