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_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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 100 |
101 // If the tab we are looking at is going away then we fire a closing event at | 101 // If the tab we are looking at is going away then we fire a closing event at |
102 // the extension. | 102 // the extension. |
103 void ExtensionDevToolsBridge::InspectedContentsClosing() { | 103 void ExtensionDevToolsBridge::InspectedContentsClosing() { |
104 DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI); | 104 DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI); |
105 | 105 |
106 // TODO(knorton): Remove this event in favor of the standard tabs.onRemoved | 106 // TODO(knorton): Remove this event in favor of the standard tabs.onRemoved |
107 // event in extensions. | 107 // event in extensions. |
108 std::string json("[{}]"); | 108 std::string json("[{}]"); |
109 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( | 109 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( |
110 on_tab_close_event_name_, json, profile_, GURL()); | 110 on_tab_close_event_name_, json, profile_, GURL(), |
| 111 extensions::EventFilteringInfo()); |
111 | 112 |
112 // This may result in this object being destroyed. | 113 // This may result in this object being destroyed. |
113 extension_devtools_manager_->BridgeClosingForTab(tab_id_); | 114 extension_devtools_manager_->BridgeClosingForTab(tab_id_); |
114 } | 115 } |
115 | 116 |
116 void ExtensionDevToolsBridge::DispatchOnInspectorFrontend( | 117 void ExtensionDevToolsBridge::DispatchOnInspectorFrontend( |
117 const std::string& data) { | 118 const std::string& data) { |
118 DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI); | 119 DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI); |
119 | 120 |
120 std::string json = base::StringPrintf("[%s]", data.c_str()); | 121 std::string json = base::StringPrintf("[%s]", data.c_str()); |
121 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( | 122 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( |
122 on_page_event_name_, json, profile_, GURL()); | 123 on_page_event_name_, json, profile_, GURL(), |
| 124 extensions::EventFilteringInfo()); |
123 } | 125 } |
124 | 126 |
125 void ExtensionDevToolsBridge::ContentsReplaced(WebContents* new_contents) { | 127 void ExtensionDevToolsBridge::ContentsReplaced(WebContents* new_contents) { |
126 // We don't update the tab id as it needs to remain the same so that we can | 128 // We don't update the tab id as it needs to remain the same so that we can |
127 // properly unregister. | 129 // properly unregister. |
128 } | 130 } |
OLD | NEW |