| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 // If the tab we are looking at is going away then we fire a closing event at | 59 // If the tab we are looking at is going away then we fire a closing event at |
| 60 // the extension. | 60 // the extension. |
| 61 void ExtensionDevToolsBridge::InspectedTabClosing() { | 61 void ExtensionDevToolsBridge::InspectedTabClosing() { |
| 62 DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI); | 62 DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI); |
| 63 | 63 |
| 64 // TODO(knorton): Remove this event in favor of the standard tabs.onRemoved | 64 // TODO(knorton): Remove this event in favor of the standard tabs.onRemoved |
| 65 // event in extensions. | 65 // event in extensions. |
| 66 std::string json("[{}]"); | 66 std::string json("[{}]"); |
| 67 profile_->GetExtensionMessageService()->DispatchEventToRenderers( | 67 profile_->GetExtensionMessageService()->DispatchEventToRenderers( |
| 68 on_tab_close_event_name_, json, profile_->IsOffTheRecord(), GURL()); | 68 on_tab_close_event_name_, json, profile_, GURL()); |
| 69 | 69 |
| 70 // This may result in this object being destroyed. | 70 // This may result in this object being destroyed. |
| 71 extension_devtools_manager_->BridgeClosingForTab(tab_id_); | 71 extension_devtools_manager_->BridgeClosingForTab(tab_id_); |
| 72 } | 72 } |
| 73 | 73 |
| 74 void ExtensionDevToolsBridge::SendMessageToClient(const IPC::Message& msg) { | 74 void ExtensionDevToolsBridge::SendMessageToClient(const IPC::Message& msg) { |
| 75 IPC_BEGIN_MESSAGE_MAP(ExtensionDevToolsBridge, msg) | 75 IPC_BEGIN_MESSAGE_MAP(ExtensionDevToolsBridge, msg) |
| 76 IPC_MESSAGE_HANDLER(DevToolsClientMsg_DispatchToAPU, OnDispatchToAPU); | 76 IPC_MESSAGE_HANDLER(DevToolsClientMsg_DispatchToAPU, OnDispatchToAPU); |
| 77 IPC_MESSAGE_UNHANDLED_ERROR() | 77 IPC_MESSAGE_UNHANDLED_ERROR() |
| 78 IPC_END_MESSAGE_MAP() | 78 IPC_END_MESSAGE_MAP() |
| 79 } | 79 } |
| 80 | 80 |
| 81 void ExtensionDevToolsBridge::OnDispatchToAPU(const std::string& data) { | 81 void ExtensionDevToolsBridge::OnDispatchToAPU(const std::string& data) { |
| 82 DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI); | 82 DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI); |
| 83 | 83 |
| 84 std::string json = StringPrintf("[%s]", data.c_str()); | 84 std::string json = StringPrintf("[%s]", data.c_str()); |
| 85 profile_->GetExtensionMessageService()->DispatchEventToRenderers( | 85 profile_->GetExtensionMessageService()->DispatchEventToRenderers( |
| 86 on_page_event_name_, json, profile_->IsOffTheRecord(), GURL()); | 86 on_page_event_name_, json, profile_, GURL()); |
| 87 } | 87 } |
| 88 | 88 |
| OLD | NEW |