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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_PDF_RENDERER_PEPPER_PDF_HOST_H_
6 #define COMPONENTS_PDF_RENDERER_PEPPER_PDF_HOST_H_
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/strings/string16.h"
13 #include "ipc/ipc_platform_file.h"
14 #include "ppapi/c/ppb_image_data.h"
15 #include "ppapi/c/private/ppb_pdf.h"
16 #include "ppapi/host/resource_host.h"
17 #include "ppapi/proxy/serialized_structs.h"
19 struct PP_ImageDataDesc
;
24 class RendererPpapiHost
;
33 struct HostMessageContext
;
39 class PepperPDFHost
: public ppapi::host::ResourceHost
{
41 PepperPDFHost(content::RendererPpapiHost
* host
,
43 PP_Resource resource
);
44 ~PepperPDFHost() override
;
46 int32_t OnResourceMessageReceived(
47 const IPC::Message
& msg
,
48 ppapi::host::HostMessageContext
* context
) override
;
51 int32_t OnHostMsgGetLocalizedString(ppapi::host::HostMessageContext
* context
,
52 PP_ResourceString string_id
);
53 int32_t OnHostMsgDidStartLoading(ppapi::host::HostMessageContext
* context
);
54 int32_t OnHostMsgDidStopLoading(ppapi::host::HostMessageContext
* context
);
55 int32_t OnHostMsgSetContentRestriction(
56 ppapi::host::HostMessageContext
* context
,
58 int32_t OnHostMsgUserMetricsRecordAction(
59 ppapi::host::HostMessageContext
* context
,
60 const std::string
& action
);
61 int32_t OnHostMsgHasUnsupportedFeature(
62 ppapi::host::HostMessageContext
* context
);
63 int32_t OnHostMsgPrint(ppapi::host::HostMessageContext
* context
);
64 int32_t OnHostMsgSaveAs(ppapi::host::HostMessageContext
* context
);
65 int32_t OnHostMsgGetResourceImage(ppapi::host::HostMessageContext
* context
,
66 PP_ResourceImage image_id
,
68 int32_t OnHostMsgSetSelectedText(ppapi::host::HostMessageContext
* context
,
69 const base::string16
& selected_text
);
70 int32_t OnHostMsgSetLinkUnderCursor(ppapi::host::HostMessageContext
* context
,
71 const std::string
& url
);
73 bool CreateImageData(PP_Instance instance
,
74 PP_ImageDataFormat format
,
76 const SkBitmap
& pixels_to_write
,
77 ppapi::HostResource
* result
,
78 PP_ImageDataDesc
* out_image_data_desc
,
79 IPC::PlatformFileForTransit
* out_image_handle
,
80 uint32_t* out_byte_count
);
82 content::RendererPpapiHost
* host_
;
84 DISALLOW_COPY_AND_ASSIGN(PepperPDFHost
);
89 #endif // COMPONENTS_PDF_RENDERER_PEPPER_PDF_HOST_H_