| 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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 bool StartupHelper::InstallFromWebstore(const CommandLine& cmd_line, | 286 bool StartupHelper::InstallFromWebstore(const CommandLine& cmd_line, |
| 287 Profile* profile) { | 287 Profile* profile) { |
| 288 std::string id = cmd_line.GetSwitchValueASCII(switches::kInstallFromWebstore); | 288 std::string id = cmd_line.GetSwitchValueASCII(switches::kInstallFromWebstore); |
| 289 if (!Extension::IdIsValid(id)) { | 289 if (!Extension::IdIsValid(id)) { |
| 290 LOG(ERROR) << "Invalid id for " << switches::kInstallFromWebstore | 290 LOG(ERROR) << "Invalid id for " << switches::kInstallFromWebstore |
| 291 << " : '" << id << "'"; | 291 << " : '" << id << "'"; |
| 292 return false; | 292 return false; |
| 293 } | 293 } |
| 294 | 294 |
| 295 AppInstallHelper helper; | 295 AppInstallHelper helper; |
| 296 helper.BeginInstall(profile, id, | 296 helper.BeginInstall( |
| 297 !cmd_line.HasSwitch(switches::kForceAppMode), | 297 profile, id, true, base::MessageLoop::QuitWhenIdleClosure()); |
| 298 base::MessageLoop::QuitWhenIdleClosure()); | |
| 299 | 298 |
| 300 base::MessageLoop::current()->Run(); | 299 base::MessageLoop::current()->Run(); |
| 301 if (!helper.success()) | 300 if (!helper.success()) |
| 302 LOG(ERROR) << "InstallFromWebstore failed with error: " << helper.error(); | 301 LOG(ERROR) << "InstallFromWebstore failed with error: " << helper.error(); |
| 303 return helper.success(); | 302 return helper.success(); |
| 304 } | 303 } |
| 305 | 304 |
| 306 void StartupHelper::LimitedInstallFromWebstore( | 305 void StartupHelper::LimitedInstallFromWebstore( |
| 307 const CommandLine& cmd_line, | 306 const CommandLine& cmd_line, |
| 308 Profile* profile, | 307 Profile* profile, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 332 } | 331 } |
| 333 return id; | 332 return id; |
| 334 } | 333 } |
| 335 | 334 |
| 336 StartupHelper::~StartupHelper() { | 335 StartupHelper::~StartupHelper() { |
| 337 if (pack_job_.get()) | 336 if (pack_job_.get()) |
| 338 pack_job_->ClearClient(); | 337 pack_job_->ClearClient(); |
| 339 } | 338 } |
| 340 | 339 |
| 341 } // namespace extensions | 340 } // namespace extensions |
| OLD | NEW |