OLD | NEW |
(Empty) | |
| 1 // 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 |
| 7 #ifndef CONTENT_BROWSER_RENDERER_HOST_SANDBOX_IPC_H_ |
| 8 #define CONTENT_BROWSER_RENDERER_HOST_SANDBOX_IPC_H_ |
| 9 |
| 10 #include <vector> |
| 11 |
| 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/pickle.h" |
| 14 #include "content/child/blink_platform_impl.h" |
| 15 #include "skia/ext/skia_utils_base.h" |
| 16 |
| 17 namespace content { |
| 18 |
| 19 class SandboxIPCProcess { |
| 20 public: |
| 21 // lifeline_fd: this is the read end of a pipe which the browser process |
| 22 // holds the other end of. If the browser process dies, its descriptors are |
| 23 // closed and we will noticed an EOF on the pipe. That's our signal to exit. |
| 24 // browser_socket: the browser's end of the sandbox IPC socketpair. From the |
| 25 // point of view of the renderer, it's talking to the browser but this |
| 26 // object actually services the requests. |
| 27 // sandbox_cmd: the path of the sandbox executable. |
| 28 SandboxIPCProcess(int lifeline_fd, |
| 29 int browser_socket, |
| 30 std::string sandbox_cmd); |
| 31 ~SandboxIPCProcess(); |
| 32 |
| 33 void Run(); |
| 34 |
| 35 private: |
| 36 void EnsureWebKitInitialized(); |
| 37 |
| 38 int FindOrAddPath(const SkString& path); |
| 39 |
| 40 void HandleRequestFromRenderer(int fd); |
| 41 |
| 42 void HandleFontMatchRequest(int fd, |
| 43 const Pickle& pickle, |
| 44 PickleIterator iter, |
| 45 std::vector<int>& fds); |
| 46 |
| 47 void HandleFontOpenRequest(int fd, |
| 48 const Pickle& pickle, |
| 49 PickleIterator iter, |
| 50 std::vector<int>& fds); |
| 51 |
| 52 void HandleGetFontFamilyForChar(int fd, |
| 53 const Pickle& pickle, |
| 54 PickleIterator iter, |
| 55 std::vector<int>& fds); |
| 56 |
| 57 void HandleGetStyleForStrike(int fd, |
| 58 const Pickle& pickle, |
| 59 PickleIterator iter, |
| 60 std::vector<int>& fds); |
| 61 |
| 62 void HandleLocaltime(int fd, |
| 63 const Pickle& pickle, |
| 64 PickleIterator iter, |
| 65 std::vector<int>& fds); |
| 66 |
| 67 void HandleGetChildWithInode(int fd, |
| 68 const Pickle& pickle, |
| 69 PickleIterator iter, |
| 70 std::vector<int>& fds); |
| 71 |
| 72 void HandleMakeSharedMemorySegment(int fd, |
| 73 const Pickle& pickle, |
| 74 PickleIterator iter, |
| 75 std::vector<int>& fds); |
| 76 |
| 77 void HandleMatchWithFallback(int fd, |
| 78 const Pickle& pickle, |
| 79 PickleIterator iter, |
| 80 std::vector<int>& fds); |
| 81 |
| 82 void SendRendererReply(const std::vector<int>& fds, |
| 83 const Pickle& reply, |
| 84 int reply_fd); |
| 85 |
| 86 const int lifeline_fd_; |
| 87 const int browser_socket_; |
| 88 std::vector<std::string> sandbox_cmd_; |
| 89 scoped_ptr<BlinkPlatformImpl> webkit_platform_support_; |
| 90 SkTDArray<SkString*> paths_; |
| 91 |
| 92 DISALLOW_COPY_AND_ASSIGN(SandboxIPCProcess); |
| 93 }; |
| 94 |
| 95 } // namespace content |
| 96 |
| 97 #endif // CONTENT_BROWSER_RENDERER_HOST_SANDBOX_IPC_H_ |
OLD | NEW |