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 16 matching lines...) Expand all Loading... |
27 | 27 |
28 ExtensionDevToolsBridge::ExtensionDevToolsBridge(int tab_id, | 28 ExtensionDevToolsBridge::ExtensionDevToolsBridge(int tab_id, |
29 Profile* profile) | 29 Profile* profile) |
30 : tab_id_(tab_id), | 30 : tab_id_(tab_id), |
31 profile_(profile), | 31 profile_(profile), |
32 on_page_event_name_( | 32 on_page_event_name_( |
33 ExtensionDevToolsEvents::OnPageEventNameForTab(tab_id)), | 33 ExtensionDevToolsEvents::OnPageEventNameForTab(tab_id)), |
34 on_tab_close_event_name_( | 34 on_tab_close_event_name_( |
35 ExtensionDevToolsEvents::OnTabCloseEventNameForTab(tab_id)) { | 35 ExtensionDevToolsEvents::OnTabCloseEventNameForTab(tab_id)) { |
36 extension_devtools_manager_ = | 36 extension_devtools_manager_ = |
37 ExtensionSystem::Get(profile)->devtools_manager(); | 37 extensions::ExtensionSystem::Get(profile)->devtools_manager(); |
38 DCHECK(extension_devtools_manager_.get()); | 38 DCHECK(extension_devtools_manager_.get()); |
39 } | 39 } |
40 | 40 |
41 ExtensionDevToolsBridge::~ExtensionDevToolsBridge() { | 41 ExtensionDevToolsBridge::~ExtensionDevToolsBridge() { |
42 } | 42 } |
43 | 43 |
44 static std::string FormatDevToolsMessage(int id, const std::string& method) { | 44 static std::string FormatDevToolsMessage(int id, const std::string& method) { |
45 DictionaryValue message; | 45 DictionaryValue message; |
46 message.SetInteger("id", id); | 46 message.SetInteger("id", id); |
47 message.SetString("method", method); | 47 message.SetString("method", method); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 std::string json = base::StringPrintf("[%s]", data.c_str()); | 121 std::string json = base::StringPrintf("[%s]", data.c_str()); |
122 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( | 122 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( |
123 on_page_event_name_, json, profile_, GURL(), | 123 on_page_event_name_, json, profile_, GURL(), |
124 extensions::EventFilteringInfo()); | 124 extensions::EventFilteringInfo()); |
125 } | 125 } |
126 | 126 |
127 void ExtensionDevToolsBridge::ContentsReplaced(WebContents* new_contents) { | 127 void ExtensionDevToolsBridge::ContentsReplaced(WebContents* new_contents) { |
128 // 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 |
129 // properly unregister. | 129 // properly unregister. |
130 } | 130 } |
OLD | NEW |