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

Side by Side Diff: content/browser/devtools/render_frame_devtools_agent_host.cc

Issue 2521153002: [DevTools] Move Inspector domains to new generator. (Closed)
Patch Set: 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/render_frame_devtools_agent_host.h" 5 #include "content/browser/devtools/render_frame_devtools_agent_host.h"
6 6
7 #include <tuple> 7 #include <tuple>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/guid.h" 10 #include "base/guid.h"
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 // Force agent host. 390 // Force agent host.
391 DevToolsAgentHost::GetOrCreateFor(web_contents); 391 DevToolsAgentHost::GetOrCreateFor(web_contents);
392 } 392 }
393 } 393 }
394 394
395 RenderFrameDevToolsAgentHost::RenderFrameDevToolsAgentHost( 395 RenderFrameDevToolsAgentHost::RenderFrameDevToolsAgentHost(
396 RenderFrameHostImpl* host) 396 RenderFrameHostImpl* host)
397 : DevToolsAgentHostImpl(base::GenerateGUID()), 397 : DevToolsAgentHostImpl(base::GenerateGUID()),
398 dom_handler_(new devtools::dom::DOMHandler()), 398 dom_handler_(new devtools::dom::DOMHandler()),
399 input_handler_(new devtools::input::InputHandler()), 399 input_handler_(new devtools::input::InputHandler()),
400 inspector_handler_(new devtools::inspector::InspectorHandler()),
401 network_handler_(new devtools::network::NetworkHandler()), 400 network_handler_(new devtools::network::NetworkHandler()),
402 page_handler_(nullptr), 401 page_handler_(nullptr),
403 schema_handler_(new devtools::schema::SchemaHandler()), 402 schema_handler_(new devtools::schema::SchemaHandler()),
404 security_handler_(nullptr), 403 security_handler_(nullptr),
405 service_worker_handler_( 404 service_worker_handler_(
406 new devtools::service_worker::ServiceWorkerHandler()), 405 new devtools::service_worker::ServiceWorkerHandler()),
407 storage_handler_(new devtools::storage::StorageHandler()), 406 storage_handler_(new devtools::storage::StorageHandler()),
408 target_handler_(new devtools::target::TargetHandler()), 407 target_handler_(new devtools::target::TargetHandler()),
409 emulation_handler_(nullptr), 408 emulation_handler_(nullptr),
410 frame_trace_recorder_(nullptr), 409 frame_trace_recorder_(nullptr),
411 protocol_handler_(new DevToolsProtocolHandler(this)), 410 protocol_handler_(new DevToolsProtocolHandler(this)),
412 handlers_frame_host_(nullptr), 411 handlers_frame_host_(nullptr),
413 current_frame_crashed_(false), 412 current_frame_crashed_(false),
414 pending_handle_(nullptr), 413 pending_handle_(nullptr),
415 frame_tree_node_(host->frame_tree_node()) { 414 frame_tree_node_(host->frame_tree_node()) {
416 DevToolsProtocolDispatcher* dispatcher = protocol_handler_->dispatcher(); 415 DevToolsProtocolDispatcher* dispatcher = protocol_handler_->dispatcher();
417 dispatcher->SetDOMHandler(dom_handler_.get()); 416 dispatcher->SetDOMHandler(dom_handler_.get());
418 dispatcher->SetInputHandler(input_handler_.get()); 417 dispatcher->SetInputHandler(input_handler_.get());
419 dispatcher->SetInspectorHandler(inspector_handler_.get());
420 dispatcher->SetNetworkHandler(network_handler_.get()); 418 dispatcher->SetNetworkHandler(network_handler_.get());
421 dispatcher->SetSchemaHandler(schema_handler_.get()); 419 dispatcher->SetSchemaHandler(schema_handler_.get());
422 dispatcher->SetServiceWorkerHandler(service_worker_handler_.get()); 420 dispatcher->SetServiceWorkerHandler(service_worker_handler_.get());
423 dispatcher->SetStorageHandler(storage_handler_.get()); 421 dispatcher->SetStorageHandler(storage_handler_.get());
424 dispatcher->SetTargetHandler(target_handler_.get()); 422 dispatcher->SetTargetHandler(target_handler_.get());
425 423
426 if (!host->GetParent()) { 424 if (!host->GetParent()) {
427 security_handler_.reset(new devtools::security::SecurityHandler()); 425 security_handler_.reset(new devtools::security::SecurityHandler());
428 page_handler_.reset(new devtools::page::PageHandler()); 426 page_handler_.reset(new devtools::page::PageHandler());
429 emulation_handler_.reset( 427 emulation_handler_.reset(
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 return contents ? contents->GetBrowserContext() : nullptr; 488 return contents ? contents->GetBrowserContext() : nullptr;
491 } 489 }
492 490
493 WebContents* RenderFrameDevToolsAgentHost::GetWebContents() { 491 WebContents* RenderFrameDevToolsAgentHost::GetWebContents() {
494 return web_contents(); 492 return web_contents();
495 } 493 }
496 494
497 void RenderFrameDevToolsAgentHost::Attach() { 495 void RenderFrameDevToolsAgentHost::Attach() {
498 session()->dispatcher()->setFallThroughForNotFound(true); 496 session()->dispatcher()->setFallThroughForNotFound(true);
499 497
498 inspector_handler_.reset(new protocol::InspectorHandler());
499 inspector_handler_->Wire(session()->dispatcher());
500 inspector_handler_->SetRenderFrameHost(handlers_frame_host_);
501
500 io_handler_.reset(new protocol::IOHandler(GetIOContext())); 502 io_handler_.reset(new protocol::IOHandler(GetIOContext()));
501 io_handler_->Wire(session()->dispatcher()); 503 io_handler_->Wire(session()->dispatcher());
502 504
503 tracing_handler_.reset(new protocol::TracingHandler( 505 tracing_handler_.reset(new protocol::TracingHandler(
504 protocol::TracingHandler::Renderer, 506 protocol::TracingHandler::Renderer,
505 frame_tree_node_->frame_tree_node_id(), 507 frame_tree_node_->frame_tree_node_id(),
506 GetIOContext())); 508 GetIOContext()));
507 tracing_handler_->Wire(session()->dispatcher()); 509 tracing_handler_->Wire(session()->dispatcher());
508 510
509 if (current_) 511 if (current_)
510 current_->Attach(); 512 current_->Attach();
511 if (pending_) 513 if (pending_)
512 pending_->Attach(); 514 pending_->Attach();
513 OnClientAttached(); 515 OnClientAttached();
514 } 516 }
515 517
516 void RenderFrameDevToolsAgentHost::Detach() { 518 void RenderFrameDevToolsAgentHost::Detach() {
519 inspector_handler_->Disable();
520 inspector_handler_.reset();
517 io_handler_->Disable(); 521 io_handler_->Disable();
518 io_handler_.reset(); 522 io_handler_.reset();
519 tracing_handler_->Disable(); 523 tracing_handler_->Disable();
520 tracing_handler_.reset(); 524 tracing_handler_.reset();
521 525
522 if (current_) 526 if (current_)
523 current_->Detach(); 527 current_->Detach();
524 if (pending_) 528 if (pending_)
525 pending_->Detach(); 529 pending_->Detach();
526 OnClientDetached(); 530 OnClientDetached();
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 } 915 }
912 916
913 void RenderFrameDevToolsAgentHost::UpdateProtocolHandlers( 917 void RenderFrameDevToolsAgentHost::UpdateProtocolHandlers(
914 RenderFrameHostImpl* host) { 918 RenderFrameHostImpl* host) {
915 handlers_frame_host_ = host; 919 handlers_frame_host_ = host;
916 dom_handler_->SetRenderFrameHost(host); 920 dom_handler_->SetRenderFrameHost(host);
917 if (emulation_handler_) 921 if (emulation_handler_)
918 emulation_handler_->SetRenderFrameHost(host); 922 emulation_handler_->SetRenderFrameHost(host);
919 input_handler_->SetRenderWidgetHost( 923 input_handler_->SetRenderWidgetHost(
920 host ? host->GetRenderWidgetHost() : nullptr); 924 host ? host->GetRenderWidgetHost() : nullptr);
921 inspector_handler_->SetRenderFrameHost(host); 925 if (inspector_handler_)
926 inspector_handler_->SetRenderFrameHost(host);
922 network_handler_->SetRenderFrameHost(host); 927 network_handler_->SetRenderFrameHost(host);
923 if (page_handler_) 928 if (page_handler_)
924 page_handler_->SetRenderFrameHost(host); 929 page_handler_->SetRenderFrameHost(host);
925 service_worker_handler_->SetRenderFrameHost(host); 930 service_worker_handler_->SetRenderFrameHost(host);
926 if (security_handler_) 931 if (security_handler_)
927 security_handler_->SetRenderFrameHost(host); 932 security_handler_->SetRenderFrameHost(host);
928 if (storage_handler_) 933 if (storage_handler_)
929 storage_handler_->SetRenderFrameHost(host); 934 storage_handler_->SetRenderFrameHost(host);
930 target_handler_->SetRenderFrameHost(host); 935 target_handler_->SetRenderFrameHost(host);
931 } 936 }
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 RenderFrameHost* host) { 1145 RenderFrameHost* host) {
1141 return (current_ && current_->host() == host) || 1146 return (current_ && current_->host() == host) ||
1142 (pending_ && pending_->host() == host); 1147 (pending_ && pending_->host() == host);
1143 } 1148 }
1144 1149
1145 bool RenderFrameDevToolsAgentHost::IsChildFrame() { 1150 bool RenderFrameDevToolsAgentHost::IsChildFrame() {
1146 return current_ && current_->host()->GetParent(); 1151 return current_ && current_->host()->GetParent();
1147 } 1152 }
1148 1153
1149 } // namespace content 1154 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/devtools/render_frame_devtools_agent_host.h ('k') | content/browser/devtools/worker_devtools_agent_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698