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 "chrome/browser/extensions/api/gcd_private/gcd_private_api.h" | 5 #include "chrome/browser/extensions/api/gcd_private/gcd_private_api.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/linked_ptr.h" | 9 #include "base/memory/linked_ptr.h" |
10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 auto& session_data = sessions_[session_id]; | 129 auto& session_data = sessions_[session_id]; |
130 session_data.resolver.reset(new local_discovery::EndpointResolver()); | 130 session_data.resolver.reset(new local_discovery::EndpointResolver()); |
131 session_data.resolver->Start( | 131 session_data.resolver->Start( |
132 service_name, base::Bind(&GcdPrivateAPIImpl::OnServiceResolved, | 132 service_name, base::Bind(&GcdPrivateAPIImpl::OnServiceResolved, |
133 base::Unretained(this), session_id, callback)); | 133 base::Unretained(this), session_id, callback)); |
134 } | 134 } |
135 | 135 |
136 void GcdPrivateAPIImpl::OnServiceResolved(int session_id, | 136 void GcdPrivateAPIImpl::OnServiceResolved(int session_id, |
137 const CreateSessionCallback& callback, | 137 const CreateSessionCallback& callback, |
138 const net::IPEndPoint& endpoint) { | 138 const net::IPEndPoint& endpoint) { |
139 if (endpoint.address().empty()) { | 139 if (endpoint.address_number().empty()) { |
140 return callback.Run(session_id, gcd_private::STATUS_SERVICERESOLUTIONERROR, | 140 return callback.Run(session_id, gcd_private::STATUS_SERVICERESOLUTIONERROR, |
141 base::DictionaryValue()); | 141 base::DictionaryValue()); |
142 } | 142 } |
143 auto& session_data = sessions_[session_id]; | 143 auto& session_data = sessions_[session_id]; |
144 | 144 |
145 if (!context_getter_) { | 145 if (!context_getter_) { |
146 context_getter_ = new PrivetV3ContextGetter( | 146 context_getter_ = new PrivetV3ContextGetter( |
147 browser_context_->GetRequestContext()->GetNetworkTaskRunner()); | 147 browser_context_->GetRequestContext()->GetNetworkTaskRunner()); |
148 } | 148 } |
149 | 149 |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 | 435 |
436 GcdPrivateAPIImpl* gcd_api = GcdPrivateAPIImpl::Get(GetProfile()); | 436 GcdPrivateAPIImpl* gcd_api = GcdPrivateAPIImpl::Get(GetProfile()); |
437 | 437 |
438 gcd_api->RemoveSession(params->session_id); | 438 gcd_api->RemoveSession(params->session_id); |
439 | 439 |
440 SendResponse(true); | 440 SendResponse(true); |
441 return true; | 441 return true; |
442 } | 442 } |
443 | 443 |
444 } // namespace extensions | 444 } // namespace extensions |
OLD | NEW |