[email protected] | c4f883a | 2012-02-03 17:02:07 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
Jay Civelli | 14aced2a | 2018-03-14 23:44:33 | [diff] [blame] | 5 | #ifndef CONTENT_BROWSER_UTILITY_PROCESS_HOST_CLIENT_H_ |
| 6 | #define CONTENT_BROWSER_UTILITY_PROCESS_HOST_CLIENT_H_ |
[email protected] | c4f883a | 2012-02-03 17:02:07 | [diff] [blame] | 7 | |
| 8 | #include "base/memory/ref_counted.h" |
| 9 | #include "content/common/content_export.h" |
| 10 | |
| 11 | namespace IPC { |
| 12 | class Message; |
| 13 | } |
| 14 | |
| 15 | namespace content { |
| 16 | |
| 17 | // An interface to be implemented by consumers of the utility process to |
| 18 | // get results back. All functions are called on the thread passed along |
| 19 | // to UtilityProcessHost. |
| 20 | class UtilityProcessHostClient |
| 21 | : public base::RefCountedThreadSafe<UtilityProcessHostClient> { |
| 22 | public: |
| 23 | // Called when the process has crashed. |
| 24 | virtual void OnProcessCrashed(int exit_code) {} |
| 25 | |
wfh | 3adf87d | 2016-05-03 23:26:06 | [diff] [blame] | 26 | // Called when the process fails to launch. |error_code| is one of |
| 27 | // LaunchResultCode or sandbox::ResultCode containing the error. |
| 28 | virtual void OnProcessLaunchFailed(int error_code) {} |
[email protected] | fa01e47 | 2014-02-11 14:45:35 | [diff] [blame] | 29 | |
[email protected] | c4f883a | 2012-02-03 17:02:07 | [diff] [blame] | 30 | // Allow the client to filter IPC messages. |
| 31 | virtual bool OnMessageReceived(const IPC::Message& message) = 0; |
| 32 | |
| 33 | protected: |
| 34 | friend class base::RefCountedThreadSafe<UtilityProcessHostClient>; |
| 35 | |
| 36 | virtual ~UtilityProcessHostClient() {} |
| 37 | }; |
| 38 | |
| 39 | }; // namespace content |
| 40 | |
Jay Civelli | 14aced2a | 2018-03-14 23:44:33 | [diff] [blame] | 41 | #endif // CONTENT_BROWSER_UTILITY_PROCESS_HOST_CLIENT_H_ |