| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // https://chromium.googlesource.com/chromium/src/+/master/docs/linux_sandbox_ip
c.md | 5 // https://chromium.googlesource.com/chromium/src/+/master/docs/linux_sandbox_ip
c.md |
| 6 | 6 |
| 7 #ifndef CONTENT_BROWSER_RENDERER_HOST_SANDBOX_IPC_LINUX_H_ | 7 #ifndef CONTENT_BROWSER_RENDERER_HOST_SANDBOX_IPC_LINUX_H_ |
| 8 #define CONTENT_BROWSER_RENDERER_HOST_SANDBOX_IPC_LINUX_H_ | 8 #define CONTENT_BROWSER_RENDERER_HOST_SANDBOX_IPC_LINUX_H_ |
| 9 | 9 |
| 10 #include <stdint.h> |
| 11 |
| 10 #include <memory> | 12 #include <memory> |
| 13 #include <string> |
| 11 #include <vector> | 14 #include <vector> |
| 12 | 15 |
| 13 #include "base/files/scoped_file.h" | 16 #include "base/files/scoped_file.h" |
| 14 #include "base/macros.h" | 17 #include "base/macros.h" |
| 15 #include "base/pickle.h" | 18 #include "base/pickle.h" |
| 16 #include "base/threading/simple_thread.h" | 19 #include "base/threading/simple_thread.h" |
| 20 #include "content/common/content_export.h" |
| 17 | 21 |
| 18 class SkString; | 22 class SkString; |
| 19 | 23 |
| 20 namespace content { | 24 namespace content { |
| 21 | 25 |
| 22 class SandboxIPCHandler : public base::DelegateSimpleThread::Delegate { | 26 class SandboxIPCHandler : public base::DelegateSimpleThread::Delegate { |
| 23 public: | 27 public: |
| 24 // lifeline_fd: the read end of a pipe which the main thread holds | 28 // lifeline_fd: the read end of a pipe which the main thread holds |
| 25 // the other end of. | 29 // the other end of. |
| 26 // browser_socket: the browser's end of the sandbox IPC socketpair. | 30 // browser_socket: the browser's end of the sandbox IPC socketpair. |
| 27 SandboxIPCHandler(int lifeline_fd, int browser_socket); | 31 SandboxIPCHandler(int lifeline_fd, int browser_socket); |
| 28 ~SandboxIPCHandler() override; | 32 ~SandboxIPCHandler() override; |
| 29 | 33 |
| 30 void Run() override; | 34 void Run() override; |
| 31 | 35 |
| 36 class TestObserver { |
| 37 public: |
| 38 virtual void OnGetFallbackFontForChar(UChar32 c, |
| 39 std::string name, |
| 40 int id) = 0; |
| 41 virtual void OnFontOpen(int id) = 0; |
| 42 }; |
| 43 CONTENT_EXPORT static void SetObserverForTests(TestObserver* observer); |
| 44 |
| 32 private: | 45 private: |
| 33 int FindOrAddPath(const SkString& path); | 46 int FindOrAddPath(const SkString& path); |
| 34 | 47 |
| 35 void HandleRequestFromRenderer(int fd); | 48 void HandleRequestFromRenderer(int fd); |
| 36 | 49 |
| 37 void HandleFontMatchRequest(int fd, | 50 void HandleFontMatchRequest(int fd, |
| 38 base::PickleIterator iter, | 51 base::PickleIterator iter, |
| 39 const std::vector<base::ScopedFD>& fds); | 52 const std::vector<base::ScopedFD>& fds); |
| 40 | 53 |
| 41 void HandleFontOpenRequest(int fd, | 54 void HandleFontOpenRequest(int fd, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 69 const int lifeline_fd_; | 82 const int lifeline_fd_; |
| 70 const int browser_socket_; | 83 const int browser_socket_; |
| 71 std::vector<SkString> paths_; | 84 std::vector<SkString> paths_; |
| 72 | 85 |
| 73 DISALLOW_COPY_AND_ASSIGN(SandboxIPCHandler); | 86 DISALLOW_COPY_AND_ASSIGN(SandboxIPCHandler); |
| 74 }; | 87 }; |
| 75 | 88 |
| 76 } // namespace content | 89 } // namespace content |
| 77 | 90 |
| 78 #endif // CONTENT_BROWSER_RENDERER_HOST_SANDBOX_IPC_LINUX_H_ | 91 #endif // CONTENT_BROWSER_RENDERER_HOST_SANDBOX_IPC_LINUX_H_ |
| OLD | NEW |