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 // Implementation of the ExtensionPortsRemoteService. | 5 // Implementation of the ExtensionPortsRemoteService. |
6 | 6 |
7 // Inspired significantly from debugger_remote_service | 7 // Inspired significantly from debugger_remote_service |
8 // and ../automation/extension_port_container. | 8 // and ../automation/extension_port_container. |
9 | 9 |
10 #include "chrome/browser/debugger/extension_ports_remote_service.h" | 10 #include "chrome/browser/debugger/extension_ports_remote_service.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 if (!(*it)->IsOffTheRecord()) { | 130 if (!(*it)->IsOffTheRecord()) { |
131 service_ = (*it)->GetExtensionMessageService(); | 131 service_ = (*it)->GetExtensionMessageService(); |
132 break; | 132 break; |
133 } | 133 } |
134 } | 134 } |
135 if (!service_) | 135 if (!service_) |
136 LOG(WARNING) << "No usable profile for ExtensionPortsRemoteService"; | 136 LOG(WARNING) << "No usable profile for ExtensionPortsRemoteService"; |
137 } | 137 } |
138 | 138 |
139 ExtensionPortsRemoteService::~ExtensionPortsRemoteService() { | 139 ExtensionPortsRemoteService::~ExtensionPortsRemoteService() { |
140 NotificationService::current()->Notify( | |
141 NotificationType::EXTENSION_PORT_DELETED_DEBUG, | |
142 Source<IPC::Message::Sender>(this), | |
143 NotificationService::NoDetails()); | |
144 } | 140 } |
145 | 141 |
146 void ExtensionPortsRemoteService::HandleMessage( | 142 void ExtensionPortsRemoteService::HandleMessage( |
147 const DevToolsRemoteMessage& message) { | 143 const DevToolsRemoteMessage& message) { |
148 DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI); | 144 DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI); |
149 const std::string destinationString = message.destination(); | 145 const std::string destinationString = message.destination(); |
150 scoped_ptr<Value> request(base::JSONReader::Read(message.content(), true)); | 146 scoped_ptr<Value> request(base::JSONReader::Read(message.content(), true)); |
151 if (request.get() == NULL) { | 147 if (request.get() == NULL) { |
152 // Bad JSON | 148 // Bad JSON |
153 NOTREACHED(); | 149 NOTREACHED(); |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 LOG(INFO) << "unknown port: " << port_id; | 381 LOG(INFO) << "unknown port: " << port_id; |
386 response->SetInteger(kResultKey, RESULT_UNKNOWN_PORT); | 382 response->SetInteger(kResultKey, RESULT_UNKNOWN_PORT); |
387 return; | 383 return; |
388 } | 384 } |
389 // Post the message through the ExtensionMessageService. | 385 // Post the message through the ExtensionMessageService. |
390 DCHECK(service_); | 386 DCHECK(service_); |
391 service_->PostMessageFromRenderer(port_id, message); | 387 service_->PostMessageFromRenderer(port_id, message); |
392 // Confirm to the external client that we sent its message. | 388 // Confirm to the external client that we sent its message. |
393 response->SetInteger(kResultKey, RESULT_OK); | 389 response->SetInteger(kResultKey, RESULT_OK); |
394 } | 390 } |
OLD | NEW |