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

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

Issue 577923002: [DevTools] Implement DevToolsManager::Observer which notifies about target updates. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move-enumerate-to-dtm-delegate
Patch Set: fixed test flakiness Created 6 years, 2 months 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_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
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);
133 } 134 }
134 135
135 WebContents* RenderViewDevToolsAgentHost::GetWebContents() { 136 WebContents* RenderViewDevToolsAgentHost::GetWebContents() {
136 return web_contents(); 137 return web_contents();
137 } 138 }
138 139
139 void RenderViewDevToolsAgentHost::DispatchProtocolMessage( 140 void RenderViewDevToolsAgentHost::DispatchProtocolMessage(
140 const std::string& message) { 141 const std::string& message) {
141 std::string error_message; 142 std::string error_message;
142 143
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 } 293 }
293 294
294 void RenderViewDevToolsAgentHost::RenderViewDeleted(RenderViewHost* rvh) { 295 void RenderViewDevToolsAgentHost::RenderViewDeleted(RenderViewHost* rvh) {
295 if (rvh != render_view_host_) 296 if (rvh != render_view_host_)
296 return; 297 return;
297 298
298 DCHECK(render_view_host_); 299 DCHECK(render_view_host_);
299 scoped_refptr<RenderViewDevToolsAgentHost> protect(this); 300 scoped_refptr<RenderViewDevToolsAgentHost> protect(this);
300 HostClosed(); 301 HostClosed();
301 ClearRenderViewHost(); 302 ClearRenderViewHost();
303 DevToolsManager::GetInstance()->AgentHostChanged(this);
302 Release(); 304 Release();
303 } 305 }
304 306
305 void RenderViewDevToolsAgentHost::RenderProcessGone( 307 void RenderViewDevToolsAgentHost::RenderProcessGone(
306 base::TerminationStatus status) { 308 base::TerminationStatus status) {
307 switch(status) { 309 switch(status) {
308 case base::TERMINATION_STATUS_ABNORMAL_TERMINATION: 310 case base::TERMINATION_STATUS_ABNORMAL_TERMINATION:
309 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED: 311 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED:
310 case base::TERMINATION_STATUS_PROCESS_CRASHED: 312 case base::TERMINATION_STATUS_PROCESS_CRASHED:
311 #if defined(OS_ANDROID) 313 #if defined(OS_ANDROID)
(...skipping 29 matching lines...) Expand all
341 if (!web_contents) 343 if (!web_contents)
342 return; 344 return;
343 DisconnectRenderViewHost(); 345 DisconnectRenderViewHost();
344 ConnectRenderViewHost(web_contents->GetRenderViewHost()); 346 ConnectRenderViewHost(web_contents->GetRenderViewHost());
345 } 347 }
346 348
347 void RenderViewDevToolsAgentHost::DidDetachInterstitialPage() { 349 void RenderViewDevToolsAgentHost::DidDetachInterstitialPage() {
348 overrides_handler_->DidDetachInterstitialPage(); 350 overrides_handler_->DidDetachInterstitialPage();
349 } 351 }
350 352
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
351 void RenderViewDevToolsAgentHost::Observe(int type, 363 void RenderViewDevToolsAgentHost::Observe(int type,
352 const NotificationSource& source, 364 const NotificationSource& source,
353 const NotificationDetails& details) { 365 const NotificationDetails& details) {
354 if (type == content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED) { 366 if (type == content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED) {
355 bool visible = *Details<bool>(details).ptr(); 367 bool visible = *Details<bool>(details).ptr();
356 overrides_handler_->OnVisibilityChanged(visible); 368 overrides_handler_->OnVisibilityChanged(visible);
357 } 369 }
358 } 370 }
359 371
360 void RenderViewDevToolsAgentHost::SetRenderViewHost(RenderViewHost* rvh) { 372 void RenderViewDevToolsAgentHost::SetRenderViewHost(RenderViewHost* rvh) {
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 } 496 }
485 497
486 void RenderViewDevToolsAgentHost::OnDispatchOnInspectorFrontend( 498 void RenderViewDevToolsAgentHost::OnDispatchOnInspectorFrontend(
487 const std::string& message) { 499 const std::string& message) {
488 if (!render_view_host_) 500 if (!render_view_host_)
489 return; 501 return;
490 SendMessageToClient(message); 502 SendMessageToClient(message);
491 } 503 }
492 504
493 } // namespace content 505 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/devtools/render_view_devtools_agent_host.h ('k') | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698