| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "content/browser/debugger/devtools_manager.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "content/browser/browser_thread.h" | 10 #include "content/browser/browser_thread.h" |
| 11 #include "content/browser/browsing_instance.h" | 11 #include "content/browser/browsing_instance.h" |
| 12 #include "content/browser/child_process_security_policy.h" | |
| 13 #include "content/browser/content_browser_client.h" | 12 #include "content/browser/content_browser_client.h" |
| 14 #include "content/browser/debugger/devtools_client_host.h" | 13 #include "content/browser/debugger/devtools_client_host.h" |
| 15 #include "content/browser/debugger/devtools_netlog_observer.h" | 14 #include "content/browser/debugger/devtools_netlog_observer.h" |
| 15 #include "content/browser/debugger/render_view_devtools_agent_host.h" |
| 16 #include "content/browser/renderer_host/render_view_host.h" | 16 #include "content/browser/renderer_host/render_view_host.h" |
| 17 #include "content/browser/site_instance.h" | |
| 18 #include "content/browser/tab_contents/tab_contents.h" | 17 #include "content/browser/tab_contents/tab_contents.h" |
| 19 #include "content/common/content_client.h" | 18 #include "content/common/content_client.h" |
| 20 #include "content/common/devtools_messages.h" | 19 #include "content/common/devtools_messages.h" |
| 21 #include "content/common/notification_service.h" | |
| 22 #include "googleurl/src/gurl.h" | 20 #include "googleurl/src/gurl.h" |
| 23 | 21 |
| 24 // static | 22 // static |
| 25 DevToolsManager* DevToolsManager::GetInstance() { | 23 DevToolsManager* DevToolsManager::GetInstance() { |
| 26 return content::GetContentClient()->browser()->GetDevToolsManager(); | 24 return content::GetContentClient()->browser()->GetDevToolsManager(); |
| 27 } | 25 } |
| 28 | 26 |
| 29 DevToolsManager::DevToolsManager() | 27 DevToolsManager::DevToolsManager() |
| 30 : last_orphan_cookie_(0) { | 28 : last_orphan_cookie_(0) { |
| 31 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, | |
| 32 NotificationService::AllSources()); | |
| 33 } | 29 } |
| 34 | 30 |
| 35 DevToolsManager::~DevToolsManager() { | 31 DevToolsManager::~DevToolsManager() { |
| 36 DCHECK(inspected_rvh_to_client_host_.empty()); | 32 DCHECK(agent_to_client_host_.empty()); |
| 37 DCHECK(client_host_to_inspected_rvh_.empty()); | 33 DCHECK(client_to_agent_host_.empty()); |
| 38 // By the time we destroy devtools manager, all orphan client hosts should | 34 // By the time we destroy devtools manager, all orphan client hosts should |
| 39 // have been delelted, no need to notify them upon tab closing. | 35 // have been delelted, no need to notify them upon tab closing. |
| 40 DCHECK(orphan_client_hosts_.empty()); | 36 DCHECK(orphan_client_hosts_.empty()); |
| 41 } | 37 } |
| 42 | 38 |
| 43 DevToolsClientHost* DevToolsManager::GetDevToolsClientHostFor( | 39 DevToolsClientHost* DevToolsManager::GetDevToolsClientHostFor( |
| 44 RenderViewHost* inspected_rvh) { | 40 RenderViewHost* inspected_rvh) { |
| 45 InspectedRvhToClientHostMap::iterator it = | 41 DevToolsAgentHost* agent_host = RenderViewDevToolsAgentHost::FindFor( |
| 46 inspected_rvh_to_client_host_.find(inspected_rvh); | 42 inspected_rvh); |
| 47 if (it != inspected_rvh_to_client_host_.end()) | 43 if (!agent_host) |
| 44 return NULL; |
| 45 return GetDevToolsClientHostFor(agent_host); |
| 46 } |
| 47 |
| 48 DevToolsClientHost* DevToolsManager::GetDevToolsClientHostFor( |
| 49 DevToolsAgentHost* agent_host) { |
| 50 AgentToClientHostMap::iterator it = agent_to_client_host_.find(agent_host); |
| 51 if (it != agent_to_client_host_.end()) |
| 48 return it->second; | 52 return it->second; |
| 49 return NULL; | 53 return NULL; |
| 50 } | 54 } |
| 51 | 55 |
| 52 void DevToolsManager::RegisterDevToolsClientHostFor( | 56 void DevToolsManager::RegisterDevToolsClientHostFor( |
| 53 RenderViewHost* inspected_rvh, | 57 RenderViewHost* inspected_rvh, |
| 54 DevToolsClientHost* client_host) { | 58 DevToolsClientHost* client_host) { |
| 55 DCHECK(!GetDevToolsClientHostFor(inspected_rvh)); | 59 DCHECK(!GetDevToolsClientHostFor(inspected_rvh)); |
| 56 | 60 |
| 57 DevToolsRuntimeProperties initial_properties; | 61 DevToolsRuntimeProperties initial_properties; |
| 58 BindClientHost(inspected_rvh, client_host, initial_properties); | 62 DevToolsAgentHost* agent_host = RenderViewDevToolsAgentHost::CreateFor( |
| 63 inspected_rvh); |
| 64 BindClientHost(agent_host, client_host, initial_properties); |
| 59 client_host->set_close_listener(this); | 65 client_host->set_close_listener(this); |
| 60 SendAttachToAgent(inspected_rvh); | 66 SendAttachToAgent(agent_host); |
| 61 } | 67 } |
| 62 | 68 |
| 63 bool DevToolsManager::ForwardToDevToolsAgent(DevToolsClientHost* from, | 69 bool DevToolsManager::ForwardToDevToolsAgent(DevToolsClientHost* from, |
| 64 const IPC::Message& message) { | 70 const IPC::Message& message) { |
| 65 RenderViewHost* inspected_rvh = GetInspectedRenderViewHost(from); | 71 DevToolsAgentHost* agent_host = GetAgentHost(from); |
| 66 if (!inspected_rvh) | 72 if (!agent_host) |
| 67 return false; | 73 return false; |
| 68 | 74 |
| 69 IPC::Message* m = new IPC::Message(message); | 75 agent_host->SendMessageToAgent(new IPC::Message(message)); |
| 70 m->set_routing_id(inspected_rvh->routing_id()); | |
| 71 inspected_rvh->Send(m); | |
| 72 return true; | 76 return true; |
| 73 } | 77 } |
| 74 | 78 |
| 75 void DevToolsManager::ForwardToDevToolsClient(RenderViewHost* inspected_rvh, | 79 void DevToolsManager::ForwardToDevToolsClient(RenderViewHost* inspected_rvh, |
| 76 const IPC::Message& message) { | 80 const IPC::Message& message) { |
| 77 DevToolsClientHost* client_host = GetDevToolsClientHostFor(inspected_rvh); | 81 DevToolsClientHost* client_host = GetDevToolsClientHostFor(inspected_rvh); |
| 78 if (!client_host) { | 82 if (!client_host) { |
| 79 // Client window was closed while there were messages | 83 // Client window was closed while there were messages |
| 80 // being sent to it. | 84 // being sent to it. |
| 81 return; | 85 return; |
| 82 } | 86 } |
| 83 client_host->SendMessageToClient(message); | 87 client_host->SendMessageToClient(message); |
| 84 } | 88 } |
| 85 | 89 |
| 86 void DevToolsManager::RuntimePropertyChanged(RenderViewHost* inspected_rvh, | 90 void DevToolsManager::RuntimePropertyChanged(RenderViewHost* inspected_rvh, |
| 87 const std::string& name, | 91 const std::string& name, |
| 88 const std::string& value) { | 92 const std::string& value) { |
| 93 DevToolsAgentHost* agent_host = RenderViewDevToolsAgentHost::FindFor( |
| 94 inspected_rvh); |
| 89 RuntimePropertiesMap::iterator it = | 95 RuntimePropertiesMap::iterator it = |
| 90 runtime_properties_map_.find(inspected_rvh); | 96 runtime_properties_map_.find(agent_host); |
| 91 if (it == runtime_properties_map_.end()) { | 97 if (it == runtime_properties_map_.end()) { |
| 92 std::pair<RenderViewHost*, DevToolsRuntimeProperties> value( | 98 std::pair<DevToolsAgentHost*, DevToolsRuntimeProperties> value( |
| 93 inspected_rvh, | 99 agent_host, |
| 94 DevToolsRuntimeProperties()); | 100 DevToolsRuntimeProperties()); |
| 95 it = runtime_properties_map_.insert(value).first; | 101 it = runtime_properties_map_.insert(value).first; |
| 96 } | 102 } |
| 97 it->second[name] = value; | 103 it->second[name] = value; |
| 98 } | 104 } |
| 99 | 105 |
| 100 void DevToolsManager::SendInspectElement(RenderViewHost* inspected_rvh, | 106 void DevToolsManager::SendInspectElement(RenderViewHost* inspected_rvh, |
| 101 int x, | 107 int x, |
| 102 int y) { | 108 int y) { |
| 103 inspected_rvh->Send(new DevToolsAgentMsg_InspectElement( | 109 inspected_rvh->Send(new DevToolsAgentMsg_InspectElement( |
| 104 inspected_rvh->routing_id(), | 110 inspected_rvh->routing_id(), |
| 105 x, | 111 x, |
| 106 y)); | 112 y)); |
| 107 } | 113 } |
| 108 | 114 |
| 109 void DevToolsManager::ClientHostClosing(DevToolsClientHost* host) { | 115 void DevToolsManager::ClientHostClosing(DevToolsClientHost* client_host) { |
| 110 RenderViewHost* inspected_rvh = GetInspectedRenderViewHost(host); | 116 DevToolsAgentHost* agent_host = GetAgentHost(client_host); |
| 111 if (!inspected_rvh) { | 117 if (!agent_host) { |
| 112 // It might be in the list of orphan client hosts, remove it from there. | 118 // It might be in the list of orphan client hosts, remove it from there. |
| 113 for (OrphanClientHosts::iterator it = orphan_client_hosts_.begin(); | 119 for (OrphanClientHosts::iterator it = orphan_client_hosts_.begin(); |
| 114 it != orphan_client_hosts_.end(); ++it) { | 120 it != orphan_client_hosts_.end(); ++it) { |
| 115 if (it->second.first == host) { | 121 if (it->second.first == client_host) { |
| 116 orphan_client_hosts_.erase(it->first); | 122 orphan_client_hosts_.erase(it->first); |
| 117 return; | 123 return; |
| 118 } | 124 } |
| 119 } | 125 } |
| 120 return; | 126 return; |
| 121 } | 127 } |
| 122 | 128 |
| 123 NotificationService::current()->Notify( | 129 agent_host->NotifyClientClosing(); |
| 124 content::NOTIFICATION_DEVTOOLS_WINDOW_CLOSING, | |
| 125 Source<content::BrowserContext>( | |
| 126 inspected_rvh->site_instance()->GetProcess()->browser_context()), | |
| 127 Details<RenderViewHost>(inspected_rvh)); | |
| 128 | 130 |
| 129 UnbindClientHost(inspected_rvh, host); | 131 UnbindClientHost(agent_host, client_host); |
| 130 } | 132 } |
| 131 | 133 |
| 132 void DevToolsManager::Observe(int type, | 134 void DevToolsManager::AgentHostClosing(DevToolsAgentHost* agent_host) { |
| 133 const NotificationSource& source, | 135 UnregisterDevToolsClientHostFor(agent_host); |
| 134 const NotificationDetails& details) { | |
| 135 DCHECK(type == content::NOTIFICATION_RENDER_VIEW_HOST_DELETED); | |
| 136 UnregisterDevToolsClientHostFor(Source<RenderViewHost>(source).ptr()); | |
| 137 } | 136 } |
| 138 | 137 |
| 139 RenderViewHost* DevToolsManager::GetInspectedRenderViewHost( | 138 DevToolsAgentHost* DevToolsManager::GetAgentHost( |
| 140 DevToolsClientHost* client_host) { | 139 DevToolsClientHost* client_host) { |
| 141 ClientHostToInspectedRvhMap::iterator it = | 140 ClientHostToInspectedRvhMap::iterator it = |
| 142 client_host_to_inspected_rvh_.find(client_host); | 141 client_to_agent_host_.find(client_host); |
| 143 if (it != client_host_to_inspected_rvh_.end()) | 142 if (it != client_to_agent_host_.end()) |
| 144 return it->second; | 143 return it->second; |
| 145 return NULL; | 144 return NULL; |
| 146 } | 145 } |
| 147 | 146 |
| 148 void DevToolsManager::UnregisterDevToolsClientHostFor( | 147 void DevToolsManager::UnregisterDevToolsClientHostFor( |
| 149 RenderViewHost* inspected_rvh) { | 148 RenderViewHost* inspected_rvh) { |
| 150 DevToolsClientHost* host = GetDevToolsClientHostFor(inspected_rvh); | 149 DevToolsAgentHost* agent_host = RenderViewDevToolsAgentHost::FindFor( |
| 151 if (!host) | 150 inspected_rvh); |
| 151 if (agent_host) |
| 152 UnregisterDevToolsClientHostFor(agent_host); |
| 153 } |
| 154 |
| 155 void DevToolsManager::UnregisterDevToolsClientHostFor( |
| 156 DevToolsAgentHost* agent_host) { |
| 157 DevToolsClientHost* client_host = GetDevToolsClientHostFor(agent_host); |
| 158 if (!client_host) |
| 152 return; | 159 return; |
| 153 UnbindClientHost(inspected_rvh, host); | 160 UnbindClientHost(agent_host, client_host); |
| 154 host->InspectedTabClosing(); | 161 client_host->InspectedTabClosing(); |
| 155 } | 162 } |
| 156 | 163 |
| 157 void DevToolsManager::OnNavigatingToPendingEntry(RenderViewHost* rvh, | 164 void DevToolsManager::OnNavigatingToPendingEntry(RenderViewHost* rvh, |
| 158 RenderViewHost* dest_rvh, | 165 RenderViewHost* dest_rvh, |
| 159 const GURL& gurl) { | 166 const GURL& gurl) { |
| 160 int cookie = DetachClientHost(rvh); | 167 int cookie = DetachClientHost(rvh); |
| 161 if (cookie != -1) { | 168 if (cookie != -1) { |
| 162 // Navigating to URL in the inspected window. | 169 // Navigating to URL in the inspected window. |
| 163 AttachClientHost(cookie, dest_rvh); | 170 AttachClientHost(cookie, dest_rvh); |
| 164 | 171 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 175 return; // Didn't know about old_tab. | 182 return; // Didn't know about old_tab. |
| 176 int cookie = DetachClientHost(old_rvh); | 183 int cookie = DetachClientHost(old_rvh); |
| 177 if (cookie == -1) | 184 if (cookie == -1) |
| 178 return; // Didn't know about old_tab. | 185 return; // Didn't know about old_tab. |
| 179 | 186 |
| 180 client_host->TabReplaced(new_tab); | 187 client_host->TabReplaced(new_tab); |
| 181 AttachClientHost(cookie, new_tab->render_view_host()); | 188 AttachClientHost(cookie, new_tab->render_view_host()); |
| 182 } | 189 } |
| 183 | 190 |
| 184 int DevToolsManager::DetachClientHost(RenderViewHost* from_rvh) { | 191 int DevToolsManager::DetachClientHost(RenderViewHost* from_rvh) { |
| 185 DevToolsClientHost* client_host = GetDevToolsClientHostFor(from_rvh); | 192 DevToolsAgentHost* agent_host = RenderViewDevToolsAgentHost::FindFor( |
| 193 from_rvh); |
| 194 if (!agent_host) |
| 195 return -1; |
| 196 DevToolsClientHost* client_host = GetDevToolsClientHostFor(agent_host); |
| 186 if (!client_host) | 197 if (!client_host) |
| 187 return -1; | 198 return -1; |
| 188 | 199 |
| 189 int cookie = last_orphan_cookie_++; | 200 int cookie = last_orphan_cookie_++; |
| 190 orphan_client_hosts_[cookie] = | 201 orphan_client_hosts_[cookie] = |
| 191 std::pair<DevToolsClientHost*, DevToolsRuntimeProperties>( | 202 std::pair<DevToolsClientHost*, DevToolsRuntimeProperties>( |
| 192 client_host, runtime_properties_map_[from_rvh]); | 203 client_host, runtime_properties_map_[agent_host]); |
| 193 | 204 |
| 194 UnbindClientHost(from_rvh, client_host); | 205 UnbindClientHost(agent_host, client_host); |
| 195 return cookie; | 206 return cookie; |
| 196 } | 207 } |
| 197 | 208 |
| 198 void DevToolsManager::AttachClientHost(int client_host_cookie, | 209 void DevToolsManager::AttachClientHost(int client_host_cookie, |
| 199 RenderViewHost* to_rvh) { | 210 RenderViewHost* to_rvh) { |
| 200 OrphanClientHosts::iterator it = orphan_client_hosts_.find( | 211 OrphanClientHosts::iterator it = orphan_client_hosts_.find( |
| 201 client_host_cookie); | 212 client_host_cookie); |
| 202 if (it == orphan_client_hosts_.end()) | 213 if (it == orphan_client_hosts_.end()) |
| 203 return; | 214 return; |
| 204 | 215 |
| 205 DevToolsClientHost* client_host = (*it).second.first; | 216 DevToolsClientHost* client_host = (*it).second.first; |
| 206 BindClientHost(to_rvh, client_host, (*it).second.second); | 217 DevToolsAgentHost* agent_host = RenderViewDevToolsAgentHost::CreateFor( |
| 207 SendAttachToAgent(to_rvh); | 218 to_rvh); |
| 219 BindClientHost(agent_host, client_host, (*it).second.second); |
| 220 SendAttachToAgent(agent_host); |
| 208 | 221 |
| 209 orphan_client_hosts_.erase(client_host_cookie); | 222 orphan_client_hosts_.erase(client_host_cookie); |
| 210 } | 223 } |
| 211 | 224 |
| 212 void DevToolsManager::SendAttachToAgent(RenderViewHost* inspected_rvh) { | 225 void DevToolsManager::SendAttachToAgent(DevToolsAgentHost* agent_host) { |
| 213 if (inspected_rvh) { | 226 DevToolsRuntimeProperties properties; |
| 214 ChildProcessSecurityPolicy::GetInstance()->GrantReadRawCookies( | 227 RuntimePropertiesMap::iterator it = |
| 215 inspected_rvh->process()->id()); | 228 runtime_properties_map_.find(agent_host); |
| 216 | 229 if (it != runtime_properties_map_.end()) { |
| 217 DevToolsRuntimeProperties properties; | 230 properties = DevToolsRuntimeProperties(it->second.begin(), |
| 218 RuntimePropertiesMap::iterator it = | 231 it->second.end()); |
| 219 runtime_properties_map_.find(inspected_rvh); | |
| 220 if (it != runtime_properties_map_.end()) { | |
| 221 properties = DevToolsRuntimeProperties(it->second.begin(), | |
| 222 it->second.end()); | |
| 223 } | |
| 224 inspected_rvh->Send(new DevToolsAgentMsg_Attach( | |
| 225 inspected_rvh->routing_id(), | |
| 226 properties)); | |
| 227 } | 232 } |
| 233 agent_host->SendMessageToAgent(new DevToolsAgentMsg_Attach( |
| 234 MSG_ROUTING_NONE, |
| 235 properties)); |
| 228 } | 236 } |
| 229 | 237 |
| 230 void DevToolsManager::SendDetachToAgent(RenderViewHost* inspected_rvh) { | 238 void DevToolsManager::SendDetachToAgent(DevToolsAgentHost* agent_host) { |
| 231 if (inspected_rvh) { | 239 if (agent_host) { |
| 232 inspected_rvh->Send(new DevToolsAgentMsg_Detach( | 240 agent_host->SendMessageToAgent(new DevToolsAgentMsg_Detach( |
| 233 inspected_rvh->routing_id())); | 241 MSG_ROUTING_NONE)); |
| 234 } | 242 } |
| 235 } | 243 } |
| 236 | 244 |
| 237 void DevToolsManager::BindClientHost( | 245 void DevToolsManager::BindClientHost( |
| 238 RenderViewHost* inspected_rvh, | 246 DevToolsAgentHost* agent_host, |
| 239 DevToolsClientHost* client_host, | 247 DevToolsClientHost* client_host, |
| 240 const DevToolsRuntimeProperties& runtime_properties) { | 248 const DevToolsRuntimeProperties& runtime_properties) { |
| 241 DCHECK(inspected_rvh_to_client_host_.find(inspected_rvh) == | 249 DCHECK(agent_to_client_host_.find(agent_host) == |
| 242 inspected_rvh_to_client_host_.end()); | 250 agent_to_client_host_.end()); |
| 243 DCHECK(client_host_to_inspected_rvh_.find(client_host) == | 251 DCHECK(client_to_agent_host_.find(client_host) == |
| 244 client_host_to_inspected_rvh_.end()); | 252 client_to_agent_host_.end()); |
| 245 | 253 |
| 246 if (client_host_to_inspected_rvh_.empty()) { | 254 if (client_to_agent_host_.empty()) { |
| 247 BrowserThread::PostTask( | 255 BrowserThread::PostTask( |
| 248 BrowserThread::IO, | 256 BrowserThread::IO, |
| 249 FROM_HERE, | 257 FROM_HERE, |
| 250 NewRunnableFunction(&DevToolsNetLogObserver::Attach)); | 258 NewRunnableFunction(&DevToolsNetLogObserver::Attach)); |
| 251 } | 259 } |
| 252 inspected_rvh_to_client_host_[inspected_rvh] = client_host; | 260 agent_to_client_host_[agent_host] = client_host; |
| 253 client_host_to_inspected_rvh_[client_host] = inspected_rvh; | 261 client_to_agent_host_[client_host] = agent_host; |
| 254 runtime_properties_map_[inspected_rvh] = runtime_properties; | 262 runtime_properties_map_[agent_host] = runtime_properties; |
| 263 agent_host->set_close_listener(this); |
| 255 } | 264 } |
| 256 | 265 |
| 257 void DevToolsManager::UnbindClientHost(RenderViewHost* inspected_rvh, | 266 void DevToolsManager::UnbindClientHost(DevToolsAgentHost* agent_host, |
| 258 DevToolsClientHost* client_host) { | 267 DevToolsClientHost* client_host) { |
| 259 DCHECK(inspected_rvh_to_client_host_.find(inspected_rvh)->second == | 268 DCHECK(agent_host); |
| 269 DCHECK(agent_to_client_host_.find(agent_host)->second == |
| 260 client_host); | 270 client_host); |
| 261 DCHECK(client_host_to_inspected_rvh_.find(client_host)->second == | 271 DCHECK(client_to_agent_host_.find(client_host)->second == |
| 262 inspected_rvh); | 272 agent_host); |
| 263 | 273 |
| 264 inspected_rvh_to_client_host_.erase(inspected_rvh); | 274 agent_to_client_host_.erase(agent_host); |
| 265 client_host_to_inspected_rvh_.erase(client_host); | 275 client_to_agent_host_.erase(client_host); |
| 266 runtime_properties_map_.erase(inspected_rvh); | 276 runtime_properties_map_.erase(agent_host); |
| 267 | 277 |
| 268 if (client_host_to_inspected_rvh_.empty()) { | 278 if (client_to_agent_host_.empty()) { |
| 269 BrowserThread::PostTask( | 279 BrowserThread::PostTask( |
| 270 BrowserThread::IO, | 280 BrowserThread::IO, |
| 271 FROM_HERE, | 281 FROM_HERE, |
| 272 NewRunnableFunction(&DevToolsNetLogObserver::Detach)); | 282 NewRunnableFunction(&DevToolsNetLogObserver::Detach)); |
| 273 } | 283 } |
| 274 SendDetachToAgent(inspected_rvh); | 284 SendDetachToAgent(agent_host); |
| 275 | 285 agent_host->ClientDetached(); |
| 276 int process_id = inspected_rvh->process()->id(); | |
| 277 for (InspectedRvhToClientHostMap::iterator it = | |
| 278 inspected_rvh_to_client_host_.begin(); | |
| 279 it != inspected_rvh_to_client_host_.end(); | |
| 280 ++it) { | |
| 281 if (it->first->process()->id() == process_id) | |
| 282 return; | |
| 283 } | |
| 284 // We've disconnected from the last renderer -> revoke cookie permissions. | |
| 285 ChildProcessSecurityPolicy::GetInstance()->RevokeReadRawCookies(process_id); | |
| 286 } | 286 } |
| 287 | 287 |
| 288 void DevToolsManager::CloseAllClientHosts() { | 288 void DevToolsManager::CloseAllClientHosts() { |
| 289 std::vector<RenderViewHost*> rhvs; | 289 std::vector<DevToolsAgentHost*> agents; |
| 290 for (InspectedRvhToClientHostMap::iterator it = | 290 for (AgentToClientHostMap::iterator it = |
| 291 inspected_rvh_to_client_host_.begin(); | 291 agent_to_client_host_.begin(); |
| 292 it != inspected_rvh_to_client_host_.end(); ++it) { | 292 it != agent_to_client_host_.end(); ++it) { |
| 293 rhvs.push_back(it->first); | 293 agents.push_back(it->first); |
| 294 } | 294 } |
| 295 for (std::vector<RenderViewHost*>::iterator it = rhvs.begin(); | 295 for (std::vector<DevToolsAgentHost*>::iterator it = agents.begin(); |
| 296 it != rhvs.end(); ++it) { | 296 it != agents.end(); ++it) { |
| 297 UnregisterDevToolsClientHostFor(*it); | 297 UnregisterDevToolsClientHostFor(*it); |
| 298 } | 298 } |
| 299 } | 299 } |
| OLD | NEW |