| 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 16 matching lines...) Expand all Loading... |
| 27 tab_handle_(tab_handle) { | 27 tab_handle_(tab_handle) { |
| 28 URLRequestContext* context = automation_->profile()->GetRequestContext(); | 28 URLRequestContext* context = automation_->profile()->GetRequestContext(); |
| 29 service_ = ExtensionMessageService::GetInstance(context); | 29 service_ = ExtensionMessageService::GetInstance(context); |
| 30 DCHECK(service_); | 30 DCHECK(service_); |
| 31 } | 31 } |
| 32 | 32 |
| 33 ExtensionPortContainer::~ExtensionPortContainer() { | 33 ExtensionPortContainer::~ExtensionPortContainer() { |
| 34 DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI); | 34 DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI); |
| 35 | 35 |
| 36 if (port_id_ != -1) | 36 if (port_id_ != -1) |
| 37 service_->CloseAutomationChannel(port_id_); | 37 service_->CloseChannel(port_id_); |
| 38 } | 38 } |
| 39 | 39 |
| 40 bool ExtensionPortContainer::PostResponseToExternalPort( | 40 bool ExtensionPortContainer::PostResponseToExternalPort( |
| 41 const std::string& message) { | 41 const std::string& message) { |
| 42 return automation_->Send( | 42 return automation_->Send( |
| 43 new AutomationMsg_ForwardMessageToExternalHost( | 43 new AutomationMsg_ForwardMessageToExternalHost( |
| 44 0, tab_handle_, message, ext::kAutomationOrigin, | 44 0, tab_handle_, message, ext::kAutomationOrigin, |
| 45 ext::kAutomationPortResponseTarget)); | 45 ext::kAutomationPortResponseTarget)); |
| 46 } | 46 } |
| 47 | 47 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 DCHECK(port); | 201 DCHECK(port); |
| 202 if (port) | 202 if (port) |
| 203 port->PostMessageFromExternalPort(data); | 203 port->PostMessageFromExternalPort(data); |
| 204 } else { | 204 } else { |
| 205 // We don't expect other messages here. | 205 // We don't expect other messages here. |
| 206 NOTREACHED(); | 206 NOTREACHED(); |
| 207 } | 207 } |
| 208 | 208 |
| 209 return true; | 209 return true; |
| 210 } | 210 } |
| OLD | NEW |