| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "mojo/shell/in_thread_application_loader.h" |
| 6 |
| 7 #include "base/bind.h" |
| 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/task_runner.h" |
| 11 #include "base/thread_task_runner_handle.h" |
| 12 #include "mojo/application/public/cpp/application_delegate.h" |
| 13 #include "mojo/application/public/cpp/application_impl.h" |
| 14 #include "mojo/application/public/interfaces/application.mojom.h" |
| 15 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h" |
| 16 |
| 17 namespace mojo { |
| 18 namespace shell { |
| 19 |
| 20 InThreadApplicationLoader::InThreadApplicationLoader( |
| 21 const ApplicationFactory& factory) |
| 22 : InThreadApplicationLoader(factory, base::Closure()) {} |
| 23 |
| 24 InThreadApplicationLoader::InThreadApplicationLoader( |
| 25 const ApplicationFactory& factory, |
| 26 const base::Closure& termination_closure) |
| 27 : factory_(factory), |
| 28 termination_closure_(termination_closure), |
| 29 weak_factory_(this) {} |
| 30 |
| 31 InThreadApplicationLoader::~InThreadApplicationLoader() {} |
| 32 |
| 33 void InThreadApplicationLoader::Load(const GURL& url, |
| 34 InterfaceRequest<Application> request) { |
| 35 // TODO(xhwang): Handle repeating Load requests? |
| 36 |
| 37 application_delegate_ = factory_.Run(); |
| 38 DCHECK(application_delegate_); |
| 39 |
| 40 application_impl_.reset(new ApplicationImpl( |
| 41 application_delegate_.get(), request.Pass(), termination_closure_)); |
| 42 } |
| 43 |
| 44 } // namespace shell |
| 45 } // namespace mojo |
| OLD | NEW |