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

Side by Side Diff: content/browser/debugger/devtools_manager_impl.cc

Issue 9360014: Create a content public browser API around the ChildProcessSecurityPolicy class. The implementati... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 8 years, 10 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/debugger/devtools_manager_impl.h" 5 #include "content/browser/debugger/devtools_manager_impl.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "content/browser/child_process_security_policy.h" 11 #include "content/browser/child_process_security_policy_impl.h"
12 #include "content/browser/debugger/devtools_netlog_observer.h" 12 #include "content/browser/debugger/devtools_netlog_observer.h"
13 #include "content/browser/debugger/render_view_devtools_agent_host.h" 13 #include "content/browser/debugger/render_view_devtools_agent_host.h"
14 #include "content/browser/renderer_host/render_view_host.h" 14 #include "content/browser/renderer_host/render_view_host.h"
15 #include "content/browser/tab_contents/tab_contents.h" 15 #include "content/browser/tab_contents/tab_contents.h"
16 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
17 #include "content/public/browser/devtools_client_host.h" 17 #include "content/public/browser/devtools_client_host.h"
18 #include "content/public/browser/devtools_agent_host_registry.h" 18 #include "content/public/browser/devtools_agent_host_registry.h"
19 #include "googleurl/src/gurl.h" 19 #include "googleurl/src/gurl.h"
20 20
21 namespace content { 21 namespace content {
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 BrowserThread::IO, 233 BrowserThread::IO,
234 FROM_HERE, 234 FROM_HERE,
235 base::Bind(&DevToolsNetLogObserver::Attach)); 235 base::Bind(&DevToolsNetLogObserver::Attach));
236 } 236 }
237 agent_to_client_host_[agent_host] = client_host; 237 agent_to_client_host_[agent_host] = client_host;
238 client_to_agent_host_[client_host] = agent_host; 238 client_to_agent_host_[client_host] = agent_host;
239 agent_host->set_close_listener(this); 239 agent_host->set_close_listener(this);
240 240
241 int process_id = agent_host->GetRenderProcessId(); 241 int process_id = agent_host->GetRenderProcessId();
242 if (process_id != -1) 242 if (process_id != -1)
243 ChildProcessSecurityPolicy::GetInstance()->GrantReadRawCookies(process_id); 243 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadRawCookies(
244 process_id);
244 } 245 }
245 246
246 void DevToolsManagerImpl::UnbindClientHost(DevToolsAgentHost* agent_host, 247 void DevToolsManagerImpl::UnbindClientHost(DevToolsAgentHost* agent_host,
247 DevToolsClientHost* client_host) { 248 DevToolsClientHost* client_host) {
248 DCHECK(agent_host); 249 DCHECK(agent_host);
249 DCHECK(agent_to_client_host_.find(agent_host)->second == 250 DCHECK(agent_to_client_host_.find(agent_host)->second ==
250 client_host); 251 client_host);
251 DCHECK(client_to_agent_host_.find(client_host)->second == 252 DCHECK(client_to_agent_host_.find(client_host)->second ==
252 agent_host); 253 agent_host);
253 agent_host->set_close_listener(NULL); 254 agent_host->set_close_listener(NULL);
(...skipping 13 matching lines...) Expand all
267 int process_id = agent_host->GetRenderProcessId(); 268 int process_id = agent_host->GetRenderProcessId();
268 if (process_id == -1) 269 if (process_id == -1)
269 return; 270 return;
270 for (AgentToClientHostMap::iterator it = agent_to_client_host_.begin(); 271 for (AgentToClientHostMap::iterator it = agent_to_client_host_.begin();
271 it != agent_to_client_host_.end(); 272 it != agent_to_client_host_.end();
272 ++it) { 273 ++it) {
273 if (it->first->GetRenderProcessId() == process_id) 274 if (it->first->GetRenderProcessId() == process_id)
274 return; 275 return;
275 } 276 }
276 // We've disconnected from the last renderer -> revoke cookie permissions. 277 // We've disconnected from the last renderer -> revoke cookie permissions.
277 ChildProcessSecurityPolicy::GetInstance()->RevokeReadRawCookies(process_id); 278 ChildProcessSecurityPolicyImpl::GetInstance()->RevokeReadRawCookies(
279 process_id);
278 } 280 }
279 281
280 void DevToolsManagerImpl::CloseAllClientHosts() { 282 void DevToolsManagerImpl::CloseAllClientHosts() {
281 std::vector<DevToolsAgentHost*> agents; 283 std::vector<DevToolsAgentHost*> agents;
282 for (AgentToClientHostMap::iterator it = 284 for (AgentToClientHostMap::iterator it =
283 agent_to_client_host_.begin(); 285 agent_to_client_host_.begin();
284 it != agent_to_client_host_.end(); ++it) { 286 it != agent_to_client_host_.end(); ++it) {
285 agents.push_back(it->first); 287 agents.push_back(it->first);
286 } 288 }
287 for (std::vector<DevToolsAgentHost*>::iterator it = agents.begin(); 289 for (std::vector<DevToolsAgentHost*>::iterator it = agents.begin();
288 it != agents.end(); ++it) { 290 it != agents.end(); ++it) {
289 UnregisterDevToolsClientHostFor(*it); 291 UnregisterDevToolsClientHostFor(*it);
290 } 292 }
291 } 293 }
292 294
293 } // namespace content 295 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/child_process_security_policy_unittest.cc ('k') | content/browser/renderer_host/blob_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698