OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_manager.h" | 5 #include "mojo/shell/application_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 return true; | 110 return true; |
111 } | 111 } |
112 | 112 |
113 ApplicationInstance* ApplicationManager::GetApplicationInstance( | 113 ApplicationInstance* ApplicationManager::GetApplicationInstance( |
114 const Identity& identity) const { | 114 const Identity& identity) const { |
115 const auto& it = identity_to_instance_.find(identity); | 115 const auto& it = identity_to_instance_.find(identity); |
116 return it != identity_to_instance_.end() ? it->second : nullptr; | 116 return it != identity_to_instance_.end() ? it->second : nullptr; |
117 } | 117 } |
118 | 118 |
119 void ApplicationManager::CreateInstanceForHandle(ScopedHandle channel, | 119 void ApplicationManager::CreateInstanceForHandle(ScopedHandle channel, |
120 const GURL& url) { | 120 const GURL& url, |
| 121 CapabilityFilterPtr filter) { |
121 // Instances created by others are considered unique, and thus have no | 122 // Instances created by others are considered unique, and thus have no |
122 // identity. As such they cannot be connected to by anyone else, and so we | 123 // identity. As such they cannot be connected to by anyone else, and so we |
123 // never call ConnectToClient(). | 124 // never call ConnectToClient(). |
124 // TODO(beng): GetPermissiveCapabilityFilter() here obviously cannot make it | 125 // TODO(beng): GetPermissiveCapabilityFilter() here obviously cannot make it |
125 // to production. See note in application_manager.mojom. | 126 // to production. See note in application_manager.mojom. |
126 // http://crbug.com/555392 | 127 // http://crbug.com/555392 |
127 Identity target_id(url, std::string(), GetPermissiveCapabilityFilter()); | 128 CapabilityFilter local_filter = filter->filter.To<CapabilityFilter>(); |
| 129 Identity target_id(url, std::string(), local_filter); |
128 InterfaceRequest<Application> application_request = | 130 InterfaceRequest<Application> application_request = |
129 CreateInstance(target_id, base::Closure(), nullptr); | 131 CreateInstance(target_id, base::Closure(), nullptr); |
130 NativeRunner* runner = | 132 NativeRunner* runner = |
131 native_runner_factory_->Create(base::FilePath()).release(); | 133 native_runner_factory_->Create(base::FilePath()).release(); |
132 native_runners_.push_back(runner); | 134 native_runners_.push_back(runner); |
133 runner->InitHost(channel.Pass(), application_request.Pass()); | 135 runner->InitHost(channel.Pass(), application_request.Pass()); |
134 } | 136 } |
135 | 137 |
136 InterfaceRequest<Application> ApplicationManager::CreateAndConnectToInstance( | 138 InterfaceRequest<Application> ApplicationManager::CreateAndConnectToInstance( |
137 scoped_ptr<ConnectToApplicationParams> params, | 139 scoped_ptr<ConnectToApplicationParams> params, |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 native_runners_.erase( | 290 native_runners_.erase( |
289 std::find(native_runners_.begin(), native_runners_.end(), runner)); | 291 std::find(native_runners_.begin(), native_runners_.end(), runner)); |
290 } | 292 } |
291 | 293 |
292 Shell::ConnectToApplicationCallback EmptyConnectCallback() { | 294 Shell::ConnectToApplicationCallback EmptyConnectCallback() { |
293 return base::Bind(&OnEmptyOnConnectCallback); | 295 return base::Bind(&OnEmptyOnConnectCallback); |
294 } | 296 } |
295 | 297 |
296 } // namespace shell | 298 } // namespace shell |
297 } // namespace mojo | 299 } // namespace mojo |
OLD | NEW |