| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010-2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2010-2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 #include "platform/wtf/PtrUtil.h" | 77 #include "platform/wtf/PtrUtil.h" |
| 78 #include "platform/wtf/text/WTFString.h" | 78 #include "platform/wtf/text/WTFString.h" |
| 79 #include "public/platform/Platform.h" | 79 #include "public/platform/Platform.h" |
| 80 #include "public/platform/WebLayerTreeView.h" | 80 #include "public/platform/WebLayerTreeView.h" |
| 81 #include "public/platform/WebRect.h" | 81 #include "public/platform/WebRect.h" |
| 82 #include "public/platform/WebString.h" | 82 #include "public/platform/WebString.h" |
| 83 #include "public/web/WebDevToolsAgentClient.h" | 83 #include "public/web/WebDevToolsAgentClient.h" |
| 84 #include "public/web/WebSettings.h" | 84 #include "public/web/WebSettings.h" |
| 85 #include "web/DevToolsEmulator.h" | 85 #include "web/DevToolsEmulator.h" |
| 86 #include "web/InspectorEmulationAgent.h" | 86 #include "web/InspectorEmulationAgent.h" |
| 87 #include "web/InspectorOverlayAgent.h" | 87 #include "web/InspectorOverlay.h" |
| 88 #include "web/InspectorRenderingAgent.h" |
| 88 #include "web/WebFrameWidgetImpl.h" | 89 #include "web/WebFrameWidgetImpl.h" |
| 89 #include "web/WebInputEventConversion.h" | 90 #include "web/WebInputEventConversion.h" |
| 90 #include "web/WebLocalFrameImpl.h" | 91 #include "web/WebLocalFrameImpl.h" |
| 91 #include "web/WebSettingsImpl.h" | 92 #include "web/WebSettingsImpl.h" |
| 92 #include "web/WebViewImpl.h" | 93 #include "web/WebViewImpl.h" |
| 93 | 94 |
| 94 namespace blink { | 95 namespace blink { |
| 95 | 96 |
| 96 namespace { | 97 namespace { |
| 97 | 98 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 | 226 |
| 226 static ClientMessageLoopAdapter* instance_; | 227 static ClientMessageLoopAdapter* instance_; |
| 227 }; | 228 }; |
| 228 | 229 |
| 229 ClientMessageLoopAdapter* ClientMessageLoopAdapter::instance_ = nullptr; | 230 ClientMessageLoopAdapter* ClientMessageLoopAdapter::instance_ = nullptr; |
| 230 | 231 |
| 231 // static | 232 // static |
| 232 WebDevToolsAgentImpl* WebDevToolsAgentImpl::Create( | 233 WebDevToolsAgentImpl* WebDevToolsAgentImpl::Create( |
| 233 WebLocalFrameImpl* frame, | 234 WebLocalFrameImpl* frame, |
| 234 WebDevToolsAgentClient* client) { | 235 WebDevToolsAgentClient* client) { |
| 236 InspectorOverlay* overlay = new InspectorOverlay(frame); |
| 237 |
| 235 if (!IsMainFrame(frame)) { | 238 if (!IsMainFrame(frame)) { |
| 236 WebDevToolsAgentImpl* agent = | 239 WebDevToolsAgentImpl* agent = |
| 237 new WebDevToolsAgentImpl(frame, client, false); | 240 new WebDevToolsAgentImpl(frame, client, overlay, false); |
| 238 if (frame->FrameWidget()) | 241 if (frame->FrameWidget()) |
| 239 agent->LayerTreeViewChanged( | 242 agent->LayerTreeViewChanged( |
| 240 ToWebFrameWidgetImpl(frame->FrameWidget())->LayerTreeView()); | 243 ToWebFrameWidgetImpl(frame->FrameWidget())->LayerTreeView()); |
| 241 return agent; | 244 return agent; |
| 242 } | 245 } |
| 243 | 246 |
| 244 WebViewImpl* view = frame->ViewImpl(); | 247 WebViewImpl* view = frame->ViewImpl(); |
| 245 WebDevToolsAgentImpl* agent = new WebDevToolsAgentImpl(frame, client, true); | 248 WebDevToolsAgentImpl* agent = |
| 249 new WebDevToolsAgentImpl(frame, client, overlay, true); |
| 246 agent->LayerTreeViewChanged(view->LayerTreeView()); | 250 agent->LayerTreeViewChanged(view->LayerTreeView()); |
| 247 return agent; | 251 return agent; |
| 248 } | 252 } |
| 249 | 253 |
| 250 WebDevToolsAgentImpl::WebDevToolsAgentImpl( | 254 WebDevToolsAgentImpl::WebDevToolsAgentImpl( |
| 251 WebLocalFrameImpl* web_local_frame_impl, | 255 WebLocalFrameImpl* web_local_frame_impl, |
| 252 WebDevToolsAgentClient* client, | 256 WebDevToolsAgentClient* client, |
| 257 InspectorOverlay* overlay, |
| 253 bool include_view_agents) | 258 bool include_view_agents) |
| 254 : client_(client), | 259 : client_(client), |
| 255 web_local_frame_impl_(web_local_frame_impl), | 260 web_local_frame_impl_(web_local_frame_impl), |
| 256 instrumenting_agents_( | 261 instrumenting_agents_( |
| 257 web_local_frame_impl_->GetFrame()->InstrumentingAgents()), | 262 web_local_frame_impl_->GetFrame()->InstrumentingAgents()), |
| 258 resource_content_loader_(InspectorResourceContentLoader::Create( | 263 resource_content_loader_(InspectorResourceContentLoader::Create( |
| 259 web_local_frame_impl_->GetFrame())), | 264 web_local_frame_impl_->GetFrame())), |
| 265 overlay_(overlay), |
| 260 inspected_frames_( | 266 inspected_frames_( |
| 261 InspectedFrames::Create(web_local_frame_impl_->GetFrame())), | 267 InspectedFrames::Create(web_local_frame_impl_->GetFrame())), |
| 262 resource_container_(new InspectorResourceContainer(inspected_frames_)), | 268 resource_container_(new InspectorResourceContainer(inspected_frames_)), |
| 269 dom_agent_(nullptr), |
| 263 page_agent_(nullptr), | 270 page_agent_(nullptr), |
| 264 network_agent_(nullptr), | 271 network_agent_(nullptr), |
| 265 layer_tree_agent_(nullptr), | 272 layer_tree_agent_(nullptr), |
| 266 tracing_agent_(nullptr), | 273 tracing_agent_(nullptr), |
| 267 trace_events_agent_(new InspectorTraceEvents()), | 274 trace_events_agent_(new InspectorTraceEvents()), |
| 268 overlay_agent_(nullptr), | |
| 269 include_view_agents_(include_view_agents), | 275 include_view_agents_(include_view_agents), |
| 270 layer_tree_id_(0) { | 276 layer_tree_id_(0) { |
| 271 DCHECK(IsMainThread()); | 277 DCHECK(IsMainThread()); |
| 272 DCHECK(web_local_frame_impl_->GetFrame()); | 278 DCHECK(web_local_frame_impl_->GetFrame()); |
| 273 instrumenting_agents_->addInspectorTraceEvents(trace_events_agent_); | 279 instrumenting_agents_->addInspectorTraceEvents(trace_events_agent_); |
| 274 } | 280 } |
| 275 | 281 |
| 276 WebDevToolsAgentImpl::~WebDevToolsAgentImpl() { | 282 WebDevToolsAgentImpl::~WebDevToolsAgentImpl() { |
| 277 DCHECK(!client_); | 283 DCHECK(!client_); |
| 278 } | 284 } |
| 279 | 285 |
| 280 DEFINE_TRACE(WebDevToolsAgentImpl) { | 286 DEFINE_TRACE(WebDevToolsAgentImpl) { |
| 281 visitor->Trace(web_local_frame_impl_); | 287 visitor->Trace(web_local_frame_impl_); |
| 282 visitor->Trace(instrumenting_agents_); | 288 visitor->Trace(instrumenting_agents_); |
| 283 visitor->Trace(resource_content_loader_); | 289 visitor->Trace(resource_content_loader_); |
| 290 visitor->Trace(overlay_); |
| 284 visitor->Trace(inspected_frames_); | 291 visitor->Trace(inspected_frames_); |
| 285 visitor->Trace(resource_container_); | 292 visitor->Trace(resource_container_); |
| 293 visitor->Trace(dom_agent_); |
| 286 visitor->Trace(page_agent_); | 294 visitor->Trace(page_agent_); |
| 287 visitor->Trace(network_agent_); | 295 visitor->Trace(network_agent_); |
| 288 visitor->Trace(layer_tree_agent_); | 296 visitor->Trace(layer_tree_agent_); |
| 289 visitor->Trace(tracing_agent_); | 297 visitor->Trace(tracing_agent_); |
| 290 visitor->Trace(trace_events_agent_); | 298 visitor->Trace(trace_events_agent_); |
| 291 visitor->Trace(overlay_agent_); | |
| 292 visitor->Trace(session_); | 299 visitor->Trace(session_); |
| 293 } | 300 } |
| 294 | 301 |
| 295 void WebDevToolsAgentImpl::WillBeDestroyed() { | 302 void WebDevToolsAgentImpl::WillBeDestroyed() { |
| 296 DCHECK(web_local_frame_impl_->GetFrame()); | 303 DCHECK(web_local_frame_impl_->GetFrame()); |
| 297 DCHECK(inspected_frames_->Root()->View()); | 304 DCHECK(inspected_frames_->Root()->View()); |
| 298 instrumenting_agents_->removeInspectorTraceEvents(trace_events_agent_); | 305 instrumenting_agents_->removeInspectorTraceEvents(trace_events_agent_); |
| 299 trace_events_agent_ = nullptr; | 306 trace_events_agent_ = nullptr; |
| 300 Detach(); | 307 Detach(); |
| 301 resource_content_loader_->Dispose(); | 308 resource_content_loader_->Dispose(); |
| 302 client_ = nullptr; | 309 client_ = nullptr; |
| 303 } | 310 } |
| 304 | 311 |
| 305 void WebDevToolsAgentImpl::InitializeSession(int session_id, | 312 void WebDevToolsAgentImpl::InitializeSession(int session_id, |
| 306 const String& host_id, | 313 const String& host_id, |
| 307 String* state) { | 314 String* state) { |
| 308 DCHECK(client_); | 315 DCHECK(client_); |
| 309 ClientMessageLoopAdapter::EnsureMainThreadDebuggerCreated(client_); | 316 ClientMessageLoopAdapter::EnsureMainThreadDebuggerCreated(client_); |
| 310 MainThreadDebugger* main_thread_debugger = MainThreadDebugger::Instance(); | 317 MainThreadDebugger* main_thread_debugger = MainThreadDebugger::Instance(); |
| 311 v8::Isolate* isolate = V8PerIsolateData::MainThreadIsolate(); | 318 v8::Isolate* isolate = V8PerIsolateData::MainThreadIsolate(); |
| 312 | 319 |
| 313 session_ = new InspectorSession( | 320 session_ = new InspectorSession( |
| 314 this, instrumenting_agents_.Get(), session_id, | 321 this, instrumenting_agents_.Get(), session_id, |
| 315 main_thread_debugger->GetV8Inspector(), | 322 main_thread_debugger->GetV8Inspector(), |
| 316 main_thread_debugger->ContextGroupId(inspected_frames_->Root()), state); | 323 main_thread_debugger->ContextGroupId(inspected_frames_->Root()), state); |
| 317 | 324 |
| 318 InspectorDOMAgent* dom_agent = new InspectorDOMAgent( | 325 InspectorDOMAgent* dom_agent = new InspectorDOMAgent( |
| 319 isolate, inspected_frames_.Get(), session_->V8Session()); | 326 isolate, inspected_frames_.Get(), session_->V8Session(), overlay_.Get()); |
| 327 dom_agent_ = dom_agent; |
| 320 session_->Append(dom_agent); | 328 session_->Append(dom_agent); |
| 321 | 329 |
| 322 InspectorLayerTreeAgent* layer_tree_agent = | 330 InspectorLayerTreeAgent* layer_tree_agent = |
| 323 InspectorLayerTreeAgent::Create(inspected_frames_.Get()); | 331 InspectorLayerTreeAgent::Create(inspected_frames_.Get()); |
| 324 layer_tree_agent_ = layer_tree_agent; | 332 layer_tree_agent_ = layer_tree_agent; |
| 325 session_->Append(layer_tree_agent); | 333 session_->Append(layer_tree_agent); |
| 326 | 334 |
| 327 InspectorNetworkAgent* network_agent = | 335 InspectorNetworkAgent* network_agent = |
| 328 InspectorNetworkAgent::Create(inspected_frames_.Get()); | 336 InspectorNetworkAgent::Create(inspected_frames_.Get()); |
| 329 network_agent_ = network_agent; | 337 network_agent_ = network_agent; |
| 330 session_->Append(network_agent); | 338 session_->Append(network_agent); |
| 331 | 339 |
| 332 InspectorCSSAgent* css_agent = InspectorCSSAgent::Create( | 340 InspectorCSSAgent* css_agent = InspectorCSSAgent::Create( |
| 333 dom_agent, inspected_frames_.Get(), network_agent_, | 341 dom_agent_, inspected_frames_.Get(), network_agent_, |
| 334 resource_content_loader_.Get(), resource_container_.Get()); | 342 resource_content_loader_.Get(), resource_container_.Get()); |
| 335 session_->Append(css_agent); | 343 session_->Append(css_agent); |
| 336 | 344 |
| 337 session_->Append(new InspectorAnimationAgent( | 345 session_->Append(new InspectorAnimationAgent( |
| 338 inspected_frames_.Get(), css_agent, session_->V8Session())); | 346 inspected_frames_.Get(), css_agent, session_->V8Session())); |
| 339 | 347 |
| 340 session_->Append(InspectorMemoryAgent::Create()); | 348 session_->Append(InspectorMemoryAgent::Create()); |
| 341 | 349 |
| 342 session_->Append( | 350 session_->Append( |
| 343 InspectorApplicationCacheAgent::Create(inspected_frames_.Get())); | 351 InspectorApplicationCacheAgent::Create(inspected_frames_.Get())); |
| 344 | 352 |
| 345 session_->Append(new InspectorIndexedDBAgent(inspected_frames_.Get(), | 353 session_->Append(new InspectorIndexedDBAgent(inspected_frames_.Get(), |
| 346 session_->V8Session())); | 354 session_->V8Session())); |
| 347 | 355 |
| 348 InspectorWorkerAgent* worker_agent = | 356 InspectorWorkerAgent* worker_agent = |
| 349 new InspectorWorkerAgent(inspected_frames_.Get()); | 357 new InspectorWorkerAgent(inspected_frames_.Get()); |
| 350 session_->Append(worker_agent); | 358 session_->Append(worker_agent); |
| 351 | 359 |
| 352 InspectorTracingAgent* tracing_agent = InspectorTracingAgent::Create( | 360 InspectorTracingAgent* tracing_agent = InspectorTracingAgent::Create( |
| 353 this, worker_agent, inspected_frames_.Get()); | 361 this, worker_agent, inspected_frames_.Get()); |
| 354 tracing_agent_ = tracing_agent; | 362 tracing_agent_ = tracing_agent; |
| 355 session_->Append(tracing_agent); | 363 session_->Append(tracing_agent); |
| 356 | 364 |
| 357 session_->Append( | 365 session_->Append(new InspectorDOMDebuggerAgent(isolate, dom_agent_, |
| 358 new InspectorDOMDebuggerAgent(isolate, dom_agent, session_->V8Session())); | 366 session_->V8Session())); |
| 359 | 367 |
| 360 session_->Append(InspectorInputAgent::Create(inspected_frames_.Get())); | 368 session_->Append(InspectorInputAgent::Create(inspected_frames_.Get())); |
| 361 | 369 |
| 362 InspectorPageAgent* page_agent = InspectorPageAgent::Create( | 370 InspectorPageAgent* page_agent = InspectorPageAgent::Create( |
| 363 inspected_frames_.Get(), this, resource_content_loader_.Get(), | 371 inspected_frames_.Get(), this, resource_content_loader_.Get(), |
| 364 session_->V8Session()); | 372 session_->V8Session()); |
| 365 page_agent_ = page_agent; | 373 page_agent_ = page_agent; |
| 366 session_->Append(page_agent); | 374 session_->Append(page_agent); |
| 367 | 375 |
| 368 session_->Append(new InspectorLogAgent( | 376 session_->Append(new InspectorLogAgent( |
| 369 &inspected_frames_->Root()->GetPage()->GetConsoleMessageStorage(), | 377 &inspected_frames_->Root()->GetPage()->GetConsoleMessageStorage(), |
| 370 inspected_frames_->Root()->GetPerformanceMonitor())); | 378 inspected_frames_->Root()->GetPerformanceMonitor())); |
| 371 | 379 |
| 372 session_->Append( | 380 session_->Append( |
| 373 new DeviceOrientationInspectorAgent(inspected_frames_.Get())); | 381 new DeviceOrientationInspectorAgent(inspected_frames_.Get())); |
| 374 | 382 |
| 375 InspectorOverlayAgent* overlay_agent = | |
| 376 new InspectorOverlayAgent(web_local_frame_impl_, inspected_frames_.Get(), | |
| 377 session_->V8Session(), dom_agent); | |
| 378 overlay_agent_ = overlay_agent; | |
| 379 session_->Append(overlay_agent); | |
| 380 | |
| 381 tracing_agent_->SetLayerTreeId(layer_tree_id_); | 383 tracing_agent_->SetLayerTreeId(layer_tree_id_); |
| 382 network_agent_->SetHostId(host_id); | 384 network_agent_->SetHostId(host_id); |
| 383 | 385 |
| 384 if (include_view_agents_) { | 386 if (include_view_agents_) { |
| 385 // TODO(dgozman): we should actually pass the view instead of frame, but | 387 // TODO(dgozman): we should actually pass the view instead of frame, but |
| 386 // during remote->local transition we cannot access mainFrameImpl() yet, so | 388 // during remote->local transition we cannot access mainFrameImpl() yet, so |
| 387 // we have to store the frame which will become the main frame later. | 389 // we have to store the frame which will become the main frame later. |
| 388 session_->Append( | 390 session_->Append( |
| 391 InspectorRenderingAgent::Create(web_local_frame_impl_, overlay_.Get())); |
| 392 session_->Append( |
| 389 InspectorEmulationAgent::Create(web_local_frame_impl_, this)); | 393 InspectorEmulationAgent::Create(web_local_frame_impl_, this)); |
| 390 // TODO(dgozman): migrate each of the following agents to frame once module | 394 // TODO(dgozman): migrate each of the following agents to frame once module |
| 391 // is ready. | 395 // is ready. |
| 392 Page* page = web_local_frame_impl_->ViewImpl()->GetPage(); | 396 Page* page = web_local_frame_impl_->ViewImpl()->GetPage(); |
| 393 session_->Append(InspectorDatabaseAgent::Create(page)); | 397 session_->Append(InspectorDatabaseAgent::Create(page)); |
| 394 session_->Append(new InspectorAccessibilityAgent(page, dom_agent)); | 398 session_->Append(new InspectorAccessibilityAgent(page, dom_agent_)); |
| 395 session_->Append(InspectorDOMStorageAgent::Create(page)); | 399 session_->Append(InspectorDOMStorageAgent::Create(page)); |
| 396 session_->Append(InspectorCacheStorageAgent::Create()); | 400 session_->Append(InspectorCacheStorageAgent::Create()); |
| 397 } | 401 } |
| 398 | 402 |
| 403 if (overlay_) |
| 404 overlay_->Init(session_->V8Session(), dom_agent_); |
| 405 |
| 399 Platform::Current()->CurrentThread()->AddTaskObserver(this); | 406 Platform::Current()->CurrentThread()->AddTaskObserver(this); |
| 400 } | 407 } |
| 401 | 408 |
| 402 void WebDevToolsAgentImpl::DestroySession() { | 409 void WebDevToolsAgentImpl::DestroySession() { |
| 403 overlay_agent_.Clear(); | 410 if (overlay_) |
| 411 overlay_->Clear(); |
| 412 |
| 404 tracing_agent_.Clear(); | 413 tracing_agent_.Clear(); |
| 405 layer_tree_agent_.Clear(); | 414 layer_tree_agent_.Clear(); |
| 406 network_agent_.Clear(); | 415 network_agent_.Clear(); |
| 407 page_agent_.Clear(); | 416 page_agent_.Clear(); |
| 417 dom_agent_.Clear(); |
| 408 | 418 |
| 409 session_->Dispose(); | 419 session_->Dispose(); |
| 410 session_.Clear(); | 420 session_.Clear(); |
| 411 | 421 |
| 412 Platform::Current()->CurrentThread()->RemoveTaskObserver(this); | 422 Platform::Current()->CurrentThread()->RemoveTaskObserver(this); |
| 413 } | 423 } |
| 414 | 424 |
| 415 void WebDevToolsAgentImpl::Attach(const WebString& host_id, int session_id) { | 425 void WebDevToolsAgentImpl::Attach(const WebString& host_id, int session_id) { |
| 416 if (Attached()) | 426 if (Attached()) |
| 417 return; | 427 return; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 if (client_) | 490 if (client_) |
| 481 client_->EnableTracing(category_filter); | 491 client_->EnableTracing(category_filter); |
| 482 } | 492 } |
| 483 | 493 |
| 484 void WebDevToolsAgentImpl::DisableTracing() { | 494 void WebDevToolsAgentImpl::DisableTracing() { |
| 485 if (client_) | 495 if (client_) |
| 486 client_->DisableTracing(); | 496 client_->DisableTracing(); |
| 487 } | 497 } |
| 488 | 498 |
| 489 void WebDevToolsAgentImpl::ShowReloadingBlanket() { | 499 void WebDevToolsAgentImpl::ShowReloadingBlanket() { |
| 490 if (overlay_agent_) | 500 if (overlay_) |
| 491 overlay_agent_->ShowReloadingBlanket(); | 501 overlay_->ShowReloadingBlanket(); |
| 492 } | 502 } |
| 493 | 503 |
| 494 void WebDevToolsAgentImpl::HideReloadingBlanket() { | 504 void WebDevToolsAgentImpl::HideReloadingBlanket() { |
| 495 if (overlay_agent_) | 505 if (overlay_) |
| 496 overlay_agent_->HideReloadingBlanket(); | 506 overlay_->HideReloadingBlanket(); |
| 497 } | 507 } |
| 498 | 508 |
| 499 void WebDevToolsAgentImpl::SetCPUThrottlingRate(double rate) { | 509 void WebDevToolsAgentImpl::SetCPUThrottlingRate(double rate) { |
| 500 if (client_) | 510 if (client_) |
| 501 client_->SetCPUThrottlingRate(rate); | 511 client_->SetCPUThrottlingRate(rate); |
| 502 } | 512 } |
| 503 | 513 |
| 504 void WebDevToolsAgentImpl::DispatchOnInspectorBackend( | 514 void WebDevToolsAgentImpl::DispatchOnInspectorBackend( |
| 505 int session_id, | 515 int session_id, |
| 506 int call_id, | 516 int call_id, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 520 if (!Attached() || session_id != session_->SessionId()) | 530 if (!Attached() || session_id != session_->SessionId()) |
| 521 return; | 531 return; |
| 522 InspectorTaskRunner::IgnoreInterruptsScope scope( | 532 InspectorTaskRunner::IgnoreInterruptsScope scope( |
| 523 MainThreadDebugger::Instance()->TaskRunner()); | 533 MainThreadDebugger::Instance()->TaskRunner()); |
| 524 session_->DispatchProtocolMessage(method, message); | 534 session_->DispatchProtocolMessage(method, message); |
| 525 } | 535 } |
| 526 | 536 |
| 527 void WebDevToolsAgentImpl::InspectElementAt( | 537 void WebDevToolsAgentImpl::InspectElementAt( |
| 528 int session_id, | 538 int session_id, |
| 529 const WebPoint& point_in_root_frame) { | 539 const WebPoint& point_in_root_frame) { |
| 530 if (!overlay_agent_ || !session_ || session_->SessionId() != session_id) | 540 if (!dom_agent_ || !session_ || session_->SessionId() != session_id) |
| 531 return; | 541 return; |
| 532 HitTestRequest::HitTestRequestType hit_type = | 542 HitTestRequest::HitTestRequestType hit_type = |
| 533 HitTestRequest::kMove | HitTestRequest::kReadOnly | | 543 HitTestRequest::kMove | HitTestRequest::kReadOnly | |
| 534 HitTestRequest::kAllowChildFrameContent; | 544 HitTestRequest::kAllowChildFrameContent; |
| 535 HitTestRequest request(hit_type); | 545 HitTestRequest request(hit_type); |
| 536 WebMouseEvent dummy_event(WebInputEvent::kMouseDown, | 546 WebMouseEvent dummy_event(WebInputEvent::kMouseDown, |
| 537 WebInputEvent::kNoModifiers, | 547 WebInputEvent::kNoModifiers, |
| 538 WTF::MonotonicallyIncreasingTimeMS()); | 548 WTF::MonotonicallyIncreasingTimeMS()); |
| 539 dummy_event.SetPositionInWidget(point_in_root_frame.x, point_in_root_frame.y); | 549 dummy_event.SetPositionInWidget(point_in_root_frame.x, point_in_root_frame.y); |
| 540 IntPoint transformed_point = FlooredIntPoint( | 550 IntPoint transformed_point = FlooredIntPoint( |
| 541 TransformWebMouseEvent(web_local_frame_impl_->GetFrameView(), dummy_event) | 551 TransformWebMouseEvent(web_local_frame_impl_->GetFrameView(), dummy_event) |
| 542 .PositionInRootFrame()); | 552 .PositionInRootFrame()); |
| 543 HitTestResult result( | 553 HitTestResult result( |
| 544 request, web_local_frame_impl_->GetFrameView()->RootFrameToContents( | 554 request, web_local_frame_impl_->GetFrameView()->RootFrameToContents( |
| 545 transformed_point)); | 555 transformed_point)); |
| 546 web_local_frame_impl_->GetFrame()->ContentLayoutItem().HitTest(result); | 556 web_local_frame_impl_->GetFrame()->ContentLayoutItem().HitTest(result); |
| 547 Node* node = result.InnerNode(); | 557 Node* node = result.InnerNode(); |
| 548 if (!node && web_local_frame_impl_->GetFrame()->GetDocument()) | 558 if (!node && web_local_frame_impl_->GetFrame()->GetDocument()) |
| 549 node = web_local_frame_impl_->GetFrame()->GetDocument()->documentElement(); | 559 node = web_local_frame_impl_->GetFrame()->GetDocument()->documentElement(); |
| 550 overlay_agent_->Inspect(node); | 560 dom_agent_->Inspect(node); |
| 551 } | 561 } |
| 552 | 562 |
| 553 void WebDevToolsAgentImpl::FailedToRequestDevTools() { | 563 void WebDevToolsAgentImpl::FailedToRequestDevTools() { |
| 554 ClientMessageLoopAdapter::ResumeForCreateWindow(); | 564 ClientMessageLoopAdapter::ResumeForCreateWindow(); |
| 555 } | 565 } |
| 556 | 566 |
| 557 void WebDevToolsAgentImpl::SendProtocolMessage(int session_id, | 567 void WebDevToolsAgentImpl::SendProtocolMessage(int session_id, |
| 558 int call_id, | 568 int call_id, |
| 559 const String& response, | 569 const String& response, |
| 560 const String& state) { | 570 const String& state) { |
| 561 ASSERT(Attached()); | 571 ASSERT(Attached()); |
| 562 if (client_) | 572 if (client_) |
| 563 client_->SendProtocolMessage(session_id, call_id, response, state); | 573 client_->SendProtocolMessage(session_id, call_id, response, state); |
| 564 } | 574 } |
| 565 | 575 |
| 566 void WebDevToolsAgentImpl::PageLayoutInvalidated(bool resized) { | 576 void WebDevToolsAgentImpl::PageLayoutInvalidated(bool resized) { |
| 567 if (overlay_agent_) | 577 if (overlay_) |
| 568 overlay_agent_->PageLayoutInvalidated(resized); | 578 overlay_->PageLayoutInvalidated(resized); |
| 579 } |
| 580 |
| 581 void WebDevToolsAgentImpl::ConfigureOverlay(bool suspended, |
| 582 const String& message) { |
| 583 if (!overlay_) |
| 584 return; |
| 585 overlay_->SetPausedInDebuggerMessage(message); |
| 586 if (suspended) |
| 587 overlay_->Suspend(); |
| 588 else |
| 589 overlay_->Resume(); |
| 569 } | 590 } |
| 570 | 591 |
| 571 void WebDevToolsAgentImpl::WaitForCreateWindow(LocalFrame* frame) { | 592 void WebDevToolsAgentImpl::WaitForCreateWindow(LocalFrame* frame) { |
| 572 if (!Attached()) | 593 if (!Attached()) |
| 573 return; | 594 return; |
| 574 if (client_ && | 595 if (client_ && |
| 575 client_->RequestDevToolsForFrame(WebLocalFrameImpl::FromFrame(frame))) | 596 client_->RequestDevToolsForFrame(WebLocalFrameImpl::FromFrame(frame))) |
| 576 ClientMessageLoopAdapter::PauseForCreateWindow(web_local_frame_impl_); | 597 ClientMessageLoopAdapter::PauseForCreateWindow(web_local_frame_impl_); |
| 577 } | 598 } |
| 578 | 599 |
| 579 WebString WebDevToolsAgentImpl::EvaluateInWebInspectorOverlay( | 600 WebString WebDevToolsAgentImpl::EvaluateInWebInspectorOverlay( |
| 580 const WebString& script) { | 601 const WebString& script) { |
| 581 if (!overlay_agent_) | 602 if (!overlay_) |
| 582 return WebString(); | 603 return WebString(); |
| 583 | 604 |
| 584 return overlay_agent_->EvaluateInOverlayForTest(script); | 605 return overlay_->EvaluateInOverlayForTest(script); |
| 585 } | 606 } |
| 586 | 607 |
| 587 bool WebDevToolsAgentImpl::CacheDisabled() { | 608 bool WebDevToolsAgentImpl::CacheDisabled() { |
| 588 if (!network_agent_) | 609 if (!network_agent_) |
| 589 return false; | 610 return false; |
| 590 return network_agent_->CacheDisabled(); | 611 return network_agent_->CacheDisabled(); |
| 591 } | 612 } |
| 592 | 613 |
| 593 void WebDevToolsAgentImpl::FlushProtocolNotifications() { | 614 void WebDevToolsAgentImpl::FlushProtocolNotifications() { |
| 594 if (session_) | 615 if (session_) |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 } | 653 } |
| 633 | 654 |
| 634 bool WebDevToolsAgent::ShouldInterruptForMethod(const WebString& method) { | 655 bool WebDevToolsAgent::ShouldInterruptForMethod(const WebString& method) { |
| 635 return method == "Debugger.pause" || method == "Debugger.setBreakpoint" || | 656 return method == "Debugger.pause" || method == "Debugger.setBreakpoint" || |
| 636 method == "Debugger.setBreakpointByUrl" || | 657 method == "Debugger.setBreakpointByUrl" || |
| 637 method == "Debugger.removeBreakpoint" || | 658 method == "Debugger.removeBreakpoint" || |
| 638 method == "Debugger.setBreakpointsActive"; | 659 method == "Debugger.setBreakpointsActive"; |
| 639 } | 660 } |
| 640 | 661 |
| 641 } // namespace blink | 662 } // namespace blink |
| OLD | NEW |