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

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

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: . Created 8 years, 11 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_CHROMEOS_PROCESS_PROXY_PROCESS_PROXY_REGISTRY_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_PROCESS_PROXY_PROCESS_PROXY_REGISTRY_H_
6 #define CHROME_BROWSER_CHROMEOS_PROCESS_PROXY_PROCESS_PROXY_REGISTRY_H_ 6 #define CHROME_BROWSER_CHROMEOS_PROCESS_PROXY_PROCESS_PROXY_REGISTRY_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 10
(...skipping 22 matching lines...) Expand all
33 // This is to make map::insert happy, we don't init anything. 33 // This is to make map::insert happy, we don't init anything.
34 ProcessProxyInfo(const ProcessProxyInfo& other); 34 ProcessProxyInfo(const ProcessProxyInfo& other);
35 ~ProcessProxyInfo(); 35 ~ProcessProxyInfo();
36 }; 36 };
37 37
38 static ProcessProxyRegistry* Get(); 38 static ProcessProxyRegistry* Get();
39 39
40 // Starts new ProcessProxy (which starts new process). 40 // Starts new ProcessProxy (which starts new process).
41 bool OpenProcess(const std::string& command, pid_t* pid, 41 bool OpenProcess(const std::string& command, pid_t* pid,
42 const ProcessOutputCallbackWithPid& callback); 42 const ProcessOutputCallbackWithPid& callback);
43 // Send data to the process with id |pid|. 43 // Sends data to the process with id |pid|.
44 bool SendInput(pid_t pid, const std::string& data); 44 bool SendInput(pid_t pid, const std::string& data);
45 // Stop the process with id |pid|. 45 // Stops the process with id |pid|.
46 bool CloseProcess(pid_t pid); 46 bool CloseProcess(pid_t pid);
47 // Reports terminal resize to process proxy.
48 bool OnTerminalResize(pid_t pid, int width, int height);
47 49
48 // Gets called when output gets detected. Currently used for testing. 50 // Currently used for testing.
49 void SetOutputCallback(const ProcessOutputCallback& callback); 51 void SetOutputCallback(const ProcessOutputCallback& callback);
50 52
51 private: 53 private:
52 friend struct ::base::DefaultLazyInstanceTraits<ProcessProxyRegistry>; 54 friend struct ::base::DefaultLazyInstanceTraits<ProcessProxyRegistry>;
53 55
54 ProcessProxyRegistry(); 56 ProcessProxyRegistry();
55 ~ProcessProxyRegistry(); 57 ~ProcessProxyRegistry();
56 58
59 // Gets called when output gets detected.
57 void OnProcessOutput(pid_t pid, 60 void OnProcessOutput(pid_t pid,
58 ProcessOutputType type, 61 ProcessOutputType type,
59 const std::string& data); 62 const std::string& data);
60 // Must be called on UI thread. This lives on FILE thread, thus static. 63 // Must be called on UI thread. This lives on FILE thread, thus static.
61 // Notifies CroshProcessEventRouter about new process output. Assumes the 64 // Notifies CroshProcessEventRouter about new process output. Assumes the
62 // event router has already been initialized by someone else. 65 // event router has already been initialized by someone else.
63 static void DispatchProcessOutputOnUIThread(pid_t pid, 66 static void DispatchProcessOutputOnUIThread(pid_t pid,
64 const std::string& output_type, 67 const std::string& output_type,
65 const std::string& output); 68 const std::string& output);
66 69
67 // Map of all existing ProcessProxies. 70 // Map of all existing ProcessProxies.
68 std::map<pid_t, ProcessProxyInfo> proxy_map_; 71 std::map<pid_t, ProcessProxyInfo> proxy_map_;
69 72
70 DISALLOW_COPY_AND_ASSIGN(ProcessProxyRegistry); 73 DISALLOW_COPY_AND_ASSIGN(ProcessProxyRegistry);
71 }; 74 };
72 75
73 #endif // CHROME_BROWSER_CHROMEOS_PROCESS_PROXY_PROCESS_PROXY_REGISTRY_H_ 76 #endif // CHROME_BROWSER_CHROMEOS_PROCESS_PROXY_PROCESS_PROXY_REGISTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698