blob: 23a65e0d2153fe895b147b45f6743f9ef17dbc9c [file] [log] [blame]
[email protected]ac0a3f02014-04-24 03:34:161// Copyright 2014 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// http://code.google.com/p/chromium/wiki/LinuxSandboxIPC
6
tfarinabccc34c72015-02-27 21:32:157#ifndef CONTENT_BROWSER_RENDERER_HOST_SANDBOX_IPC_LINUX_H_
8#define CONTENT_BROWSER_RENDERER_HOST_SANDBOX_IPC_LINUX_H_
[email protected]ac0a3f02014-04-24 03:34:169
10#include <vector>
11
[email protected]8feaa672014-04-30 21:57:1012#include "base/files/scoped_file.h"
[email protected]ac0a3f02014-04-24 03:34:1613#include "base/memory/scoped_ptr.h"
14#include "base/pickle.h"
[email protected]ef0dad53c2014-05-23 11:31:1915#include "base/threading/simple_thread.h"
[email protected]ac0a3f02014-04-24 03:34:1616#include "content/child/blink_platform_impl.h"
17#include "skia/ext/skia_utils_base.h"
18
19namespace content {
20
[email protected]ef0dad53c2014-05-23 11:31:1921class SandboxIPCHandler : public base::DelegateSimpleThread::Delegate {
[email protected]ac0a3f02014-04-24 03:34:1622 public:
[email protected]ef0dad53c2014-05-23 11:31:1923 // lifeline_fd: the read end of a pipe which the main thread holds
24 // the other end of.
25 // browser_socket: the browser's end of the sandbox IPC socketpair.
26 SandboxIPCHandler(int lifeline_fd, int browser_socket);
dcheng4c1127472014-10-28 00:01:2027 ~SandboxIPCHandler() override;
[email protected]ac0a3f02014-04-24 03:34:1628
dcheng4c1127472014-10-28 00:01:2029 void Run() override;
[email protected]ac0a3f02014-04-24 03:34:1630
31 private:
32 void EnsureWebKitInitialized();
33
34 int FindOrAddPath(const SkString& path);
35
36 void HandleRequestFromRenderer(int fd);
37
38 void HandleFontMatchRequest(int fd,
brettw05cfd8ddb2015-06-02 07:02:4739 base::PickleIterator iter,
[email protected]8feaa672014-04-30 21:57:1040 const std::vector<base::ScopedFD*>& fds);
[email protected]ac0a3f02014-04-24 03:34:1641
42 void HandleFontOpenRequest(int fd,
brettw05cfd8ddb2015-06-02 07:02:4743 base::PickleIterator iter,
[email protected]8feaa672014-04-30 21:57:1044 const std::vector<base::ScopedFD*>& fds);
[email protected]ac0a3f02014-04-24 03:34:1645
[email protected]aee791a62014-06-12 03:42:4046 void HandleGetFallbackFontForChar(int fd,
brettw05cfd8ddb2015-06-02 07:02:4747 base::PickleIterator iter,
[email protected]8feaa672014-04-30 21:57:1048 const std::vector<base::ScopedFD*>& fds);
[email protected]ac0a3f02014-04-24 03:34:1649
50 void HandleGetStyleForStrike(int fd,
brettw05cfd8ddb2015-06-02 07:02:4751 base::PickleIterator iter,
[email protected]8feaa672014-04-30 21:57:1052 const std::vector<base::ScopedFD*>& fds);
[email protected]ac0a3f02014-04-24 03:34:1653
54 void HandleLocaltime(int fd,
brettw05cfd8ddb2015-06-02 07:02:4755 base::PickleIterator iter,
[email protected]8feaa672014-04-30 21:57:1056 const std::vector<base::ScopedFD*>& fds);
[email protected]ac0a3f02014-04-24 03:34:1657
[email protected]ac0a3f02014-04-24 03:34:1658 void HandleMakeSharedMemorySegment(int fd,
brettw05cfd8ddb2015-06-02 07:02:4759 base::PickleIterator iter,
[email protected]8feaa672014-04-30 21:57:1060 const std::vector<base::ScopedFD*>& fds);
[email protected]ac0a3f02014-04-24 03:34:1661
62 void HandleMatchWithFallback(int fd,
brettw05cfd8ddb2015-06-02 07:02:4763 base::PickleIterator iter,
[email protected]8feaa672014-04-30 21:57:1064 const std::vector<base::ScopedFD*>& fds);
[email protected]ac0a3f02014-04-24 03:34:1665
[email protected]8feaa672014-04-30 21:57:1066 void SendRendererReply(const std::vector<base::ScopedFD*>& fds,
brettw05cfd8ddb2015-06-02 07:02:4767 const base::Pickle& reply,
[email protected]ac0a3f02014-04-24 03:34:1668 int reply_fd);
69
[email protected]972a99952014-05-01 20:41:2270 const int lifeline_fd_;
[email protected]ac0a3f02014-04-24 03:34:1671 const int browser_socket_;
tfarina556a7232014-10-05 01:02:0972 scoped_ptr<BlinkPlatformImpl> blink_platform_impl_;
[email protected]ac0a3f02014-04-24 03:34:1673 SkTDArray<SkString*> paths_;
74
[email protected]ef0dad53c2014-05-23 11:31:1975 DISALLOW_COPY_AND_ASSIGN(SandboxIPCHandler);
[email protected]ac0a3f02014-04-24 03:34:1676};
77
78} // namespace content
79
tfarinabccc34c72015-02-27 21:32:1580#endif // CONTENT_BROWSER_RENDERER_HOST_SANDBOX_IPC_LINUX_H_