| 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 "services/shell/shell.h" | 5 #include "services/shell/shell.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 | 160 |
| 161 void RemoveChild(Instance* child) { | 161 void RemoveChild(Instance* child) { |
| 162 auto it = children_.find(child); | 162 auto it = children_.find(child); |
| 163 DCHECK(it != children_.end()); | 163 DCHECK(it != children_.end()); |
| 164 children_.erase(it); | 164 children_.erase(it); |
| 165 child->parent_ = nullptr; | 165 child->parent_ = nullptr; |
| 166 } | 166 } |
| 167 | 167 |
| 168 void ConnectToClient(std::unique_ptr<ConnectParams> params) { | 168 void ConnectToClient(std::unique_ptr<ConnectParams> params) { |
| 169 CHECK(shell_client_.is_bound()); | 169 CHECK(shell_client_.is_bound()); |
| 170 params->connect_callback().Run(mojom::ConnectResult::SUCCEEDED, | 170 if (!params->connect_callback().is_null()) { |
| 171 identity_.user_id(), id_); | 171 params->connect_callback().Run(mojom::ConnectResult::SUCCEEDED, |
| 172 identity_.user_id(), id_); |
| 173 } |
| 172 uint32_t source_id = mojom::kInvalidInstanceID; | 174 uint32_t source_id = mojom::kInvalidInstanceID; |
| 173 CapabilityRequest request; | 175 CapabilityRequest request; |
| 174 request.interfaces.insert("*"); | 176 request.interfaces.insert("*"); |
| 175 Instance* source = shell_->GetExistingInstance(params->source()); | 177 Instance* source = shell_->GetExistingInstance(params->source()); |
| 176 if (source) { | 178 if (source) { |
| 177 request = GenerateCapabilityRequestForConnection( | 179 request = GenerateCapabilityRequestForConnection( |
| 178 source->capability_spec_, identity_, capability_spec_); | 180 source->capability_spec_, identity_, capability_spec_); |
| 179 source_id = source->id(); | 181 source_id = source->id(); |
| 180 } | 182 } |
| 181 | 183 |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 | 785 |
| 784 // Now that the instance has a ShellClient, we can connect to it. | 786 // Now that the instance has a ShellClient, we can connect to it. |
| 785 instance->ConnectToClient(std::move(params)); | 787 instance->ConnectToClient(std::move(params)); |
| 786 } | 788 } |
| 787 | 789 |
| 788 base::WeakPtr<Shell> Shell::GetWeakPtr() { | 790 base::WeakPtr<Shell> Shell::GetWeakPtr() { |
| 789 return weak_ptr_factory_.GetWeakPtr(); | 791 return weak_ptr_factory_.GetWeakPtr(); |
| 790 } | 792 } |
| 791 | 793 |
| 792 } // namespace shell | 794 } // namespace shell |
| OLD | NEW |