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