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

Side by Side Diff: chrome/browser/chromeos/process_proxy/process_proxy_registry.cc

Issue 9121035: [hterm:crosh] Add support for terminal window resizing to terminal API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 10 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 | Annotate | Revision Log
OLDNEW
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698