OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CONTENT_CHILD_PROCESS_CONTROL_IMPL_H_ | 5 #ifndef CONTENT_CHILD_PROCESS_CONTROL_IMPL_H_ |
6 #define CONTENT_CHILD_PROCESS_CONTROL_IMPL_H_ | 6 #define CONTENT_CHILD_PROCESS_CONTROL_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "content/common/process_control.mojom.h" | 11 #include "content/common/process_control.mojom.h" |
12 #include "mojo/public/cpp/bindings/interface_request.h" | 12 #include "mojo/public/cpp/bindings/interface_request.h" |
13 #include "mojo/shell/public/interfaces/application.mojom.h" | 13 #include "mojo/shell/public/interfaces/shell_client.mojom.h" |
14 | 14 |
15 class GURL; | 15 class GURL; |
16 | 16 |
17 namespace mojo { | 17 namespace mojo { |
18 namespace shell { | 18 namespace shell { |
19 class ApplicationLoader; | 19 class ApplicationLoader; |
20 } // namespace shell | 20 } // namespace shell |
21 } // namespace mojo | 21 } // namespace mojo |
22 | 22 |
23 namespace content { | 23 namespace content { |
24 | 24 |
25 // Default implementation of the ProcessControl interface. | 25 // Default implementation of the ProcessControl interface. |
26 class ProcessControlImpl : public ProcessControl { | 26 class ProcessControlImpl : public ProcessControl { |
27 public: | 27 public: |
28 ProcessControlImpl(); | 28 ProcessControlImpl(); |
29 ~ProcessControlImpl() override; | 29 ~ProcessControlImpl() override; |
30 | 30 |
31 using URLToLoaderMap = std::map<GURL, mojo::shell::ApplicationLoader*>; | 31 using URLToLoaderMap = std::map<GURL, mojo::shell::ApplicationLoader*>; |
32 | 32 |
33 // Registers Mojo applications loaders for URLs. | 33 // Registers Mojo applications loaders for URLs. |
34 virtual void RegisterApplicationLoaders( | 34 virtual void RegisterApplicationLoaders( |
35 URLToLoaderMap* url_to_loader_map) = 0; | 35 URLToLoaderMap* url_to_loader_map) = 0; |
36 | 36 |
37 // ProcessControl: | 37 // ProcessControl: |
38 void LoadApplication( | 38 void LoadApplication( |
39 const mojo::String& url, | 39 const mojo::String& url, |
40 mojo::InterfaceRequest<mojo::shell::mojom::Application> request, | 40 mojo::InterfaceRequest<mojo::shell::mojom::ShellClient> request, |
41 const LoadApplicationCallback& callback) override; | 41 const LoadApplicationCallback& callback) override; |
42 | 42 |
43 private: | 43 private: |
44 // Called if a LoadApplication request fails. | 44 // Called if a LoadApplication request fails. |
45 virtual void OnLoadFailed() {} | 45 virtual void OnLoadFailed() {} |
46 | 46 |
47 bool has_registered_loaders_ = false; | 47 bool has_registered_loaders_ = false; |
48 URLToLoaderMap url_to_loader_map_; | 48 URLToLoaderMap url_to_loader_map_; |
49 | 49 |
50 DISALLOW_COPY_AND_ASSIGN(ProcessControlImpl); | 50 DISALLOW_COPY_AND_ASSIGN(ProcessControlImpl); |
51 }; | 51 }; |
52 | 52 |
53 } // namespace content | 53 } // namespace content |
54 | 54 |
55 #endif // CONTENT_CHILD_PROCESS_CONTROL_IMPL_H_ | 55 #endif // CONTENT_CHILD_PROCESS_CONTROL_IMPL_H_ |
OLD | NEW |