| 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/inspector_handler.h" | 5 #include "content/browser/devtools/protocol/inspector_handler.h" |
| 6 | 6 |
| 7 #include "content/browser/frame_host/render_frame_host_impl.h" | 7 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 8 | 8 |
| 9 namespace content { | 9 namespace content { |
| 10 namespace devtools { | 10 namespace devtools { |
| 11 namespace inspector { | 11 namespace inspector { |
| 12 | 12 |
| 13 using Response = DevToolsProtocolClient::Response; | 13 using Response = DevToolsProtocolClient::Response; |
| 14 | 14 |
| 15 InspectorHandler::InspectorHandler() | 15 InspectorHandler::InspectorHandler() |
| 16 : host_(nullptr) { | 16 : host_(nullptr) { |
| 17 } | 17 } |
| 18 | 18 |
| 19 InspectorHandler::~InspectorHandler() { | 19 InspectorHandler::~InspectorHandler() { |
| 20 } | 20 } |
| 21 | 21 |
| 22 void InspectorHandler::SetClient(scoped_ptr<Client> client) { | 22 void InspectorHandler::SetClient(std::unique_ptr<Client> client) { |
| 23 client_.swap(client); | 23 client_.swap(client); |
| 24 } | 24 } |
| 25 | 25 |
| 26 void InspectorHandler::SetRenderFrameHost(RenderFrameHostImpl* host) { | 26 void InspectorHandler::SetRenderFrameHost(RenderFrameHostImpl* host) { |
| 27 host_ = host; | 27 host_ = host; |
| 28 } | 28 } |
| 29 | 29 |
| 30 void InspectorHandler::TargetCrashed() { | 30 void InspectorHandler::TargetCrashed() { |
| 31 client_->TargetCrashed(TargetCrashedParams::Create()); | 31 client_->TargetCrashed(TargetCrashedParams::Create()); |
| 32 } | 32 } |
| 33 | 33 |
| 34 void InspectorHandler::TargetDetached(const std::string& reason) { | 34 void InspectorHandler::TargetDetached(const std::string& reason) { |
| 35 client_->Detached(DetachedParams::Create()->set_reason(reason)); | 35 client_->Detached(DetachedParams::Create()->set_reason(reason)); |
| 36 } | 36 } |
| 37 | 37 |
| 38 Response InspectorHandler::Enable() { | 38 Response InspectorHandler::Enable() { |
| 39 if (host_ && !host_->IsRenderFrameLive()) | 39 if (host_ && !host_->IsRenderFrameLive()) |
| 40 client_->TargetCrashed(TargetCrashedParams::Create()); | 40 client_->TargetCrashed(TargetCrashedParams::Create()); |
| 41 return Response::OK(); | 41 return Response::OK(); |
| 42 } | 42 } |
| 43 | 43 |
| 44 Response InspectorHandler::Disable() { | 44 Response InspectorHandler::Disable() { |
| 45 return Response::OK(); | 45 return Response::OK(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 } // namespace inspector | 48 } // namespace inspector |
| 49 } // namespace devtools | 49 } // namespace devtools |
| 50 } // namespace content | 50 } // namespace content |
| OLD | NEW |