summaryrefslogtreecommitdiff
path: root/chromium/content/common/font_config_ipc_linux.h
blob: 0325dc482805c155cb8de5f05de85aeda5c1f367 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_COMMON_FONT_CONFIG_IPC_LINUX_H_
#define CONTENT_COMMON_FONT_CONFIG_IPC_LINUX_H_

#include "base/compiler_specific.h"
#include "third_party/skia/include/ports/SkFontConfigInterface.h"

#include <string>

namespace content {

// FontConfig implementation for Skia that proxies out of process to get out
// of the sandbox. See http://code.google.com/p/chromium/wiki/LinuxSandboxIPC
class FontConfigIPC : public SkFontConfigInterface {
 public:
  explicit FontConfigIPC(int fd);
  virtual ~FontConfigIPC();

  virtual bool matchFamilyName(const char familyName[],
                               SkTypeface::Style requested,
                               FontIdentity* outFontIdentifier,
                               SkString* outFamilyName,
                               SkTypeface::Style* outStyle) OVERRIDE;

  virtual SkStream* openStream(const FontIdentity&) OVERRIDE;

  enum Method {
    METHOD_MATCH = 0,
    METHOD_OPEN = 1,
  };

  enum {
    kMaxFontFamilyLength = 2048
  };

 private:
  const int fd_;
};

}  // namespace content

#endif  // CONTENT_COMMON_FONT_CONFIG_IPC_LINUX_H_