Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(287)

Side by Side Diff: content/browser/devtools/protocol/inspector_handler.cc

Issue 2590293003: [DevTools] Rework DevToolsSession interaction with domain handlers. (Closed)
Patch Set: addressed comments Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/devtools/devtools_session.h"
7 #include "content/browser/frame_host/render_frame_host_impl.h" 8 #include "content/browser/frame_host/render_frame_host_impl.h"
8 9
9 namespace content { 10 namespace content {
10 namespace protocol { 11 namespace protocol {
11 12
12 InspectorHandler::InspectorHandler() 13 InspectorHandler::InspectorHandler()
13 : host_(nullptr) { 14 : DevToolsDomainHandler(Inspector::Metainfo::domainName),
15 host_(nullptr) {
14 } 16 }
15 17
16 InspectorHandler::~InspectorHandler() { 18 InspectorHandler::~InspectorHandler() {
17 } 19 }
18 20
21 // static
22 InspectorHandler* InspectorHandler::FromSession(DevToolsSession* session) {
23 return static_cast<InspectorHandler*>(
24 session->GetHandlerByName(Inspector::Metainfo::domainName));
25 }
26
19 void InspectorHandler::Wire(UberDispatcher* dispatcher) { 27 void InspectorHandler::Wire(UberDispatcher* dispatcher) {
20 frontend_.reset(new Inspector::Frontend(dispatcher->channel())); 28 frontend_.reset(new Inspector::Frontend(dispatcher->channel()));
21 Inspector::Dispatcher::wire(dispatcher, this); 29 Inspector::Dispatcher::wire(dispatcher, this);
22 } 30 }
23 31
24 void InspectorHandler::SetRenderFrameHost(RenderFrameHostImpl* host) { 32 void InspectorHandler::SetRenderFrameHost(RenderFrameHostImpl* host) {
25 host_ = host; 33 host_ = host;
26 } 34 }
27 35
28 void InspectorHandler::TargetCrashed() { 36 void InspectorHandler::TargetCrashed() {
29 frontend_->TargetCrashed(); 37 frontend_->TargetCrashed();
30 } 38 }
31 39
32 void InspectorHandler::TargetDetached(const std::string& reason) { 40 void InspectorHandler::TargetDetached(const std::string& reason) {
33 frontend_->Detached(reason); 41 frontend_->Detached(reason);
34 } 42 }
35 43
36 Response InspectorHandler::Enable() { 44 Response InspectorHandler::Enable() {
37 if (host_ && !host_->IsRenderFrameLive()) 45 if (host_ && !host_->IsRenderFrameLive())
38 frontend_->TargetCrashed(); 46 frontend_->TargetCrashed();
39 return Response::OK(); 47 return Response::OK();
40 } 48 }
41 49
42 Response InspectorHandler::Disable() { 50 Response InspectorHandler::Disable() {
43 return Response::OK(); 51 return Response::OK();
44 } 52 }
45 53
46 } // namespace protocol 54 } // namespace protocol
47 } // namespace content 55 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698