OLD | NEW |
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_view_devtools_agent_host.h" | 5 #include "content/browser/devtools/render_view_devtools_agent_host.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "content/browser/child_process_security_policy_impl.h" | 10 #include "content/browser/child_process_security_policy_impl.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 SetRenderViewHost(rvh); | 123 SetRenderViewHost(rvh); |
124 DevToolsProtocol::Notifier notifier(base::Bind( | 124 DevToolsProtocol::Notifier notifier(base::Bind( |
125 &RenderViewDevToolsAgentHost::OnDispatchOnInspectorFrontend, | 125 &RenderViewDevToolsAgentHost::OnDispatchOnInspectorFrontend, |
126 base::Unretained(this))); | 126 base::Unretained(this))); |
127 handler_impl_->SetNotifier(notifier); | 127 handler_impl_->SetNotifier(notifier); |
128 overrides_handler_->SetNotifier(notifier); | 128 overrides_handler_->SetNotifier(notifier); |
129 tracing_handler_->SetNotifier(notifier); | 129 tracing_handler_->SetNotifier(notifier); |
130 power_handler_->SetNotifier(notifier); | 130 power_handler_->SetNotifier(notifier); |
131 g_instances.Get().push_back(this); | 131 g_instances.Get().push_back(this); |
132 AddRef(); // Balanced in RenderViewHostDestroyed. | 132 AddRef(); // Balanced in RenderViewHostDestroyed. |
133 DevToolsManager::GetInstance()->AgentHostChanged(this); | |
134 } | 133 } |
135 | 134 |
136 WebContents* RenderViewDevToolsAgentHost::GetWebContents() { | 135 WebContents* RenderViewDevToolsAgentHost::GetWebContents() { |
137 return web_contents(); | 136 return web_contents(); |
138 } | 137 } |
139 | 138 |
140 void RenderViewDevToolsAgentHost::DispatchProtocolMessage( | 139 void RenderViewDevToolsAgentHost::DispatchProtocolMessage( |
141 const std::string& message) { | 140 const std::string& message) { |
142 std::string error_message; | 141 std::string error_message; |
143 | 142 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 } | 292 } |
294 | 293 |
295 void RenderViewDevToolsAgentHost::RenderViewDeleted(RenderViewHost* rvh) { | 294 void RenderViewDevToolsAgentHost::RenderViewDeleted(RenderViewHost* rvh) { |
296 if (rvh != render_view_host_) | 295 if (rvh != render_view_host_) |
297 return; | 296 return; |
298 | 297 |
299 DCHECK(render_view_host_); | 298 DCHECK(render_view_host_); |
300 scoped_refptr<RenderViewDevToolsAgentHost> protect(this); | 299 scoped_refptr<RenderViewDevToolsAgentHost> protect(this); |
301 HostClosed(); | 300 HostClosed(); |
302 ClearRenderViewHost(); | 301 ClearRenderViewHost(); |
303 DevToolsManager::GetInstance()->AgentHostChanged(this); | |
304 Release(); | 302 Release(); |
305 } | 303 } |
306 | 304 |
307 void RenderViewDevToolsAgentHost::RenderProcessGone( | 305 void RenderViewDevToolsAgentHost::RenderProcessGone( |
308 base::TerminationStatus status) { | 306 base::TerminationStatus status) { |
309 switch(status) { | 307 switch(status) { |
310 case base::TERMINATION_STATUS_ABNORMAL_TERMINATION: | 308 case base::TERMINATION_STATUS_ABNORMAL_TERMINATION: |
311 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED: | 309 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED: |
312 case base::TERMINATION_STATUS_PROCESS_CRASHED: | 310 case base::TERMINATION_STATUS_PROCESS_CRASHED: |
313 #if defined(OS_ANDROID) | 311 #if defined(OS_ANDROID) |
(...skipping 29 matching lines...) Expand all Loading... |
343 if (!web_contents) | 341 if (!web_contents) |
344 return; | 342 return; |
345 DisconnectRenderViewHost(); | 343 DisconnectRenderViewHost(); |
346 ConnectRenderViewHost(web_contents->GetRenderViewHost()); | 344 ConnectRenderViewHost(web_contents->GetRenderViewHost()); |
347 } | 345 } |
348 | 346 |
349 void RenderViewDevToolsAgentHost::DidDetachInterstitialPage() { | 347 void RenderViewDevToolsAgentHost::DidDetachInterstitialPage() { |
350 overrides_handler_->DidDetachInterstitialPage(); | 348 overrides_handler_->DidDetachInterstitialPage(); |
351 } | 349 } |
352 | 350 |
353 void RenderViewDevToolsAgentHost::TitleWasSet( | |
354 NavigationEntry* entry, bool explicit_set) { | |
355 DevToolsManager::GetInstance()->AgentHostChanged(this); | |
356 } | |
357 | |
358 void RenderViewDevToolsAgentHost::NavigationEntryCommitted( | |
359 const LoadCommittedDetails& load_details) { | |
360 DevToolsManager::GetInstance()->AgentHostChanged(this); | |
361 } | |
362 | |
363 void RenderViewDevToolsAgentHost::Observe(int type, | 351 void RenderViewDevToolsAgentHost::Observe(int type, |
364 const NotificationSource& source, | 352 const NotificationSource& source, |
365 const NotificationDetails& details) { | 353 const NotificationDetails& details) { |
366 if (type == content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED) { | 354 if (type == content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED) { |
367 bool visible = *Details<bool>(details).ptr(); | 355 bool visible = *Details<bool>(details).ptr(); |
368 overrides_handler_->OnVisibilityChanged(visible); | 356 overrides_handler_->OnVisibilityChanged(visible); |
369 } | 357 } |
370 } | 358 } |
371 | 359 |
372 void RenderViewDevToolsAgentHost::SetRenderViewHost(RenderViewHost* rvh) { | 360 void RenderViewDevToolsAgentHost::SetRenderViewHost(RenderViewHost* rvh) { |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 } | 484 } |
497 | 485 |
498 void RenderViewDevToolsAgentHost::OnDispatchOnInspectorFrontend( | 486 void RenderViewDevToolsAgentHost::OnDispatchOnInspectorFrontend( |
499 const std::string& message) { | 487 const std::string& message) { |
500 if (!render_view_host_) | 488 if (!render_view_host_) |
501 return; | 489 return; |
502 SendMessageToClient(message); | 490 SendMessageToClient(message); |
503 } | 491 } |
504 | 492 |
505 } // namespace content | 493 } // namespace content |
OLD | NEW |