| Index: mojo/shell/in_thread_application_loader.cc
|
| diff --git a/mojo/shell/in_thread_application_loader.cc b/mojo/shell/in_thread_application_loader.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..40ef382bb4fc0888767de40b540b079ec42bed48
|
| --- /dev/null
|
| +++ b/mojo/shell/in_thread_application_loader.cc
|
| @@ -0,0 +1,45 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "mojo/shell/in_thread_application_loader.h"
|
| +
|
| +#include "base/bind.h"
|
| +#include "base/macros.h"
|
| +#include "base/memory/ref_counted.h"
|
| +#include "base/task_runner.h"
|
| +#include "base/thread_task_runner_handle.h"
|
| +#include "mojo/application/public/cpp/application_delegate.h"
|
| +#include "mojo/application/public/cpp/application_impl.h"
|
| +#include "mojo/application/public/interfaces/application.mojom.h"
|
| +#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h"
|
| +
|
| +namespace mojo {
|
| +namespace shell {
|
| +
|
| +InThreadApplicationLoader::InThreadApplicationLoader(
|
| + const ApplicationFactory& factory)
|
| + : InThreadApplicationLoader(factory, base::Closure()) {}
|
| +
|
| +InThreadApplicationLoader::InThreadApplicationLoader(
|
| + const ApplicationFactory& factory,
|
| + const base::Closure& termination_closure)
|
| + : factory_(factory),
|
| + termination_closure_(termination_closure),
|
| + weak_factory_(this) {}
|
| +
|
| +InThreadApplicationLoader::~InThreadApplicationLoader() {}
|
| +
|
| +void InThreadApplicationLoader::Load(const GURL& url,
|
| + InterfaceRequest<Application> request) {
|
| + // TODO(xhwang): Handle repeating Load requests?
|
| +
|
| + application_delegate_ = factory_.Run();
|
| + DCHECK(application_delegate_);
|
| +
|
| + application_impl_.reset(new ApplicationImpl(
|
| + application_delegate_.get(), request.Pass(), termination_closure_));
|
| +}
|
| +
|
| +} // namespace shell
|
| +} // namespace mojo
|
|
|