| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_PDF_RENDERER_PEPPER_PDF_HOST_H_ | 5 #ifndef COMPONENTS_PDF_RENDERER_PEPPER_PDF_HOST_H_ |
| 6 #define COMPONENTS_PDF_RENDERER_PEPPER_PDF_HOST_H_ | 6 #define COMPONENTS_PDF_RENDERER_PEPPER_PDF_HOST_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> |
| 10 #include <string> | 11 #include <string> |
| 12 #include <vector> |
| 11 | 13 |
| 12 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 13 #include "base/macros.h" | 15 #include "base/macros.h" |
| 14 #include "base/strings/string16.h" | 16 #include "base/strings/string16.h" |
| 15 #include "ipc/ipc_platform_file.h" | 17 #include "ipc/ipc_platform_file.h" |
| 16 #include "ppapi/c/ppb_image_data.h" | 18 #include "ppapi/c/ppb_image_data.h" |
| 17 #include "ppapi/c/private/ppb_pdf.h" | 19 #include "ppapi/c/private/ppb_pdf.h" |
| 18 #include "ppapi/host/resource_host.h" | 20 #include "ppapi/host/resource_host.h" |
| 19 #include "ppapi/proxy/serialized_structs.h" | 21 #include "ppapi/proxy/serialized_structs.h" |
| 20 | 22 |
| 21 struct PP_ImageDataDesc; | 23 struct PP_ImageDataDesc; |
| 22 struct PP_Size; | 24 struct PP_Size; |
| 23 class SkBitmap; | 25 class SkBitmap; |
| 24 | 26 |
| 25 namespace content { | 27 namespace content { |
| 26 class PepperPluginInstance; | 28 class PepperPluginInstance; |
| 29 class RenderView; |
| 27 class RendererPpapiHost; | 30 class RendererPpapiHost; |
| 28 } | 31 } |
| 29 | 32 |
| 30 namespace ppapi { | 33 namespace ppapi { |
| 31 class HostResource; | 34 class HostResource; |
| 32 } | |
| 33 | 35 |
| 34 namespace ppapi { | |
| 35 namespace host { | 36 namespace host { |
| 36 struct HostMessageContext; | 37 struct HostMessageContext; |
| 37 } | 38 } // namespace host |
| 38 } | 39 } // namespace ppapi |
| 39 | 40 |
| 40 namespace pdf { | 41 namespace pdf { |
| 41 | 42 |
| 42 class PdfAccessibilityTree; | 43 class PdfAccessibilityTree; |
| 43 | 44 |
| 44 class PepperPDFHost : public ppapi::host::ResourceHost { | 45 class PepperPDFHost : public ppapi::host::ResourceHost { |
| 45 public: | 46 public: |
| 46 class PrintClient { | 47 class PrintClient { |
| 47 public: | 48 public: |
| 48 virtual ~PrintClient() {} | 49 virtual ~PrintClient() {} |
| (...skipping 15 matching lines...) Expand all Loading... |
| 64 // Invokes the "Print" command for the given instance as if the user right | 65 // Invokes the "Print" command for the given instance as if the user right |
| 65 // clicked on it and selected "Print". Returns if the "Print" command was | 66 // clicked on it and selected "Print". Returns if the "Print" command was |
| 66 // issued or not. | 67 // issued or not. |
| 67 static bool InvokePrintingForInstance(PP_Instance instance); | 68 static bool InvokePrintingForInstance(PP_Instance instance); |
| 68 | 69 |
| 69 // The caller retains the ownership of |print_client|. The client is | 70 // The caller retains the ownership of |print_client|. The client is |
| 70 // allowed to be set only once, and when set, the client must outlive the | 71 // allowed to be set only once, and when set, the client must outlive the |
| 71 // PPB_PDF_Impl instance. | 72 // PPB_PDF_Impl instance. |
| 72 static void SetPrintClient(PrintClient* print_client); | 73 static void SetPrintClient(PrintClient* print_client); |
| 73 | 74 |
| 75 // ppapi::host::ResourceHost: |
| 74 int32_t OnResourceMessageReceived( | 76 int32_t OnResourceMessageReceived( |
| 75 const IPC::Message& msg, | 77 const IPC::Message& msg, |
| 76 ppapi::host::HostMessageContext* context) override; | 78 ppapi::host::HostMessageContext* context) override; |
| 77 | 79 |
| 78 private: | 80 private: |
| 79 int32_t OnHostMsgDidStartLoading(ppapi::host::HostMessageContext* context); | 81 int32_t OnHostMsgDidStartLoading(ppapi::host::HostMessageContext* context); |
| 80 int32_t OnHostMsgDidStopLoading(ppapi::host::HostMessageContext* context); | 82 int32_t OnHostMsgDidStopLoading(ppapi::host::HostMessageContext* context); |
| 81 int32_t OnHostMsgSetContentRestriction( | 83 int32_t OnHostMsgSetContentRestriction( |
| 82 ppapi::host::HostMessageContext* context, | 84 ppapi::host::HostMessageContext* context, |
| 83 int restrictions); | 85 int restrictions); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 99 ppapi::host::HostMessageContext* context, | 101 ppapi::host::HostMessageContext* context, |
| 100 const PP_PrivateAccessibilityDocInfo& doc_info); | 102 const PP_PrivateAccessibilityDocInfo& doc_info); |
| 101 int32_t OnHostMsgSetAccessibilityPageInfo( | 103 int32_t OnHostMsgSetAccessibilityPageInfo( |
| 102 ppapi::host::HostMessageContext* context, | 104 ppapi::host::HostMessageContext* context, |
| 103 const PP_PrivateAccessibilityPageInfo& page_info, | 105 const PP_PrivateAccessibilityPageInfo& page_info, |
| 104 const std::vector<PP_PrivateAccessibilityTextRunInfo>& text_runs, | 106 const std::vector<PP_PrivateAccessibilityTextRunInfo>& text_runs, |
| 105 const std::vector<PP_PrivateAccessibilityCharInfo>& chars); | 107 const std::vector<PP_PrivateAccessibilityCharInfo>& chars); |
| 106 | 108 |
| 107 void CreatePdfAccessibilityTreeIfNeeded(); | 109 void CreatePdfAccessibilityTreeIfNeeded(); |
| 108 | 110 |
| 111 content::RenderView* GetRenderView(); |
| 112 |
| 109 std::unique_ptr<PdfAccessibilityTree> pdf_accessibility_tree_; | 113 std::unique_ptr<PdfAccessibilityTree> pdf_accessibility_tree_; |
| 110 | 114 |
| 111 content::RendererPpapiHost* host_; | 115 content::RendererPpapiHost* const host_; |
| 112 | 116 |
| 113 DISALLOW_COPY_AND_ASSIGN(PepperPDFHost); | 117 DISALLOW_COPY_AND_ASSIGN(PepperPDFHost); |
| 114 }; | 118 }; |
| 115 | 119 |
| 116 } // namespace pdf | 120 } // namespace pdf |
| 117 | 121 |
| 118 #endif // COMPONENTS_PDF_RENDERER_PEPPER_PDF_HOST_H_ | 122 #endif // COMPONENTS_PDF_RENDERER_PEPPER_PDF_HOST_H_ |
| OLD | NEW |