- add sources.
[platform/framework/web/crosswalk.git] / src / content / renderer / pepper / pepper_truetype_font_host.h
1 // Copyright (c) 2013 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 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_TRUETYPE_FONT_HOST_H_
6 #define CONTENT_RENDERER_PEPPER_PEPPER_TRUETYPE_FONT_HOST_H_
7
8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h"
11 #include "content/common/content_export.h"
12 #include "content/renderer/pepper/pepper_truetype_font.h"
13 #include "ppapi/host/resource_host.h"
14
15 namespace content {
16
17 class RendererPpapiHost;
18
19 class CONTENT_EXPORT PepperTrueTypeFontHost : public ppapi::host::ResourceHost {
20  public:
21   PepperTrueTypeFontHost(RendererPpapiHost* host,
22                          PP_Instance instance,
23                          PP_Resource resource,
24                          const ppapi::proxy::SerializedTrueTypeFontDesc& desc);
25
26   virtual ~PepperTrueTypeFontHost();
27
28   virtual int32_t OnResourceMessageReceived(
29       const IPC::Message& msg,
30       ppapi::host::HostMessageContext* context) OVERRIDE;
31
32  private:
33   int32_t OnHostMsgDescribe(ppapi::host::HostMessageContext* context);
34   int32_t OnHostMsgGetTableTags(ppapi::host::HostMessageContext* context);
35   int32_t OnHostMsgGetTable(ppapi::host::HostMessageContext* context,
36                             uint32_t table,
37                             int32_t offset,
38                             int32_t max_data_length);
39
40   RendererPpapiHost* renderer_ppapi_host_;
41   scoped_ptr<PepperTrueTypeFont> font_;
42
43   base::WeakPtrFactory<PepperTrueTypeFontHost> weak_factory_;
44
45   DISALLOW_COPY_AND_ASSIGN(PepperTrueTypeFontHost);
46 };
47
48 }  // namespace content
49
50 #endif  // CONTENT_RENDERER_PEPPER_PEPPER_TRUETYPE_FONT_HOST_H_