| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "chrome/browser/debugger/devtools_manager.h" | 9 #include "chrome/browser/debugger/devtools_manager.h" |
| 10 #include "chrome/browser/extensions/extension_devtools_events.h" | 10 #include "chrome/browser/extensions/extension_devtools_events.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 IPC_MESSAGE_UNHANDLED_ERROR() | 78 IPC_MESSAGE_UNHANDLED_ERROR() |
| 79 IPC_END_MESSAGE_MAP() | 79 IPC_END_MESSAGE_MAP() |
| 80 } | 80 } |
| 81 | 81 |
| 82 static const char kTimelineAgentClassName[] = "TimelineAgentClass"; | 82 static const char kTimelineAgentClassName[] = "TimelineAgentClass"; |
| 83 static const char kPageEventMessageName[] = "PageEventMessage"; | 83 static const char kPageEventMessageName[] = "PageEventMessage"; |
| 84 static const char kTabUrlChangeEventMessageName[] = "TabUrlChangeEventMessage"; | 84 static const char kTabUrlChangeEventMessageName[] = "TabUrlChangeEventMessage"; |
| 85 | 85 |
| 86 void ExtensionDevToolsBridge::OnRpcMessage(const std::string& class_name, | 86 void ExtensionDevToolsBridge::OnRpcMessage(const std::string& class_name, |
| 87 const std::string& message_name, | 87 const std::string& message_name, |
| 88 const std::string& msg) { | 88 const std::string& param1, |
| 89 const std::string& param2, |
| 90 const std::string& param3) { |
| 89 DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI); | 91 DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI); |
| 90 // TODO(jamesr): Update the filtering and message creation logic once | 92 // TODO(jamesr): Update the filtering and message creation logic once |
| 91 // the TimelineAgent lands in WebKit. | 93 // the TimelineAgent lands in WebKit. |
| 92 if (class_name == kTimelineAgentClassName) { | 94 if (class_name == kTimelineAgentClassName) { |
| 93 if (message_name == kPageEventMessageName) { | 95 if (message_name == kPageEventMessageName) { |
| 94 std::string json = StringPrintf("[{\"record\": \"%s\"}]", msg.c_str()); | 96 std::string json = StringPrintf("[{\"record\": \"%s\"}]", param1.c_str()); |
| 95 profile_->GetExtensionMessageService()-> | 97 profile_->GetExtensionMessageService()-> |
| 96 DispatchEventToRenderers(on_page_event_name_, json); | 98 DispatchEventToRenderers(on_page_event_name_, json); |
| 97 } else if (message_name == kTabUrlChangeEventMessageName) { | 99 } else if (message_name == kTabUrlChangeEventMessageName) { |
| 98 std::string json = StringPrintf("[{\"record\": \"%s\"}]", msg.c_str()); | 100 std::string json = StringPrintf("[{\"record\": \"%s\"}]", param1.c_str()); |
| 99 profile_->GetExtensionMessageService()-> | 101 profile_->GetExtensionMessageService()-> |
| 100 DispatchEventToRenderers(on_tab_url_change_event_name_, json); | 102 DispatchEventToRenderers(on_tab_url_change_event_name_, json); |
| 101 } | 103 } |
| 102 } | 104 } |
| 103 } | 105 } |
| 104 | 106 |
| OLD | NEW |