| 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 "content/browser/devtools/protocol/tethering_handler.h" | 5 #include "content/browser/devtools/protocol/tethering_handler.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 | 313 |
| 314 | 314 |
| 315 // TetheringHandler ---------------------------------------------------------- | 315 // TetheringHandler ---------------------------------------------------------- |
| 316 | 316 |
| 317 // static | 317 // static |
| 318 TetheringHandler::TetheringImpl* TetheringHandler::impl_ = nullptr; | 318 TetheringHandler::TetheringImpl* TetheringHandler::impl_ = nullptr; |
| 319 | 319 |
| 320 TetheringHandler::TetheringHandler( | 320 TetheringHandler::TetheringHandler( |
| 321 const CreateServerSocketCallback& socket_callback, | 321 const CreateServerSocketCallback& socket_callback, |
| 322 scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 322 scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
| 323 : socket_callback_(socket_callback), | 323 : DevToolsDomainHandler(Tethering::Metainfo::domainName), |
| 324 socket_callback_(socket_callback), |
| 324 task_runner_(task_runner), | 325 task_runner_(task_runner), |
| 325 is_active_(false), | 326 is_active_(false), |
| 326 weak_factory_(this) { | 327 weak_factory_(this) { |
| 327 } | 328 } |
| 328 | 329 |
| 329 TetheringHandler::~TetheringHandler() { | 330 TetheringHandler::~TetheringHandler() { |
| 330 if (is_active_) { | 331 if (is_active_) { |
| 331 task_runner_->DeleteSoon(FROM_HERE, impl_); | 332 task_runner_->DeleteSoon(FROM_HERE, impl_); |
| 332 impl_ = nullptr; | 333 impl_ = nullptr; |
| 333 } | 334 } |
| 334 } | 335 } |
| 335 | 336 |
| 336 void TetheringHandler::Wire(UberDispatcher* dispatcher) { | 337 void TetheringHandler::Wire(UberDispatcher* dispatcher) { |
| 337 frontend_.reset(new Tethering::Frontend(dispatcher->channel())); | 338 frontend_.reset(new Tethering::Frontend(dispatcher->channel())); |
| 338 Tethering::Dispatcher::wire(dispatcher, this); | 339 Tethering::Dispatcher::wire(dispatcher, this); |
| 339 } | 340 } |
| 340 | 341 |
| 342 void TetheringHandler::SetRenderFrameHost(RenderFrameHostImpl* host) { |
| 343 } |
| 344 |
| 341 Response TetheringHandler::Disable() { | 345 Response TetheringHandler::Disable() { |
| 342 return Response::OK(); | 346 return Response::OK(); |
| 343 } | 347 } |
| 344 | 348 |
| 345 void TetheringHandler::Accepted(uint16_t port, const std::string& name) { | 349 void TetheringHandler::Accepted(uint16_t port, const std::string& name) { |
| 346 frontend_->Accepted(port, name); | 350 frontend_->Accepted(port, name); |
| 347 } | 351 } |
| 348 | 352 |
| 349 bool TetheringHandler::Activate() { | 353 bool TetheringHandler::Activate() { |
| 350 if (is_active_) | 354 if (is_active_) |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 } | 388 } |
| 385 | 389 |
| 386 DCHECK(impl_); | 390 DCHECK(impl_); |
| 387 task_runner_->PostTask( | 391 task_runner_->PostTask( |
| 388 FROM_HERE, base::Bind(&TetheringImpl::Unbind, base::Unretained(impl_), | 392 FROM_HERE, base::Bind(&TetheringImpl::Unbind, base::Unretained(impl_), |
| 389 port, base::Passed(std::move(callback)))); | 393 port, base::Passed(std::move(callback)))); |
| 390 } | 394 } |
| 391 | 395 |
| 392 } // namespace protocol | 396 } // namespace protocol |
| 393 } // namespace content | 397 } // namespace content |
| OLD | NEW |