Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / child / process_control_impl.h
blob02e2ecb061519ea08f8383a724c5a8e0b3af3df0
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.
5 #ifndef CONTENT_CHILD_PROCESS_CONTROL_IMPL_H_
6 #define CONTENT_CHILD_PROCESS_CONTROL_IMPL_H_
8 #include <map>
10 #include "base/macros.h"
11 #include "content/common/process_control.mojom.h"
12 #include "mojo/application/public/interfaces/application.mojom.h"
13 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h"
15 class GURL;
17 namespace mojo {
18 namespace shell {
19 class ApplicationLoader;
20 } // namespace shell
21 } // namespace mojo
23 namespace content {
25 // Default implementation of the ProcessControl interface.
26 class ProcessControlImpl : public ProcessControl {
27 public:
28 ProcessControlImpl();
29 ~ProcessControlImpl() override;
31 using URLToLoaderMap = std::map<GURL, mojo::shell::ApplicationLoader*>;
33 // Registers Mojo applications loaders for URLs.
34 virtual void RegisterApplicationLoaders(
35 URLToLoaderMap* url_to_loader_map) = 0;
37 // ProcessControl:
38 void LoadApplication(const mojo::String& url,
39 mojo::InterfaceRequest<mojo::Application> request,
40 const LoadApplicationCallback& callback) override;
42 private:
43 // Called if a LoadApplication request fails.
44 virtual void OnLoadFailed() {}
46 bool has_registered_loaders_ = false;
47 URLToLoaderMap url_to_loader_map_;
49 DISALLOW_COPY_AND_ASSIGN(ProcessControlImpl);
52 } // namespace content
54 #endif // CONTENT_CHILD_PROCESS_CONTROL_IMPL_H_