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

Side by Side Diff: chrome/browser/extensions/api/terminal/terminal_private_api.h

Issue 10071035: RefCounted types should not have public destructors, chrome/browser/extensions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compile fix Created 8 years, 7 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_TERMINAL_TERMINAL_PRIVATE_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_TERMINAL_TERMINAL_PRIVATE_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_TERMINAL_TERMINAL_PRIVATE_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_TERMINAL_TERMINAL_PRIVATE_API_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "chrome/browser/extensions/extension_function.h" 11 #include "chrome/browser/extensions/extension_function.h"
12 12
13 // Base class for all terminalPrivate function classes. Main purpose is to run 13 // Base class for all terminalPrivate function classes. Main purpose is to run
14 // permission check before calling actual function implementation. 14 // permission check before calling actual function implementation.
15 class TerminalPrivateFunction : public AsyncExtensionFunction { 15 class TerminalPrivateFunction : public AsyncExtensionFunction {
16 public: 16 public:
17 TerminalPrivateFunction(); 17 TerminalPrivateFunction();
18
19 protected:
18 virtual ~TerminalPrivateFunction(); 20 virtual ~TerminalPrivateFunction();
19 21
22 // ExtensionFunction:
20 virtual bool RunImpl() OVERRIDE; 23 virtual bool RunImpl() OVERRIDE;
21 24
22 // Override with actual extension function implementation. 25 // Override with actual extension function implementation.
23 virtual bool RunTerminalFunction() = 0; 26 virtual bool RunTerminalFunction() = 0;
24 27
25 }; 28 };
26 29
27 // Opens new terminal process. Returns the new process id. 30 // Opens new terminal process. Returns the new process id.
28 class OpenTerminalProcessFunction : public TerminalPrivateFunction { 31 class OpenTerminalProcessFunction : public TerminalPrivateFunction {
29 public: 32 public:
33 DECLARE_EXTENSION_FUNCTION_NAME("terminalPrivate.openTerminalProcess")
34
30 OpenTerminalProcessFunction(); 35 OpenTerminalProcessFunction();
36
37 protected:
31 virtual ~OpenTerminalProcessFunction(); 38 virtual ~OpenTerminalProcessFunction();
32 39
40 // TerminalPrivateFunction:
33 virtual bool RunTerminalFunction() OVERRIDE; 41 virtual bool RunTerminalFunction() OVERRIDE;
34 42
35 private: 43 private:
36 void OpenOnFileThread(); 44 void OpenOnFileThread();
37 void RespondOnUIThread(pid_t pid); 45 void RespondOnUIThread(pid_t pid);
38 46
39 const char* command_; 47 const char* command_;
40
41 DECLARE_EXTENSION_FUNCTION_NAME("terminalPrivate.openTerminalProcess")
42 }; 48 };
43 49
44 // Send input to the terminal process specified by the pid sent as an argument. 50 // Send input to the terminal process specified by the pid sent as an argument.
45 class SendInputToTerminalProcessFunction : public TerminalPrivateFunction { 51 class SendInputToTerminalProcessFunction : public TerminalPrivateFunction {
46 public: 52 public:
53 DECLARE_EXTENSION_FUNCTION_NAME("terminalPrivate.sendInput")
54
55 protected:
56 // TerminalPrivateFunction:
47 virtual bool RunTerminalFunction() OVERRIDE; 57 virtual bool RunTerminalFunction() OVERRIDE;
48 58
49 private: 59 private:
50 void SendInputOnFileThread(pid_t pid, const std::string& input); 60 void SendInputOnFileThread(pid_t pid, const std::string& input);
51 void RespondOnUIThread(bool success); 61 void RespondOnUIThread(bool success);
52
53 DECLARE_EXTENSION_FUNCTION_NAME("terminalPrivate.sendInput")
54 }; 62 };
55 63
56 // Closes terminal process with given pid. 64 // Closes terminal process with given pid.
57 class CloseTerminalProcessFunction : public TerminalPrivateFunction { 65 class CloseTerminalProcessFunction : public TerminalPrivateFunction {
58 public: 66 public:
67 DECLARE_EXTENSION_FUNCTION_NAME("terminalPrivate.closeTerminalProcess")
68
69 protected:
59 virtual bool RunTerminalFunction() OVERRIDE; 70 virtual bool RunTerminalFunction() OVERRIDE;
60 71
61 private: 72 private:
62 void CloseOnFileThread(pid_t pid); 73 void CloseOnFileThread(pid_t pid);
63 void RespondOnUIThread(bool success); 74 void RespondOnUIThread(bool success);
64
65 DECLARE_EXTENSION_FUNCTION_NAME("terminalPrivate.closeTerminalProcess")
66 }; 75 };
67 76
68 // Called by extension when terminal size changes. 77 // Called by extension when terminal size changes.
69 class OnTerminalResizeFunction : public TerminalPrivateFunction { 78 class OnTerminalResizeFunction : public TerminalPrivateFunction {
70 public: 79 public:
80 DECLARE_EXTENSION_FUNCTION_NAME("terminalPrivate.onTerminalResize")
81
82 protected:
71 virtual bool RunTerminalFunction() OVERRIDE; 83 virtual bool RunTerminalFunction() OVERRIDE;
72 84
73 private: 85 private:
74 void OnResizeOnFileThread(pid_t pid, int width, int height); 86 void OnResizeOnFileThread(pid_t pid, int width, int height);
75 void RespondOnUIThread(bool success); 87 void RespondOnUIThread(bool success);
76
77 DECLARE_EXTENSION_FUNCTION_NAME("terminalPrivate.onTerminalResize")
78 }; 88 };
79 89
80 #endif // CHROME_BROWSER_EXTENSIONS_API_TERMINAL_TERMINAL_PRIVATE_API_H_ 90 #endif // CHROME_BROWSER_EXTENSIONS_API_TERMINAL_TERMINAL_PRIVATE_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698