Extension syncing: Introduce a NeedsSync pref
[chromium-blink-merge.git] / components / pdf / renderer / pepper_pdf_host.h
blobfe6f33800dc7a6866bbbdbf72055e3bb1203d037
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_
8 #include <string>
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;
20 struct PP_Size;
21 class SkBitmap;
23 namespace content {
24 class RendererPpapiHost;
27 namespace ppapi {
28 class HostResource;
31 namespace ppapi {
32 namespace host {
33 struct HostMessageContext;
37 namespace pdf {
39 class PepperPDFHost : public ppapi::host::ResourceHost {
40 public:
41 class PrintClient {
42 public:
43 virtual ~PrintClient() {}
45 // Returns whether printing is enabled for the plugin instance identified by
46 // |instance_id|.
47 virtual bool IsPrintingEnabled(PP_Instance instance_id) = 0;
49 // Invokes the "Print" command for the plugin instance identified by
50 // |instance_id|. Returns whether the "Print" command was issued or not.
51 virtual bool Print(PP_Instance instance_id) = 0;
54 PepperPDFHost(content::RendererPpapiHost* host,
55 PP_Instance instance,
56 PP_Resource resource);
57 ~PepperPDFHost() override;
59 // Invokes the "Print" command for the given instance as if the user right
60 // clicked on it and selected "Print". Returns if the "Print" command was
61 // issued or not.
62 static bool InvokePrintingForInstance(PP_Instance instance);
64 // The caller retains the ownership of |print_client|. The client is
65 // allowed to be set only once, and when set, the client must outlive the
66 // PPB_PDF_Impl instance.
67 static void SetPrintClient(PrintClient* print_client);
69 int32_t OnResourceMessageReceived(
70 const IPC::Message& msg,
71 ppapi::host::HostMessageContext* context) override;
73 private:
74 int32_t OnHostMsgGetLocalizedString(ppapi::host::HostMessageContext* context,
75 PP_ResourceString string_id);
76 int32_t OnHostMsgDidStartLoading(ppapi::host::HostMessageContext* context);
77 int32_t OnHostMsgDidStopLoading(ppapi::host::HostMessageContext* context);
78 int32_t OnHostMsgSetContentRestriction(
79 ppapi::host::HostMessageContext* context,
80 int restrictions);
81 int32_t OnHostMsgUserMetricsRecordAction(
82 ppapi::host::HostMessageContext* context,
83 const std::string& action);
84 int32_t OnHostMsgHasUnsupportedFeature(
85 ppapi::host::HostMessageContext* context);
86 int32_t OnHostMsgPrint(ppapi::host::HostMessageContext* context);
87 int32_t OnHostMsgSaveAs(ppapi::host::HostMessageContext* context);
88 int32_t OnHostMsgSetSelectedText(ppapi::host::HostMessageContext* context,
89 const base::string16& selected_text);
90 int32_t OnHostMsgSetLinkUnderCursor(ppapi::host::HostMessageContext* context,
91 const std::string& url);
93 content::RendererPpapiHost* host_;
95 DISALLOW_COPY_AND_ASSIGN(PepperPDFHost);
98 } // namespace pdf
100 #endif // COMPONENTS_PDF_RENDERER_PEPPER_PDF_HOST_H_