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 const std::string& qualifier) { | |
122 // Instances created by others are considered unique, and thus have no | 121 // Instances created by others are considered unique, and thus have no |
123 // identity. As such they cannot be connected to by anyone else, and so we | 122 // identity. As such they cannot be connected to by anyone else, and so we |
124 // never call ConnectToClient(). | 123 // never call ConnectToClient(). |
125 // TODO(beng): GetPermissiveCapabilityFilter() here obviously cannot make it | 124 // TODO(beng): GetPermissiveCapabilityFilter() here obviously cannot make it |
126 // to production. See note in application_manager.mojom. | 125 // to production. See note in application_manager.mojom. |
127 // http://crbug.com/555392 | 126 // http://crbug.com/555392 |
128 Identity target_id(url, qualifier, GetPermissiveCapabilityFilter()); | 127 Identity target_id(url, std::string(), GetPermissiveCapabilityFilter()); |
129 InterfaceRequest<Application> application_request = | 128 InterfaceRequest<Application> application_request = |
130 CreateInstance(target_id, base::Closure(), nullptr); | 129 CreateInstance(target_id, base::Closure(), nullptr); |
131 NativeRunner* runner = | 130 NativeRunner* runner = |
132 native_runner_factory_->Create(base::FilePath()).release(); | 131 native_runner_factory_->Create(base::FilePath()).release(); |
133 native_runners_.push_back(runner); | 132 native_runners_.push_back(runner); |
134 runner->InitHost(channel.Pass(), application_request.Pass()); | 133 runner->InitHost(channel.Pass(), application_request.Pass()); |
135 } | 134 } |
136 | 135 |
137 InterfaceRequest<Application> ApplicationManager::CreateAndConnectToInstance( | 136 InterfaceRequest<Application> ApplicationManager::CreateAndConnectToInstance( |
138 scoped_ptr<ConnectToApplicationParams> params, | 137 scoped_ptr<ConnectToApplicationParams> params, |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 native_runners_.erase( | 288 native_runners_.erase( |
290 std::find(native_runners_.begin(), native_runners_.end(), runner)); | 289 std::find(native_runners_.begin(), native_runners_.end(), runner)); |
291 } | 290 } |
292 | 291 |
293 Shell::ConnectToApplicationCallback EmptyConnectCallback() { | 292 Shell::ConnectToApplicationCallback EmptyConnectCallback() { |
294 return base::Bind(&OnEmptyOnConnectCallback); | 293 return base::Bind(&OnEmptyOnConnectCallback); |
295 } | 294 } |
296 | 295 |
297 } // namespace shell | 296 } // namespace shell |
298 } // namespace mojo | 297 } // namespace mojo |
OLD | NEW |