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 <memory> | 10 #include <memory> |
| 11 #include <string> |
11 #include <vector> | 12 #include <vector> |
12 | 13 |
13 #include "base/files/scoped_file.h" | 14 #include "base/files/scoped_file.h" |
14 #include "base/macros.h" | 15 #include "base/macros.h" |
15 #include "base/pickle.h" | 16 #include "base/pickle.h" |
16 #include "base/threading/simple_thread.h" | 17 #include "base/threading/simple_thread.h" |
| 18 #include "content/common/content_export.h" |
| 19 #include "third_party/icu/source/common/unicode/uchar.h" |
17 | 20 |
18 class SkString; | 21 class SkString; |
19 | 22 |
20 namespace content { | 23 namespace content { |
21 | 24 |
22 class SandboxIPCHandler : public base::DelegateSimpleThread::Delegate { | 25 class SandboxIPCHandler : public base::DelegateSimpleThread::Delegate { |
23 public: | 26 public: |
24 // lifeline_fd: the read end of a pipe which the main thread holds | 27 // lifeline_fd: the read end of a pipe which the main thread holds |
25 // the other end of. | 28 // the other end of. |
26 // browser_socket: the browser's end of the sandbox IPC socketpair. | 29 // browser_socket: the browser's end of the sandbox IPC socketpair. |
27 SandboxIPCHandler(int lifeline_fd, int browser_socket); | 30 SandboxIPCHandler(int lifeline_fd, int browser_socket); |
28 ~SandboxIPCHandler() override; | 31 ~SandboxIPCHandler() override; |
29 | 32 |
30 void Run() override; | 33 void Run() override; |
31 | 34 |
| 35 class TestObserver { |
| 36 public: |
| 37 virtual void OnGetFallbackFontForChar(UChar32 c, |
| 38 std::string name, |
| 39 int id) = 0; |
| 40 virtual void OnFontOpen(int id) = 0; |
| 41 }; |
| 42 CONTENT_EXPORT static void SetObserverForTests(TestObserver* observer); |
| 43 |
32 private: | 44 private: |
33 int FindOrAddPath(const SkString& path); | 45 int FindOrAddPath(const SkString& path); |
34 | 46 |
35 void HandleRequestFromRenderer(int fd); | 47 void HandleRequestFromRenderer(int fd); |
36 | 48 |
37 void HandleFontMatchRequest(int fd, | 49 void HandleFontMatchRequest(int fd, |
38 base::PickleIterator iter, | 50 base::PickleIterator iter, |
39 const std::vector<base::ScopedFD>& fds); | 51 const std::vector<base::ScopedFD>& fds); |
40 | 52 |
41 void HandleFontOpenRequest(int fd, | 53 void HandleFontOpenRequest(int fd, |
(...skipping 27 matching lines...) Expand all Loading... |
69 const int lifeline_fd_; | 81 const int lifeline_fd_; |
70 const int browser_socket_; | 82 const int browser_socket_; |
71 std::vector<SkString> paths_; | 83 std::vector<SkString> paths_; |
72 | 84 |
73 DISALLOW_COPY_AND_ASSIGN(SandboxIPCHandler); | 85 DISALLOW_COPY_AND_ASSIGN(SandboxIPCHandler); |
74 }; | 86 }; |
75 | 87 |
76 } // namespace content | 88 } // namespace content |
77 | 89 |
78 #endif // CONTENT_BROWSER_RENDERER_HOST_SANDBOX_IPC_LINUX_H_ | 90 #endif // CONTENT_BROWSER_RENDERER_HOST_SANDBOX_IPC_LINUX_H_ |
OLD | NEW |