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 #include "content/browser/mojo/mojo_shell_context.h" | 5 #include "content/browser/mojo/mojo_shell_context.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 // The default loader to use for all applications. This does nothing but drop | 60 // The default loader to use for all applications. This does nothing but drop |
61 // the Application request. | 61 // the Application request. |
62 class DefaultApplicationLoader : public mojo::shell::ApplicationLoader { | 62 class DefaultApplicationLoader : public mojo::shell::ApplicationLoader { |
63 public: | 63 public: |
64 DefaultApplicationLoader() {} | 64 DefaultApplicationLoader() {} |
65 ~DefaultApplicationLoader() override {} | 65 ~DefaultApplicationLoader() override {} |
66 | 66 |
67 private: | 67 private: |
68 // mojo::shell::ApplicationLoader: | 68 // mojo::shell::ApplicationLoader: |
69 void Load(const GURL& url, | 69 void Load(const GURL& url, |
70 mojo::InterfaceRequest<mojo::shell::mojom::Application> request) | 70 mojo::InterfaceRequest<mojo::shell::mojom::ShellClient> request) |
71 override {} | 71 override {} |
72 | 72 |
73 DISALLOW_COPY_AND_ASSIGN(DefaultApplicationLoader); | 73 DISALLOW_COPY_AND_ASSIGN(DefaultApplicationLoader); |
74 }; | 74 }; |
75 | 75 |
76 // This launches a utility process and forwards the Load request the | 76 // This launches a utility process and forwards the Load request the |
77 // ProcessControl service there. The utility process is sandboxed iff | 77 // ProcessControl service there. The utility process is sandboxed iff |
78 // |use_sandbox| is true. | 78 // |use_sandbox| is true. |
79 class UtilityProcessLoader : public mojo::shell::ApplicationLoader { | 79 class UtilityProcessLoader : public mojo::shell::ApplicationLoader { |
80 public: | 80 public: |
81 UtilityProcessLoader(const base::string16& process_name, bool use_sandbox) | 81 UtilityProcessLoader(const base::string16& process_name, bool use_sandbox) |
82 : process_name_(process_name), use_sandbox_(use_sandbox) {} | 82 : process_name_(process_name), use_sandbox_(use_sandbox) {} |
83 ~UtilityProcessLoader() override {} | 83 ~UtilityProcessLoader() override {} |
84 | 84 |
85 private: | 85 private: |
86 // mojo::shell::ApplicationLoader: | 86 // mojo::shell::ApplicationLoader: |
87 void Load(const GURL& url, | 87 void Load(const GURL& url, |
88 mojo::InterfaceRequest<mojo::shell::mojom::Application> request) | 88 mojo::InterfaceRequest<mojo::shell::mojom::ShellClient> request) |
89 override { | 89 override { |
90 ProcessControlPtr process_control; | 90 ProcessControlPtr process_control; |
91 auto process_request = mojo::GetProxy(&process_control); | 91 auto process_request = mojo::GetProxy(&process_control); |
92 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 92 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
93 base::Bind(&StartUtilityProcessOnIOThread, | 93 base::Bind(&StartUtilityProcessOnIOThread, |
94 base::Passed(&process_request), | 94 base::Passed(&process_request), |
95 process_name_, use_sandbox_)); | 95 process_name_, use_sandbox_)); |
96 process_control->LoadApplication(url.spec(), std::move(request), | 96 process_control->LoadApplication(url.spec(), std::move(request), |
97 base::Bind(&OnApplicationLoaded, url)); | 97 base::Bind(&OnApplicationLoaded, url)); |
98 } | 98 } |
(...skipping 24 matching lines...) Expand all Loading... |
123 | 123 |
124 // Forwards the load request to the GPU process. | 124 // Forwards the load request to the GPU process. |
125 class GpuProcessLoader : public mojo::shell::ApplicationLoader { | 125 class GpuProcessLoader : public mojo::shell::ApplicationLoader { |
126 public: | 126 public: |
127 GpuProcessLoader() {} | 127 GpuProcessLoader() {} |
128 ~GpuProcessLoader() override {} | 128 ~GpuProcessLoader() override {} |
129 | 129 |
130 private: | 130 private: |
131 // mojo::shell::ApplicationLoader: | 131 // mojo::shell::ApplicationLoader: |
132 void Load(const GURL& url, | 132 void Load(const GURL& url, |
133 mojo::InterfaceRequest<mojo::shell::mojom::Application> request) | 133 mojo::InterfaceRequest<mojo::shell::mojom::ShellClient> request) |
134 override { | 134 override { |
135 ProcessControlPtr process_control; | 135 ProcessControlPtr process_control; |
136 auto process_request = mojo::GetProxy(&process_control); | 136 auto process_request = mojo::GetProxy(&process_control); |
137 BrowserThread::PostTask( | 137 BrowserThread::PostTask( |
138 BrowserThread::IO, FROM_HERE, | 138 BrowserThread::IO, FROM_HERE, |
139 base::Bind(&RequestGpuProcessControl, base::Passed(&process_request))); | 139 base::Bind(&RequestGpuProcessControl, base::Passed(&process_request))); |
140 process_control->LoadApplication(url.spec(), std::move(request), | 140 process_control->LoadApplication(url.spec(), std::move(request), |
141 base::Bind(&OnApplicationLoaded, url)); | 141 base::Bind(&OnApplicationLoaded, url)); |
142 } | 142 } |
143 | 143 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 mojo::shell::GetPermissiveCapabilityFilter())); | 283 mojo::shell::GetPermissiveCapabilityFilter())); |
284 params->SetTarget(mojo::shell::Identity(url, std::string(), filter)); | 284 params->SetTarget(mojo::shell::Identity(url, std::string(), filter)); |
285 params->set_services(std::move(request)); | 285 params->set_services(std::move(request)); |
286 params->set_exposed_services(std::move(exposed_services)); | 286 params->set_exposed_services(std::move(exposed_services)); |
287 params->set_on_application_end(base::Bind(&base::DoNothing)); | 287 params->set_on_application_end(base::Bind(&base::DoNothing)); |
288 params->set_connect_callback(callback); | 288 params->set_connect_callback(callback); |
289 application_manager_->ConnectToApplication(std::move(params)); | 289 application_manager_->ConnectToApplication(std::move(params)); |
290 } | 290 } |
291 | 291 |
292 } // namespace content | 292 } // namespace content |
OLD | NEW |