Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(782)

Side by Side Diff: chrome/browser/debugger/extension_ports_remote_service.cc

Issue 3117024: Clean up ExtensionMessageService. (Closed)
Patch Set: comments fixed Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/extension_port_container.cc ('k') | chrome/browser/extensions/extension_message_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698