| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/debugger/devtools_manager.h" | 5 #include "chrome/browser/debugger/devtools_manager.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 } | 155 } |
| 156 if (enabled) | 156 if (enabled) |
| 157 it->second.insert(feature); | 157 it->second.insert(feature); |
| 158 else | 158 else |
| 159 it->second.erase(feature); | 159 it->second.erase(feature); |
| 160 } | 160 } |
| 161 | 161 |
| 162 void DevToolsManager::InspectElement(RenderViewHost* inspected_rvh, | 162 void DevToolsManager::InspectElement(RenderViewHost* inspected_rvh, |
| 163 int x, | 163 int x, |
| 164 int y) { | 164 int y) { |
| 165 OpenDevToolsWindow(inspected_rvh); | |
| 166 IPC::Message* m = new DevToolsAgentMsg_InspectElement(x, y); | 165 IPC::Message* m = new DevToolsAgentMsg_InspectElement(x, y); |
| 167 m->set_routing_id(inspected_rvh->routing_id()); | 166 m->set_routing_id(inspected_rvh->routing_id()); |
| 168 inspected_rvh->Send(m); | 167 inspected_rvh->Send(m); |
| 168 // TODO(loislo): we should initiate DevTools window opening from within |
| 169 // renderer. Otherwise, we still can hit a race condition here. |
| 170 OpenDevToolsWindow(inspected_rvh); |
| 169 } | 171 } |
| 170 | 172 |
| 171 void DevToolsManager::ClientHostClosing(DevToolsClientHost* host) { | 173 void DevToolsManager::ClientHostClosing(DevToolsClientHost* host) { |
| 172 RenderViewHost* inspected_rvh = GetInspectedRenderViewHost(host); | 174 RenderViewHost* inspected_rvh = GetInspectedRenderViewHost(host); |
| 173 if (!inspected_rvh) { | 175 if (!inspected_rvh) { |
| 174 // It might be in the list of orphan client hosts, remove it from there. | 176 // It might be in the list of orphan client hosts, remove it from there. |
| 175 for (OrphanClientHosts::iterator it = orphan_client_hosts_.begin(); | 177 for (OrphanClientHosts::iterator it = orphan_client_hosts_.begin(); |
| 176 it != orphan_client_hosts_.end(); ++it) { | 178 it != orphan_client_hosts_.end(); ++it) { |
| 177 if (it->second.first == host) { | 179 if (it->second.first == host) { |
| 178 orphan_client_hosts_.erase(it->first); | 180 orphan_client_hosts_.erase(it->first); |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 DevToolsClientHost* client_host) { | 398 DevToolsClientHost* client_host) { |
| 397 DCHECK(inspected_rvh_to_client_host_.find(inspected_rvh)->second == | 399 DCHECK(inspected_rvh_to_client_host_.find(inspected_rvh)->second == |
| 398 client_host); | 400 client_host); |
| 399 DCHECK(client_host_to_inspected_rvh_.find(client_host)->second == | 401 DCHECK(client_host_to_inspected_rvh_.find(client_host)->second == |
| 400 inspected_rvh); | 402 inspected_rvh); |
| 401 | 403 |
| 402 inspected_rvh_to_client_host_.erase(inspected_rvh); | 404 inspected_rvh_to_client_host_.erase(inspected_rvh); |
| 403 client_host_to_inspected_rvh_.erase(client_host); | 405 client_host_to_inspected_rvh_.erase(client_host); |
| 404 runtime_features_map_.erase(inspected_rvh); | 406 runtime_features_map_.erase(inspected_rvh); |
| 405 } | 407 } |
| OLD | NEW |