| 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 "chrome/browser/extensions/extension_devtools_bridge.h" | 5 #include "chrome/browser/extensions/extension_devtools_bridge.h" |
| 6 | 6 |
| 7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 Browser* browser; | 55 Browser* browser; |
| 56 TabStripModel* tab_strip; | 56 TabStripModel* tab_strip; |
| 57 TabContentsWrapper* contents; | 57 TabContentsWrapper* contents; |
| 58 int tab_index; | 58 int tab_index; |
| 59 if (ExtensionTabUtil::GetTabById(tab_id_, profile_, true, | 59 if (ExtensionTabUtil::GetTabById(tab_id_, profile_, true, |
| 60 &browser, &tab_strip, | 60 &browser, &tab_strip, |
| 61 &contents, &tab_index)) { | 61 &contents, &tab_index)) { |
| 62 DevToolsManager* devtools_manager = DevToolsManager::GetInstance(); | 62 DevToolsManager* devtools_manager = DevToolsManager::GetInstance(); |
| 63 DevToolsAgentHost* agent = DevToolsAgentHostRegistry::GetDevToolsAgentHost( | 63 DevToolsAgentHost* agent = DevToolsAgentHostRegistry::GetDevToolsAgentHost( |
| 64 contents->render_view_host()); | 64 contents->tab_contents()->render_view_host()); |
| 65 if (devtools_manager->GetDevToolsClientHostFor(agent)) | 65 if (devtools_manager->GetDevToolsClientHostFor(agent)) |
| 66 return false; | 66 return false; |
| 67 | 67 |
| 68 devtools_manager->RegisterDevToolsClientHostFor(agent, this); | 68 devtools_manager->RegisterDevToolsClientHostFor(agent, this); |
| 69 | 69 |
| 70 // Following messages depend on inspector protocol that is not yet | 70 // Following messages depend on inspector protocol that is not yet |
| 71 // finalized. | 71 // finalized. |
| 72 | 72 |
| 73 // 1. Start timeline profiler. | 73 // 1. Start timeline profiler. |
| 74 devtools_manager->DispatchOnInspectorBackend( | 74 devtools_manager->DispatchOnInspectorBackend( |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 111 |
| 112 std::string json = base::StringPrintf("[%s]", data.c_str()); | 112 std::string json = base::StringPrintf("[%s]", data.c_str()); |
| 113 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( | 113 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( |
| 114 on_page_event_name_, json, profile_, GURL()); | 114 on_page_event_name_, json, profile_, GURL()); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void ExtensionDevToolsBridge::TabReplaced(TabContents* new_tab) { | 117 void ExtensionDevToolsBridge::TabReplaced(TabContents* new_tab) { |
| 118 // We don't update the tab id as it needs to remain the same so that we can | 118 // We don't update the tab id as it needs to remain the same so that we can |
| 119 // properly unregister. | 119 // properly unregister. |
| 120 } | 120 } |
| OLD | NEW |