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( | 296 base::RunLoop run_loop; |
297 profile, id, true, base::MessageLoop::QuitWhenIdleClosure()); | 297 helper.BeginInstall(profile, id, true, run_loop.QuitClosure()); |
| 298 run_loop.Run(); |
298 | 299 |
299 base::MessageLoop::current()->Run(); | |
300 if (!helper.success()) | 300 if (!helper.success()) |
301 LOG(ERROR) << "InstallFromWebstore failed with error: " << helper.error(); | 301 LOG(ERROR) << "InstallFromWebstore failed with error: " << helper.error(); |
302 return helper.success(); | 302 return helper.success(); |
303 } | 303 } |
304 | 304 |
305 void StartupHelper::LimitedInstallFromWebstore( | 305 void StartupHelper::LimitedInstallFromWebstore( |
306 const CommandLine& cmd_line, | 306 const CommandLine& cmd_line, |
307 Profile* profile, | 307 Profile* profile, |
308 base::Callback<void()> done_callback) { | 308 base::Callback<void()> done_callback) { |
309 std::string id = WebStoreIdFromLimitedInstallCmdLine(cmd_line); | 309 std::string id = WebStoreIdFromLimitedInstallCmdLine(cmd_line); |
(...skipping 21 matching lines...) Expand all Loading... |
331 } | 331 } |
332 return id; | 332 return id; |
333 } | 333 } |
334 | 334 |
335 StartupHelper::~StartupHelper() { | 335 StartupHelper::~StartupHelper() { |
336 if (pack_job_.get()) | 336 if (pack_job_.get()) |
337 pack_job_->ClearClient(); | 337 pack_job_->ClearClient(); |
338 } | 338 } |
339 | 339 |
340 } // namespace extensions | 340 } // namespace extensions |
OLD | NEW |