Chromium Code Reviews| 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/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| 11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/io_thread.h" | 12 #include "chrome/browser/io_thread.h" |
| 13 #include "chrome/browser/prefs/pref_service.h" | 13 #include "chrome/browser/prefs/pref_service.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 15 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 16 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
| 17 #include "content/browser/browsing_instance.h" | 17 #include "content/browser/browsing_instance.h" |
| 18 #include "content/browser/child_process_security_policy.h" | 18 #include "content/browser/child_process_security_policy.h" |
| 19 #include "content/browser/content_browser_client.h" | |
| 19 #include "content/browser/debugger/devtools_client_host.h" | 20 #include "content/browser/debugger/devtools_client_host.h" |
| 20 #include "content/browser/debugger/devtools_netlog_observer.h" | 21 #include "content/browser/debugger/devtools_netlog_observer.h" |
| 21 #include "content/browser/debugger/devtools_window.h" | 22 #include "content/browser/debugger/devtools_window.h" |
| 22 #include "content/browser/renderer_host/render_view_host.h" | 23 #include "content/browser/renderer_host/render_view_host.h" |
| 23 #include "content/browser/site_instance.h" | 24 #include "content/browser/site_instance.h" |
| 25 #include "content/common/content_client.h" | |
| 24 #include "content/common/devtools_messages.h" | 26 #include "content/common/devtools_messages.h" |
| 25 #include "content/common/notification_service.h" | 27 #include "content/common/notification_service.h" |
| 26 #include "googleurl/src/gurl.h" | 28 #include "googleurl/src/gurl.h" |
| 27 | 29 |
| 28 // static | 30 // static |
| 29 DevToolsManager* DevToolsManager::GetInstance() { | 31 DevToolsManager* DevToolsManager::GetInstance() { |
| 30 // http://crbug.com/47806 this method may be called when BrowserProcess | 32 // http://crbug.com/47806 this method may be called when BrowserProcess |
| 31 // has already been destroyed. | 33 // has already been destroyed. |
| 32 if (!g_browser_process) | 34 if (!g_browser_process) |
| 33 return NULL; | 35 return NULL; |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 runtime_properties_map_.find(inspected_rvh); | 159 runtime_properties_map_.find(inspected_rvh); |
| 158 if (it == runtime_properties_map_.end()) { | 160 if (it == runtime_properties_map_.end()) { |
| 159 std::pair<RenderViewHost*, DevToolsRuntimeProperties> value( | 161 std::pair<RenderViewHost*, DevToolsRuntimeProperties> value( |
| 160 inspected_rvh, | 162 inspected_rvh, |
| 161 DevToolsRuntimeProperties()); | 163 DevToolsRuntimeProperties()); |
| 162 it = runtime_properties_map_.insert(value).first; | 164 it = runtime_properties_map_.insert(value).first; |
| 163 } | 165 } |
| 164 it->second[name] = value; | 166 it->second[name] = value; |
| 165 } | 167 } |
| 166 | 168 |
| 169 void DevToolsManager::ClearBrowserCache(RenderViewHost* inspected_rvh) { | |
|
pfeldman
2011/07/07 14:06:16
no need to change this.
| |
| 170 content::GetContentClient()->browser()->ClearBrowserCache(inspected_rvh); | |
| 171 } | |
| 172 | |
| 173 void DevToolsManager::ClearBrowserCookies(RenderViewHost* inspected_rvh) { | |
|
pfeldman
2011/07/07 14:06:16
ditto
| |
| 174 content::GetContentClient()->browser()->ClearBrowserCookies(inspected_rvh); | |
| 175 } | |
| 176 | |
| 167 void DevToolsManager::InspectElement(RenderViewHost* inspected_rvh, | 177 void DevToolsManager::InspectElement(RenderViewHost* inspected_rvh, |
| 168 int x, | 178 int x, |
| 169 int y) { | 179 int y) { |
| 170 IPC::Message* m = new DevToolsAgentMsg_InspectElement(x, y); | 180 IPC::Message* m = new DevToolsAgentMsg_InspectElement(x, y); |
| 171 m->set_routing_id(inspected_rvh->routing_id()); | 181 m->set_routing_id(inspected_rvh->routing_id()); |
| 172 inspected_rvh->Send(m); | 182 inspected_rvh->Send(m); |
| 173 // TODO(loislo): we should initiate DevTools window opening from within | 183 // TODO(loislo): we should initiate DevTools window opening from within |
| 174 // renderer. Otherwise, we still can hit a race condition here. | 184 // renderer. Otherwise, we still can hit a race condition here. |
| 175 OpenDevToolsWindow(inspected_rvh); | 185 OpenDevToolsWindow(inspected_rvh); |
| 176 } | 186 } |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 457 for (InspectedRvhToClientHostMap::iterator it = | 467 for (InspectedRvhToClientHostMap::iterator it = |
| 458 inspected_rvh_to_client_host_.begin(); | 468 inspected_rvh_to_client_host_.begin(); |
| 459 it != inspected_rvh_to_client_host_.end(); ++it) { | 469 it != inspected_rvh_to_client_host_.end(); ++it) { |
| 460 rhvs.push_back(it->first); | 470 rhvs.push_back(it->first); |
| 461 } | 471 } |
| 462 for (std::vector<RenderViewHost*>::iterator it = rhvs.begin(); | 472 for (std::vector<RenderViewHost*>::iterator it = rhvs.begin(); |
| 463 it != rhvs.end(); ++it) { | 473 it != rhvs.end(); ++it) { |
| 464 UnregisterDevToolsClientHostFor(*it); | 474 UnregisterDevToolsClientHostFor(*it); |
| 465 } | 475 } |
| 466 } | 476 } |
| OLD | NEW |