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 "mojo/shell/application_instance.h" | 5 #include "mojo/shell/application_instance.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/atomic_sequence_num.h" | 11 #include "base/atomic_sequence_num.h" |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
14 #include "mojo/common/common_type_converters.h" | 14 #include "mojo/common/common_type_converters.h" |
15 #include "mojo/common/url_type_converters.h" | 15 #include "mojo/common/url_type_converters.h" |
16 #include "mojo/shell/application_manager.h" | 16 #include "mojo/shell/application_manager.h" |
17 #include "mojo/shell/public/interfaces/content_handler.mojom.h" | 17 #include "mojo/shell/public/interfaces/content_handler.mojom.h" |
18 | 18 |
19 namespace mojo { | 19 namespace mojo { |
20 namespace shell { | 20 namespace shell { |
21 | 21 |
22 ApplicationInstance::ApplicationInstance( | 22 ApplicationInstance::ApplicationInstance( |
23 ApplicationPtr application, | 23 mojom::ApplicationPtr application, |
24 ApplicationManager* manager, | 24 ApplicationManager* manager, |
25 const Identity& identity, | 25 const Identity& identity, |
26 uint32_t requesting_content_handler_id, | 26 uint32_t requesting_content_handler_id, |
27 const base::Closure& on_application_end) | 27 const base::Closure& on_application_end) |
28 : manager_(manager), | 28 : manager_(manager), |
29 id_(GenerateUniqueID()), | 29 id_(GenerateUniqueID()), |
30 identity_(identity), | 30 identity_(identity), |
31 allow_any_application_(identity.filter().size() == 1 && | 31 allow_any_application_(identity.filter().size() == 1 && |
32 identity.filter().count("*") == 1), | 32 identity.filter().count("*") == 1), |
33 requesting_content_handler_id_(requesting_content_handler_id), | 33 requesting_content_handler_id_(requesting_content_handler_id), |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 void ApplicationInstance::BindPIDReceiver( | 72 void ApplicationInstance::BindPIDReceiver( |
73 InterfaceRequest<mojom::PIDReceiver> pid_receiver) { | 73 InterfaceRequest<mojom::PIDReceiver> pid_receiver) { |
74 pid_receiver_binding_.Bind(std::move(pid_receiver)); | 74 pid_receiver_binding_.Bind(std::move(pid_receiver)); |
75 } | 75 } |
76 | 76 |
77 // Shell implementation: | 77 // Shell implementation: |
78 void ApplicationInstance::ConnectToApplication( | 78 void ApplicationInstance::ConnectToApplication( |
79 URLRequestPtr app_request, | 79 URLRequestPtr app_request, |
80 InterfaceRequest<ServiceProvider> services, | 80 InterfaceRequest<ServiceProvider> services, |
81 ServiceProviderPtr exposed_services, | 81 ServiceProviderPtr exposed_services, |
82 CapabilityFilterPtr filter, | 82 mojom::CapabilityFilterPtr filter, |
83 const ConnectToApplicationCallback& callback) { | 83 const ConnectToApplicationCallback& callback) { |
84 std::string url_string = app_request->url.To<std::string>(); | 84 std::string url_string = app_request->url.To<std::string>(); |
85 GURL url(url_string); | 85 GURL url(url_string); |
86 if (!url.is_valid()) { | 86 if (!url.is_valid()) { |
87 LOG(ERROR) << "Error: invalid URL: " << url_string; | 87 LOG(ERROR) << "Error: invalid URL: " << url_string; |
88 callback.Run(kInvalidApplicationID, kInvalidApplicationID); | 88 callback.Run(kInvalidApplicationID, kInvalidApplicationID); |
89 return; | 89 return; |
90 } | 90 } |
91 if (allow_any_application_ || | 91 if (allow_any_application_ || |
92 identity_.filter().find(url.spec()) != identity_.filter().end()) { | 92 identity_.filter().find(url.spec()) != identity_.filter().end()) { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 191 |
192 queue_requests_ = false; | 192 queue_requests_ = false; |
193 for (auto request : queued_client_requests_) | 193 for (auto request : queued_client_requests_) |
194 CallAcceptConnection(make_scoped_ptr(request)); | 194 CallAcceptConnection(make_scoped_ptr(request)); |
195 | 195 |
196 queued_client_requests_.clear(); | 196 queued_client_requests_.clear(); |
197 } | 197 } |
198 | 198 |
199 } // namespace shell | 199 } // namespace shell |
200 } // namespace mojo | 200 } // namespace mojo |
OLD | NEW |