OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. |
| 4 |
| 5 #include "chrome/renderer/renderer_sandbox_support_linux.h" |
| 6 |
| 7 #include "base/pickle.h" |
| 8 #include "base/unix_domain_socket_posix.h" |
| 9 #include "chrome/common/sandbox_methods_linux.h" |
| 10 |
| 11 namespace renderer_sandbox_support { |
| 12 |
| 13 std::string getFontFamilyForCharacters(const uint16_t* utf16, size_t num_utf16)
{ |
| 14 Pickle request; |
| 15 request.WriteInt(LinuxSandbox::METHOD_GET_FONT_FAMILY_FOR_CHARS); |
| 16 request.WriteInt(num_utf16); |
| 17 for (size_t i = 0; i < num_utf16; ++i) |
| 18 request.WriteUInt32(utf16[i]); |
| 19 |
| 20 uint8_t buf[512]; |
| 21 static const int kMagicSandboxFD = 4; |
| 22 const ssize_t n = base::SendRecvMsg(kMagicSandboxFD, buf, sizeof(buf), NULL, |
| 23 request); |
| 24 |
| 25 std::string family_name; |
| 26 if (n != -1) { |
| 27 Pickle reply(reinterpret_cast<char*>(buf), n); |
| 28 void* pickle_iter = NULL; |
| 29 reply.ReadString(&pickle_iter, &family_name); |
| 30 } |
| 31 |
| 32 return family_name; |
| 33 } |
| 34 |
| 35 } // namespace render_sandbox_support |
OLD | NEW |