| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "shell/dynamic_application_loader.h" | 5 #include "shell/dynamic_application_loader.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 | 283 |
| 284 void AsPath( | 284 void AsPath( |
| 285 base::TaskRunner* task_runner, | 285 base::TaskRunner* task_runner, |
| 286 base::Callback<void(const base::FilePath&, bool)> callback) override { | 286 base::Callback<void(const base::FilePath&, bool)> callback) override { |
| 287 if (!path_.empty() || !response_) { | 287 if (!path_.empty() || !response_) { |
| 288 base::MessageLoop::current()->PostTask( | 288 base::MessageLoop::current()->PostTask( |
| 289 FROM_HERE, base::Bind(callback, path_, base::PathExists(path_))); | 289 FROM_HERE, base::Bind(callback, path_, base::PathExists(path_))); |
| 290 return; | 290 return; |
| 291 } | 291 } |
| 292 base::CreateTemporaryFile(&path_); | 292 base::CreateTemporaryFile(&path_); |
| 293 #if defined(OS_ANDROID) | |
| 294 // This is used to extract symbols on android. | 293 // This is used to extract symbols on android. |
| 295 LOG(INFO) << "Caching mojo app " << url_ << " at " << path_.value(); | 294 LOG(INFO) << "Caching mojo app " << url_ << " at " << path_.value(); |
| 296 #endif | |
| 297 common::CopyToFile(response_->body.Pass(), path_, task_runner, | 295 common::CopyToFile(response_->body.Pass(), path_, task_runner, |
| 298 base::Bind(callback, path_)); | 296 base::Bind(callback, path_)); |
| 299 } | 297 } |
| 300 | 298 |
| 301 std::string MimeType() override { | 299 std::string MimeType() override { |
| 302 DCHECK(response_); | 300 DCHECK(response_); |
| 303 return response_->mime_type; | 301 return response_->mime_type; |
| 304 } | 302 } |
| 305 | 303 |
| 306 bool HasMojoMagic() override { | 304 bool HasMojoMagic() override { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 // TODO(darin): What should we do about service errors? This implies that | 401 // TODO(darin): What should we do about service errors? This implies that |
| 404 // the app closed its handle to the service manager. Maybe we don't care? | 402 // the app closed its handle to the service manager. Maybe we don't care? |
| 405 } | 403 } |
| 406 | 404 |
| 407 void DynamicApplicationLoader::LoaderComplete(Loader* loader) { | 405 void DynamicApplicationLoader::LoaderComplete(Loader* loader) { |
| 408 loaders_.erase(std::find(loaders_.begin(), loaders_.end(), loader)); | 406 loaders_.erase(std::find(loaders_.begin(), loaders_.end(), loader)); |
| 409 } | 407 } |
| 410 | 408 |
| 411 } // namespace shell | 409 } // namespace shell |
| 412 } // namespace mojo | 410 } // namespace mojo |
| OLD | NEW |