Loosen up heuristics for detecting account creation forms.
[chromium-blink-merge.git] / content / public / common / zygote_fork_delegate_linux.h
blobb4aa5123eb84e2131a20b990de42fdb9bdb7c47d
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.
5 #ifndef CONTENT_PUBLIC_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_
6 #define CONTENT_PUBLIC_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_
8 #include <unistd.h>
10 #include <string>
11 #include <vector>
13 namespace content {
15 // The ZygoteForkDelegate allows the Chrome Linux zygote to delegate
16 // fork operations to another class that knows how to do some
17 // specialized version of fork.
18 class ZygoteForkDelegate {
19 public:
20 // A ZygoteForkDelegate is created during Chrome linux zygote
21 // initialization, and provides "fork()" functionality as an
22 // alternative to forking the zygote. A new delegate is passed in
23 // as an argument to ZygoteMain().
24 virtual ~ZygoteForkDelegate() {}
26 // Initialization happens in the zygote after it has been
27 // started by ZygoteMain.
28 virtual void Init(bool sandboxed,
29 int browserdesc,
30 int sandboxdesc) = 0;
32 // After Init, supply a UMA_HISTOGRAM_ENUMERATION the delegate
33 // would like to supply on the first fork.
34 virtual void InitialUMA(std::string* uma_name,
35 int* uma_sample,
36 int* uma_boundary_value) = 0;
38 // Returns 'true' if the delegate would like to handle a given fork
39 // request. Otherwise returns false. Optionally, fills in uma_name et al
40 // with a report the helper wants to make via UMA_HISTOGRAM_ENUMERATION.
41 virtual bool CanHelp(const std::string& process_type, std::string* uma_name,
42 int* uma_sample, int* uma_boundary_value) = 0;
44 // Delegate forks, returning a -1 on failure. Outside the
45 // suid sandbox, Fork() returns the Linux process ID. Inside
46 // the sandbox, returns a positive integer, with PID discovery
47 // handled by the sandbox.
48 virtual pid_t Fork(const std::vector<int>& fds) = 0;
50 // After a successful for, signal the child to indicate that
51 // the child's PID has been received. Also communicate the
52 // channel switch as a part of acknowledgement message.
53 virtual bool AckChild(int fd, const std::string& channel_switch) = 0;
56 } // namespace content
58 #endif // CONTENT_PUBLIC_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_