| 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 28 matching lines...) Expand all Loading... |
| 39 ExtensionDevToolsBridge::~ExtensionDevToolsBridge() { | 39 ExtensionDevToolsBridge::~ExtensionDevToolsBridge() { |
| 40 } | 40 } |
| 41 | 41 |
| 42 static std::string FormatDevToolsMessage(int id, const std::string& method) { | 42 static std::string FormatDevToolsMessage(int id, const std::string& method) { |
| 43 DictionaryValue message; | 43 DictionaryValue message; |
| 44 message.SetInteger("id", id); | 44 message.SetInteger("id", id); |
| 45 message.SetString("method", method); | 45 message.SetString("method", method); |
| 46 message.Set("params", new DictionaryValue); | 46 message.Set("params", new DictionaryValue); |
| 47 | 47 |
| 48 std::string json; | 48 std::string json; |
| 49 base::JSONWriter::Write(&message, false, &json); | 49 base::JSONWriter::Write(&message, &json); |
| 50 return json; | 50 return json; |
| 51 } | 51 } |
| 52 | 52 |
| 53 bool ExtensionDevToolsBridge::RegisterAsDevToolsClientHost() { | 53 bool ExtensionDevToolsBridge::RegisterAsDevToolsClientHost() { |
| 54 DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI); | 54 DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI); |
| 55 | 55 |
| 56 Browser* browser; | 56 Browser* browser; |
| 57 TabStripModel* tab_strip; | 57 TabStripModel* tab_strip; |
| 58 TabContentsWrapper* contents; | 58 TabContentsWrapper* contents; |
| 59 int tab_index; | 59 int tab_index; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 117 |
| 118 std::string json = base::StringPrintf("[%s]", data.c_str()); | 118 std::string json = base::StringPrintf("[%s]", data.c_str()); |
| 119 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( | 119 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( |
| 120 on_page_event_name_, json, profile_, GURL()); | 120 on_page_event_name_, json, profile_, GURL()); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void ExtensionDevToolsBridge::TabReplaced(WebContents* new_tab) { | 123 void ExtensionDevToolsBridge::TabReplaced(WebContents* new_tab) { |
| 124 // We don't update the tab id as it needs to remain the same so that we can | 124 // We don't update the tab id as it needs to remain the same so that we can |
| 125 // properly unregister. | 125 // properly unregister. |
| 126 } | 126 } |
| OLD | NEW |