blob: bd7e89d62032e9bda6c2aeb97fe80ebff77d6261 [file] [log] [blame]
[email protected]c4f883a2012-02-03 17:02:071// 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
5#ifndef CONTENT_PUBLIC_BROWSER_UTILITY_PROCESS_HOST_CLIENT_H_
6#define CONTENT_PUBLIC_BROWSER_UTILITY_PROCESS_HOST_CLIENT_H_
[email protected]c4f883a2012-02-03 17:02:077
8#include "base/memory/ref_counted.h"
9#include "content/common/content_export.h"
10
11namespace IPC {
12class Message;
13}
14
15namespace 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.
20class UtilityProcessHostClient
21 : public base::RefCountedThreadSafe<UtilityProcessHostClient> {
22 public:
23 // Called when the process has crashed.
24 virtual void OnProcessCrashed(int exit_code) {}
25
[email protected]fa01e472014-02-11 14:45:3526 // Called when the process fails to launch, i.e. it has no exit code.
27 virtual void OnProcessLaunchFailed() {}
28
[email protected]c4f883a2012-02-03 17:02:0729 // Allow the client to filter IPC messages.
30 virtual bool OnMessageReceived(const IPC::Message& message) = 0;
31
32 protected:
33 friend class base::RefCountedThreadSafe<UtilityProcessHostClient>;
34
35 virtual ~UtilityProcessHostClient() {}
36};
37
38}; // namespace content
39
40#endif // CONTENT_PUBLIC_BROWSER_UTILITY_PROCESS_HOST_CLIENT_H_