OLD | NEW |
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 "chrome/browser/extensions/extension_devtools_bridge.h" | 5 #include "chrome/browser/extensions/extension_devtools_bridge.h" |
6 | 6 |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 std::string json; | 51 std::string json; |
52 base::JSONWriter::Write(&message, &json); | 52 base::JSONWriter::Write(&message, &json); |
53 return json; | 53 return json; |
54 } | 54 } |
55 | 55 |
56 bool ExtensionDevToolsBridge::RegisterAsDevToolsClientHost() { | 56 bool ExtensionDevToolsBridge::RegisterAsDevToolsClientHost() { |
57 DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI); | 57 DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI); |
58 | 58 |
59 Browser* browser; | 59 Browser* browser; |
60 TabStripModel* tab_strip; | 60 TabStripModel* tab_strip; |
61 TabContents* contents; | 61 WebContents* contents; |
62 int tab_index; | 62 int tab_index; |
63 if (ExtensionTabUtil::GetTabById(tab_id_, profile_, true, | 63 if (ExtensionTabUtil::GetTabById(tab_id_, profile_, true, |
64 &browser, &tab_strip, | 64 &browser, &tab_strip, |
65 &contents, &tab_index)) { | 65 &contents, &tab_index)) { |
66 DevToolsManager* devtools_manager = DevToolsManager::GetInstance(); | 66 DevToolsManager* devtools_manager = DevToolsManager::GetInstance(); |
67 DevToolsAgentHost* agent = DevToolsAgentHostRegistry::GetDevToolsAgentHost( | 67 DevToolsAgentHost* agent = DevToolsAgentHostRegistry::GetDevToolsAgentHost( |
68 contents->web_contents()->GetRenderViewHost()); | 68 contents->GetRenderViewHost()); |
69 if (devtools_manager->GetDevToolsClientHostFor(agent)) | 69 if (devtools_manager->GetDevToolsClientHostFor(agent)) |
70 return false; | 70 return false; |
71 | 71 |
72 devtools_manager->RegisterDevToolsClientHostFor(agent, this); | 72 devtools_manager->RegisterDevToolsClientHostFor(agent, this); |
73 | 73 |
74 // Following messages depend on inspector protocol that is not yet | 74 // Following messages depend on inspector protocol that is not yet |
75 // finalized. | 75 // finalized. |
76 | 76 |
77 // 1. Start timeline profiler. | 77 // 1. Start timeline profiler. |
78 devtools_manager->DispatchOnInspectorBackend( | 78 devtools_manager->DispatchOnInspectorBackend( |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 127 |
128 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( | 128 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( |
129 on_page_event_name_, arguments.Pass(), profile_, GURL(), | 129 on_page_event_name_, arguments.Pass(), profile_, GURL(), |
130 extensions::EventFilteringInfo()); | 130 extensions::EventFilteringInfo()); |
131 } | 131 } |
132 | 132 |
133 void ExtensionDevToolsBridge::ContentsReplaced(WebContents* new_contents) { | 133 void ExtensionDevToolsBridge::ContentsReplaced(WebContents* new_contents) { |
134 // We don't update the tab id as it needs to remain the same so that we can | 134 // We don't update the tab id as it needs to remain the same so that we can |
135 // properly unregister. | 135 // properly unregister. |
136 } | 136 } |
OLD | NEW |