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

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: rebased Created 6 years, 3 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 reattaching_(false) { 116 reattaching_(false) {
117 SetRenderViewHost(rvh); 117 SetRenderViewHost(rvh);
118 DevToolsProtocol::Notifier notifier(base::Bind( 118 DevToolsProtocol::Notifier notifier(base::Bind(
119 &RenderViewDevToolsAgentHost::OnDispatchOnInspectorFrontend, 119 &RenderViewDevToolsAgentHost::OnDispatchOnInspectorFrontend,
120 base::Unretained(this))); 120 base::Unretained(this)));
121 overrides_handler_->SetNotifier(notifier); 121 overrides_handler_->SetNotifier(notifier);
122 tracing_handler_->SetNotifier(notifier); 122 tracing_handler_->SetNotifier(notifier);
123 power_handler_->SetNotifier(notifier); 123 power_handler_->SetNotifier(notifier);
124 g_instances.Get().push_back(this); 124 g_instances.Get().push_back(this);
125 AddRef(); // Balanced in RenderViewHostDestroyed. 125 AddRef(); // Balanced in RenderViewHostDestroyed.
126 DevToolsManager::GetInstance()->AgentHostChanged(this);
126 } 127 }
127 128
128 WebContents* RenderViewDevToolsAgentHost::GetWebContents() { 129 WebContents* RenderViewDevToolsAgentHost::GetWebContents() {
129 return web_contents(); 130 return web_contents();
130 } 131 }
131 132
132 void RenderViewDevToolsAgentHost::DispatchProtocolMessage( 133 void RenderViewDevToolsAgentHost::DispatchProtocolMessage(
133 const std::string& message) { 134 const std::string& message) {
134 std::string error_message; 135 std::string error_message;
135 136
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 } 284 }
284 285
285 void RenderViewDevToolsAgentHost::RenderViewDeleted(RenderViewHost* rvh) { 286 void RenderViewDevToolsAgentHost::RenderViewDeleted(RenderViewHost* rvh) {
286 if (rvh != render_view_host_) 287 if (rvh != render_view_host_)
287 return; 288 return;
288 289
289 DCHECK(render_view_host_); 290 DCHECK(render_view_host_);
290 scoped_refptr<RenderViewDevToolsAgentHost> protect(this); 291 scoped_refptr<RenderViewDevToolsAgentHost> protect(this);
291 HostClosed(); 292 HostClosed();
292 ClearRenderViewHost(); 293 ClearRenderViewHost();
294 DevToolsManager::GetInstance()->AgentHostChanged(this);
293 Release(); 295 Release();
294 } 296 }
295 297
296 void RenderViewDevToolsAgentHost::RenderProcessGone( 298 void RenderViewDevToolsAgentHost::RenderProcessGone(
297 base::TerminationStatus status) { 299 base::TerminationStatus status) {
298 switch(status) { 300 switch(status) {
299 case base::TERMINATION_STATUS_ABNORMAL_TERMINATION: 301 case base::TERMINATION_STATUS_ABNORMAL_TERMINATION:
300 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED: 302 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED:
301 case base::TERMINATION_STATUS_PROCESS_CRASHED: 303 case base::TERMINATION_STATUS_PROCESS_CRASHED:
302 #if defined(OS_ANDROID) 304 #if defined(OS_ANDROID)
(...skipping 29 matching lines...) Expand all
332 if (!web_contents) 334 if (!web_contents)
333 return; 335 return;
334 DisconnectRenderViewHost(); 336 DisconnectRenderViewHost();
335 ConnectRenderViewHost(web_contents->GetRenderViewHost()); 337 ConnectRenderViewHost(web_contents->GetRenderViewHost());
336 } 338 }
337 339
338 void RenderViewDevToolsAgentHost::DidDetachInterstitialPage() { 340 void RenderViewDevToolsAgentHost::DidDetachInterstitialPage() {
339 overrides_handler_->DidDetachInterstitialPage(); 341 overrides_handler_->DidDetachInterstitialPage();
340 } 342 }
341 343
344 void RenderViewDevToolsAgentHost::TitleWasSet(
345 NavigationEntry* entry, bool explicit_set) {
346 DevToolsManager::GetInstance()->AgentHostChanged(this);
347 }
348
349 void RenderViewDevToolsAgentHost::NavigationEntryCommitted(
350 const LoadCommittedDetails& load_details) {
351 DevToolsManager::GetInstance()->AgentHostChanged(this);
352 }
353
342 void RenderViewDevToolsAgentHost::Observe(int type, 354 void RenderViewDevToolsAgentHost::Observe(int type,
343 const NotificationSource& source, 355 const NotificationSource& source,
344 const NotificationDetails& details) { 356 const NotificationDetails& details) {
345 if (type == content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED) { 357 if (type == content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED) {
346 bool visible = *Details<bool>(details).ptr(); 358 bool visible = *Details<bool>(details).ptr();
347 overrides_handler_->OnVisibilityChanged(visible); 359 overrides_handler_->OnVisibilityChanged(visible);
348 } 360 }
349 } 361 }
350 362
351 void RenderViewDevToolsAgentHost::SetRenderViewHost(RenderViewHost* rvh) { 363 void RenderViewDevToolsAgentHost::SetRenderViewHost(RenderViewHost* rvh) {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 } 483 }
472 484
473 void RenderViewDevToolsAgentHost::OnDispatchOnInspectorFrontend( 485 void RenderViewDevToolsAgentHost::OnDispatchOnInspectorFrontend(
474 const std::string& message) { 486 const std::string& message) {
475 if (!render_view_host_) 487 if (!render_view_host_)
476 return; 488 return;
477 SendMessageToClient(message); 489 SendMessageToClient(message);
478 } 490 }
479 491
480 } // namespace content 492 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698