| 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/public/cpp/service_context.h" | 5 #include "services/shell/public/cpp/service_context.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "mojo/public/cpp/bindings/interface_ptr.h" | 10 #include "mojo/public/cpp/bindings/interface_ptr.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 identity_ = identity.To<Identity>(); | 53 identity_ = identity.To<Identity>(); |
| 54 if (!initialize_handler_.is_null()) | 54 if (!initialize_handler_.is_null()) |
| 55 initialize_handler_.Run(); | 55 initialize_handler_.Run(); |
| 56 | 56 |
| 57 callback.Run(std::move(pending_connector_request_)); | 57 callback.Run(std::move(pending_connector_request_)); |
| 58 | 58 |
| 59 DCHECK(binding_.is_bound()); | 59 DCHECK(binding_.is_bound()); |
| 60 binding_.set_connection_error_handler( | 60 binding_.set_connection_error_handler( |
| 61 base::Bind(&ServiceContext::OnConnectionError, base::Unretained(this))); | 61 base::Bind(&ServiceContext::OnConnectionError, base::Unretained(this))); |
| 62 | 62 |
| 63 service_->OnStart(connector_.get(), identity_, id); | 63 service_->OnStart(identity_); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void ServiceContext::OnConnect( | 66 void ServiceContext::OnConnect( |
| 67 mojom::IdentityPtr source, | 67 mojom::IdentityPtr source, |
| 68 uint32_t source_id, | 68 uint32_t source_id, |
| 69 mojom::InterfaceProviderRequest local_interfaces, | 69 mojom::InterfaceProviderRequest local_interfaces, |
| 70 mojom::InterfaceProviderPtr remote_interfaces, | 70 mojom::InterfaceProviderPtr remote_interfaces, |
| 71 mojom::CapabilityRequestPtr allowed_capabilities, | 71 mojom::CapabilityRequestPtr allowed_capabilities, |
| 72 const mojo::String& name) { | 72 const mojo::String& name) { |
| 73 std::unique_ptr<internal::ConnectionImpl> registry( | 73 std::unique_ptr<internal::ConnectionImpl> registry( |
| (...skipping 27 matching lines...) Expand all Loading... |
| 101 // invalid. | 101 // invalid. |
| 102 should_run_connection_lost_closure_ = service_->OnStop(); | 102 should_run_connection_lost_closure_ = service_->OnStop(); |
| 103 if (should_run_connection_lost_closure_ && | 103 if (should_run_connection_lost_closure_ && |
| 104 !connection_lost_closure_.is_null()) | 104 !connection_lost_closure_.is_null()) |
| 105 connection_lost_closure_.Run(); | 105 connection_lost_closure_.Run(); |
| 106 // We don't reset the connector as clients may have taken a raw pointer to it. | 106 // We don't reset the connector as clients may have taken a raw pointer to it. |
| 107 // Connect() will return nullptr if they try to connect to anything. | 107 // Connect() will return nullptr if they try to connect to anything. |
| 108 } | 108 } |
| 109 | 109 |
| 110 } // namespace shell | 110 } // namespace shell |
| OLD | NEW |