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/automation/extension_port_container.h" | 5 #include "chrome/browser/automation/extension_port_container.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/json_reader.h" | 8 #include "base/json_reader.h" |
9 #include "base/json_writer.h" | 9 #include "base/json_writer.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 service_->PostMessageFromRenderer(port_id_, message); | 58 service_->PostMessageFromRenderer(port_id_, message); |
59 } | 59 } |
60 | 60 |
61 bool ExtensionPortContainer::Connect(const std::string &extension_id, | 61 bool ExtensionPortContainer::Connect(const std::string &extension_id, |
62 int process_id, | 62 int process_id, |
63 int routing_id, | 63 int routing_id, |
64 int connection_id, | 64 int connection_id, |
65 const std::string& channel_name) { | 65 const std::string& channel_name) { |
66 DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI); | 66 DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI); |
67 | 67 |
68 port_id_ = service_->OpenAutomationChannelToExtension(process_id, | 68 port_id_ = service_->OpenSpecialChannelToExtension( |
69 routing_id, | 69 extension_id, channel_name, this); |
70 extension_id, | |
71 channel_name, | |
72 this); | |
73 if (port_id_ == -1) { | 70 if (port_id_ == -1) { |
74 // In this case a disconnect message has been dispatched. | 71 // In this case a disconnect message has been dispatched. |
75 return false; | 72 return false; |
76 } | 73 } |
77 | 74 |
78 SendConnectionResponse(connection_id, port_id_); | 75 SendConnectionResponse(connection_id, port_id_); |
79 return true; | 76 return true; |
80 } | 77 } |
81 | 78 |
82 void ExtensionPortContainer::SendConnectionResponse(int connection_id, | 79 void ExtensionPortContainer::SendConnectionResponse(int connection_id, |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 // This will delete the port and notify the other end of the disconnect. | 239 // This will delete the port and notify the other end of the disconnect. |
243 automation->RemovePortContainer(port); | 240 automation->RemovePortContainer(port); |
244 } | 241 } |
245 } else { | 242 } else { |
246 // We don't expect other messages here. | 243 // We don't expect other messages here. |
247 NOTREACHED(); | 244 NOTREACHED(); |
248 } | 245 } |
249 | 246 |
250 return true; | 247 return true; |
251 } | 248 } |
OLD | NEW |