| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/process_proxy/process_proxy_registry.h" | 5 #include "chrome/browser/chromeos/process_proxy/process_proxy_registry.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 std::map<pid_t, ProcessProxyInfo>::iterator it = proxy_map_.find(pid); | 108 std::map<pid_t, ProcessProxyInfo>::iterator it = proxy_map_.find(pid); |
| 109 if (it == proxy_map_.end()) | 109 if (it == proxy_map_.end()) |
| 110 return false; | 110 return false; |
| 111 | 111 |
| 112 it->second.proxy->Close(); | 112 it->second.proxy->Close(); |
| 113 it->second.watcher_thread->Stop(); | 113 it->second.watcher_thread->Stop(); |
| 114 proxy_map_.erase(it); | 114 proxy_map_.erase(it); |
| 115 return true; | 115 return true; |
| 116 } | 116 } |
| 117 | 117 |
| 118 bool ProcessProxyRegistry::OnTerminalResize(pid_t pid, int width, int height) { |
| 119 std::map<pid_t, ProcessProxyInfo>::iterator it = proxy_map_.find(pid); |
| 120 if (it == proxy_map_.end()) |
| 121 return false; |
| 122 |
| 123 return it->second.proxy->OnTerminalResize(width, height); |
| 124 } |
| 125 |
| 118 void ProcessProxyRegistry::OnProcessOutput(pid_t pid, | 126 void ProcessProxyRegistry::OnProcessOutput(pid_t pid, |
| 119 ProcessOutputType type, const std::string& data) { | 127 ProcessOutputType type, const std::string& data) { |
| 120 const char* type_str = ProcessOutputTypeToString(type); | 128 const char* type_str = ProcessOutputTypeToString(type); |
| 121 DCHECK(type_str); | 129 DCHECK(type_str); |
| 122 | 130 |
| 123 std::map<pid_t, ProcessProxyInfo>::iterator it = proxy_map_.find(pid); | 131 std::map<pid_t, ProcessProxyInfo>::iterator it = proxy_map_.find(pid); |
| 124 if (it == proxy_map_.end()) | 132 if (it == proxy_map_.end()) |
| 125 return; | 133 return; |
| 126 it->second.callback.Run(pid, std::string(type_str), data); | 134 it->second.callback.Run(pid, std::string(type_str), data); |
| 127 | 135 |
| 128 // Contact with the slave end of the terminal has been lost. We have to close | 136 // Contact with the slave end of the terminal has been lost. We have to close |
| 129 // the process. | 137 // the process. |
| 130 if (type == PROCESS_OUTPUT_TYPE_EXIT) | 138 if (type == PROCESS_OUTPUT_TYPE_EXIT) |
| 131 CloseProcess(pid); | 139 CloseProcess(pid); |
| 132 } | 140 } |
| 133 | 141 |
| OLD | NEW |