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

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

Issue 16431010: Refactor RenderProcessHost to use IPC::Listener instead of RenderWidgetHost (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing Windows compile error. Created 7 years, 6 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 | Annotate | Revision Log
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 "content/browser/child_process_security_policy_impl.h" 9 #include "content/browser/child_process_security_policy_impl.h"
10 #include "content/browser/devtools/devtools_manager_impl.h" 10 #include "content/browser/devtools/devtools_manager_impl.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 if (cookie == (*it)->GetId()) { 113 if (cookie == (*it)->GetId()) {
114 (*it)->ConnectRenderViewHost(rvh, true); 114 (*it)->ConnectRenderViewHost(rvh, true);
115 break; 115 break;
116 } 116 }
117 } 117 }
118 } 118 }
119 119
120 //static 120 //static
121 std::vector<RenderViewHost*> DevToolsAgentHost::GetValidRenderViewHosts() { 121 std::vector<RenderViewHost*> DevToolsAgentHost::GetValidRenderViewHosts() {
122 std::vector<RenderViewHost*> result; 122 std::vector<RenderViewHost*> result;
123 for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator()); 123 RenderWidgetHost::List widgets = RenderWidgetHost::GetRenderWidgetHosts();
124 !it.IsAtEnd(); it.Advance()) { 124 for (RenderWidgetHost::List::const_iterator it = widgets.begin();
125 RenderProcessHost* render_process_host = it.GetCurrentValue(); 125 it != widgets.end(); ++it) {
jam 2013/06/12 19:59:59 ditto
nasko 2013/06/12 21:18:59 Done.
126 DCHECK(render_process_host); 126 const RenderWidgetHost* widget = *it;
127 127
128 // Ignore processes that don't have a connection, such as crashed contents. 128 // Ignore processes that don't have a connection, such as crashed contents.
129 if (!render_process_host->HasConnection()) 129 if (!widget->GetProcess()->HasConnection())
130 continue; 130 continue;
131 131
132 RenderProcessHost::RenderWidgetHostsIterator rwit( 132 if (!widget->IsRenderView())
133 render_process_host->GetRenderWidgetHostsIterator()); 133 continue;
134 for (; !rwit.IsAtEnd(); rwit.Advance()) {
135 const RenderWidgetHost* widget = rwit.GetCurrentValue();
136 DCHECK(widget);
137 if (!widget || !widget->IsRenderView())
138 continue;
139 134
140 RenderViewHost* rvh = 135 RenderViewHost* rvh =
141 RenderViewHost::From(const_cast<RenderWidgetHost*>(widget)); 136 RenderViewHost::From(const_cast<RenderWidgetHost*>(widget));
142 // Don't report swapped out views. 137 // Don't report swapped out views.
143 if (static_cast<RenderViewHostImpl*>(rvh)->is_swapped_out()) 138 if (static_cast<RenderViewHostImpl*>(rvh)->is_swapped_out())
144 continue; 139 continue;
145 140
146 WebContents* web_contents = WebContents::FromRenderViewHost(rvh); 141 WebContents* web_contents = WebContents::FromRenderViewHost(rvh);
147 // Don't report a RenderViewHost if it is not the current RenderViewHost 142 // Don't report a RenderViewHost if it is not the current RenderViewHost
148 // for some WebContents. 143 // for some WebContents.
149 if (!web_contents || rvh != web_contents->GetRenderViewHost()) 144 if (!web_contents || rvh != web_contents->GetRenderViewHost())
150 continue; 145 continue;
151 146
152 result.push_back(rvh); 147 result.push_back(rvh);
153 }
154 } 148 }
155 return result; 149 return result;
156 } 150 }
157 151
158 // static 152 // static
159 void RenderViewDevToolsAgentHost::OnCancelPendingNavigation( 153 void RenderViewDevToolsAgentHost::OnCancelPendingNavigation(
160 RenderViewHost* pending, 154 RenderViewHost* pending,
161 RenderViewHost* current) { 155 RenderViewHost* current) {
162 std::string cookie = DevToolsAgentHost::DisconnectRenderViewHost(pending); 156 std::string cookie = DevToolsAgentHost::DisconnectRenderViewHost(pending);
163 if (cookie != std::string()) 157 if (cookie != std::string())
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 if (render_view_host_) 327 if (render_view_host_)
334 GetContentClient()->browser()->ClearCache(render_view_host_); 328 GetContentClient()->browser()->ClearCache(render_view_host_);
335 } 329 }
336 330
337 void RenderViewDevToolsAgentHost::OnClearBrowserCookies() { 331 void RenderViewDevToolsAgentHost::OnClearBrowserCookies() {
338 if (render_view_host_) 332 if (render_view_host_)
339 GetContentClient()->browser()->ClearCookies(render_view_host_); 333 GetContentClient()->browser()->ClearCookies(render_view_host_);
340 } 334 }
341 335
342 } // namespace content 336 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698