From 917a44b0724089630cb1d962a9383df7a1deaf7e Mon Sep 17 00:00:00 2001 From: "viettrungluu@chromium.org" Date: Thu, 13 Jan 2011 17:07:29 +0000 Subject: Move webkit/plugins/ppapi/ppb_pdf.h to ppapi/c/private. BUG=none TEST=builds Review URL: http://codereview.chromium.org/6255001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71328 0039d316-1c4b-4281-b951-d872f2087c98 --- ppapi/c/private/ppb_pdf.h | 135 ++++++++++++++++++++++++++++++++++ ppapi/ppapi.gyp | 1 + ppapi/proxy/DEPS | 5 -- ppapi/proxy/dispatcher.cc | 2 +- ppapi/proxy/ppb_pdf_proxy.cc | 4 +- webkit/glue/webkit_glue.gypi | 1 - webkit/plugins/ppapi/plugin_module.cc | 2 +- webkit/plugins/ppapi/ppb_pdf.h | 135 ---------------------------------- webkit/plugins/ppapi/ppb_pdf_impl.cc | 4 +- 9 files changed, 142 insertions(+), 147 deletions(-) create mode 100644 ppapi/c/private/ppb_pdf.h delete mode 100644 webkit/plugins/ppapi/ppb_pdf.h diff --git a/ppapi/c/private/ppb_pdf.h b/ppapi/c/private/ppb_pdf.h new file mode 100644 index 0000000..8a03525 --- /dev/null +++ b/ppapi/c/private/ppb_pdf.h @@ -0,0 +1,135 @@ +// Copyright (c) 2011 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 PPAPI_C_PRIVATE_PPB_PDF_H_ +#define PPAPI_C_PRIVATE_PPB_PDF_H_ + +#include "ppapi/c/dev/ppb_font_dev.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_module.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_var.h" + +#define PPB_PDF_INTERFACE "PPB_PDF;1" + +// From the public PPB_Font_Dev file. +struct PP_FontDescription_Dev; + +typedef enum { + PP_RESOURCESTRING_PDFGETPASSWORD = 0, + PP_RESOURCESTRING_PDFLOADING = 1, + PP_RESOURCESTRING_PDFLOAD_FAILED = 2, +} PP_ResourceString; + +typedef enum { + PP_RESOURCEIMAGE_PDF_BUTTON_FTH = 0, + PP_RESOURCEIMAGE_PDF_BUTTON_FTH_HOVER = 1, + PP_RESOURCEIMAGE_PDF_BUTTON_FTH_PRESSED = 2, + PP_RESOURCEIMAGE_PDF_BUTTON_FTW = 3, + PP_RESOURCEIMAGE_PDF_BUTTON_FTW_HOVER = 4, + PP_RESOURCEIMAGE_PDF_BUTTON_FTW_PRESSED = 5, + PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMIN = 6, + PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMIN_HOVER = 7, + PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMIN_PRESSED = 8, + PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMOUT = 9, + PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMOUT_HOVER = 10, + PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMOUT_PRESSED = 11, + PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_0 = 12, + PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_1 = 13, + PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_2 = 14, + PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_3 = 15, + PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_4 = 16, + PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_5 = 17, + PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_6 = 18, + PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_7 = 19, + PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_8 = 20, + PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_9 = 21, + PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_NUM_BACKGROUND = 22, +} PP_ResourceImage; + +typedef enum { + PP_PRIVATEFONTCHARSET_ANSI = 0, + PP_PRIVATEFONTCHARSET_DEFAULT = 1, + PP_PRIVATEFONTCHARSET_SYMBOL = 2, + PP_PRIVATEFONTCHARSET_MAC = 77, + PP_PRIVATEFONTCHARSET_SHIFTJIS = 128, + PP_PRIVATEFONTCHARSET_HANGUL = 129, + PP_PRIVATEFONTCHARSET_JOHAB = 130, + PP_PRIVATEFONTCHARSET_GB2312 =134, + PP_PRIVATEFONTCHARSET_CHINESEBIG5 = 136, + PP_PRIVATEFONTCHARSET_GREEK = 161, + PP_PRIVATEFONTCHARSET_TURKISH = 162, + PP_PRIVATEFONTCHARSET_VIETNAMESE = 163, + PP_PRIVATEFONTCHARSET_HEBREW = 177, + PP_PRIVATEFONTCHARSET_ARABIC = 178, + PP_PRIVATEFONTCHARSET_BALTIC = 186, + PP_PRIVATEFONTCHARSET_RUSSIAN = 204, + PP_PRIVATEFONTCHARSET_THAI = 222, + PP_PRIVATEFONTCHARSET_EASTEUROPE = 238, + PP_PRIVATEFONTCHARSET_OEM = 255 +} PP_PrivateFontCharset; + +struct PP_PrivateFontFileDescription { + const char* face; + uint32_t weight; + bool italic; +}; + +struct PP_PrivateFindResult { + int start_index; + int length; +}; + +struct PPB_PDF { + // Returns a localized string. + PP_Var (*GetLocalizedString)(PP_Module module, PP_ResourceString string_id); + + // Returns a resource image. + PP_Resource (*GetResourceImage)(PP_Module module, + PP_ResourceImage image_id); + + // Returns a resource identifying a font file corresponding to the given font + // request after applying the browser-specific fallback. + // + // Currently Linux-only. + PP_Resource (*GetFontFileWithFallback)( + PP_Module module, + const PP_FontDescription_Dev* description, + PP_PrivateFontCharset charset); + + // Given a resource previously returned by GetFontFileWithFallback, returns + // a pointer to the requested font table. Linux only. + bool (*GetFontTableForPrivateFontFile)(PP_Resource font_file, + uint32_t table, + void* output, + uint32_t* output_length); + + // Search the given string using ICU. Use PPB_Core's MemFree on results when + // done. + void (*SearchString)( + PP_Module module, + const unsigned short* string, + const unsigned short* term, + bool case_sensitive, + PP_PrivateFindResult** results, + int* count); + + // Since WebFrame doesn't know about PPAPI requests, it'll think the page has + // finished loading even if there are outstanding requests by the plugin. + // Take this out once WebFrame knows about requests by PPAPI plugins. + void (*DidStartLoading)(PP_Instance instance); + void (*DidStopLoading)(PP_Instance instance); + + // Sets content restriction for a full-page plugin (i.e. can't copy/print). + // The value is a bitfield of ContentRestriction enums. + void (*SetContentRestriction)(PP_Instance instance, int restrictions); + + // Use UMA so we know average pdf page count. + void (*HistogramPDFPageCount)(int count); + + // Notifies the browser that the given action has been performed. + void (*UserMetricsRecordAction)(PP_Var action); +}; + +#endif // PPAPI_C_PRIVATE_PPB_PDF_H_ diff --git a/ppapi/ppapi.gyp b/ppapi/ppapi.gyp index 4af3e9c..2debb57 100644 --- a/ppapi/ppapi.gyp +++ b/ppapi/ppapi.gyp @@ -106,6 +106,7 @@ # Private interfaces. 'c/private/ppb_flash.h', 'c/private/ppb_nacl_private.h', + 'c/private/ppb_pdf.h', # Deprecated interfaces. 'c/dev/deprecated_bool.h', diff --git a/ppapi/proxy/DEPS b/ppapi/proxy/DEPS index b031405..af862c1 100644 --- a/ppapi/proxy/DEPS +++ b/ppapi/proxy/DEPS @@ -2,11 +2,6 @@ include_rules = [ "+base", "+ipc", - # These files are really Chrome-only and we don't want to expose them, but - # we need to use them for the proxy. Allow the code here to pull these - # headers (which don't depend on anything else). - "+webkit/plugins/ppapi/ppb_pdf.h", - # We don't want the proxy to depend on the C++ layer, which is appropriate # for plugins only. However, the completion callback factory is a very useful # tool that we would otherwise have to duplicate, and has no other diff --git a/ppapi/proxy/dispatcher.cc b/ppapi/proxy/dispatcher.cc index 2412a54..d984222 100644 --- a/ppapi/proxy/dispatcher.cc +++ b/ppapi/proxy/dispatcher.cc @@ -33,6 +33,7 @@ #include "ppapi/c/ppb_url_response_info.h" #include "ppapi/c/ppp_instance.h" #include "ppapi/c/private/ppb_flash.h" +#include "ppapi/c/private/ppb_pdf.h" #include "ppapi/c/trusted/ppb_url_loader_trusted.h" #include "ppapi/proxy/ppapi_messages.h" #include "ppapi/proxy/ppb_audio_config_proxy.h" @@ -56,7 +57,6 @@ #include "ppapi/proxy/ppp_class_proxy.h" #include "ppapi/proxy/ppp_instance_proxy.h" #include "ppapi/proxy/var_serialization_rules.h" -#include "webkit/plugins/ppapi/ppb_pdf.h" namespace pp { namespace proxy { diff --git a/ppapi/proxy/ppb_pdf_proxy.cc b/ppapi/proxy/ppb_pdf_proxy.cc index cbd1f31..ddc404c 100644 --- a/ppapi/proxy/ppb_pdf_proxy.cc +++ b/ppapi/proxy/ppb_pdf_proxy.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -11,10 +11,10 @@ #include "base/linked_ptr.h" #include "base/logging.h" #include "build/build_config.h" +#include "ppapi/c/private/ppb_pdf.h" #include "ppapi/proxy/plugin_dispatcher.h" #include "ppapi/proxy/plugin_resource.h" #include "ppapi/proxy/ppapi_messages.h" -#include "webkit/plugins/ppapi/ppb_pdf.h" namespace pp { namespace proxy { diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi index e64f667..ceef497 100644 --- a/webkit/glue/webkit_glue.gypi +++ b/webkit/glue/webkit_glue.gypi @@ -302,7 +302,6 @@ '../plugins/ppapi/ppb_nacl_private_impl.h', '../plugins/ppapi/ppb_opengles_impl.cc', '../plugins/ppapi/ppb_opengles_impl.h', - '../plugins/ppapi/ppb_pdf.h', '../plugins/ppapi/ppb_pdf_impl.cc', '../plugins/ppapi/ppb_pdf_impl.h', '../plugins/ppapi/ppb_scrollbar_impl.cc', diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc index 2f9781d..8afea13 100644 --- a/webkit/plugins/ppapi/plugin_module.cc +++ b/webkit/plugins/ppapi/plugin_module.cc @@ -49,6 +49,7 @@ #include "ppapi/c/ppp.h" #include "ppapi/c/ppp_instance.h" #include "ppapi/c/private/ppb_flash.h" +#include "ppapi/c/private/ppb_pdf.h" #include "ppapi/c/private/ppb_nacl_private.h" #include "ppapi/c/trusted/ppb_image_data_trusted.h" #include "ppapi/c/trusted/ppb_url_loader_trusted.h" @@ -70,7 +71,6 @@ #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" #include "webkit/plugins/ppapi/ppb_image_data_impl.h" #include "webkit/plugins/ppapi/ppb_nacl_private_impl.h" -#include "webkit/plugins/ppapi/ppb_pdf.h" #include "webkit/plugins/ppapi/ppb_pdf_impl.h" #include "webkit/plugins/ppapi/ppb_scrollbar_impl.h" #include "webkit/plugins/ppapi/ppb_transport_impl.h" diff --git a/webkit/plugins/ppapi/ppb_pdf.h b/webkit/plugins/ppapi/ppb_pdf.h deleted file mode 100644 index 38d1763..0000000 --- a/webkit/plugins/ppapi/ppb_pdf.h +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) 2010 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 WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_ -#define WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_ - -#include "ppapi/c/dev/ppb_font_dev.h" -#include "ppapi/c/pp_instance.h" -#include "ppapi/c/pp_module.h" -#include "ppapi/c/pp_resource.h" -#include "ppapi/c/pp_var.h" - -#define PPB_PDF_INTERFACE "PPB_PDF;1" - -// From the public PPB_Font_Dev file. -struct PP_FontDescription_Dev; - -typedef enum { - PP_RESOURCESTRING_PDFGETPASSWORD = 0, - PP_RESOURCESTRING_PDFLOADING = 1, - PP_RESOURCESTRING_PDFLOAD_FAILED = 2, -} PP_ResourceString; - -typedef enum { - PP_RESOURCEIMAGE_PDF_BUTTON_FTH = 0, - PP_RESOURCEIMAGE_PDF_BUTTON_FTH_HOVER = 1, - PP_RESOURCEIMAGE_PDF_BUTTON_FTH_PRESSED = 2, - PP_RESOURCEIMAGE_PDF_BUTTON_FTW = 3, - PP_RESOURCEIMAGE_PDF_BUTTON_FTW_HOVER = 4, - PP_RESOURCEIMAGE_PDF_BUTTON_FTW_PRESSED = 5, - PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMIN = 6, - PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMIN_HOVER = 7, - PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMIN_PRESSED = 8, - PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMOUT = 9, - PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMOUT_HOVER = 10, - PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMOUT_PRESSED = 11, - PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_0 = 12, - PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_1 = 13, - PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_2 = 14, - PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_3 = 15, - PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_4 = 16, - PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_5 = 17, - PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_6 = 18, - PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_7 = 19, - PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_8 = 20, - PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_9 = 21, - PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_NUM_BACKGROUND = 22, -} PP_ResourceImage; - -typedef enum { - PP_PRIVATEFONTCHARSET_ANSI = 0, - PP_PRIVATEFONTCHARSET_DEFAULT = 1, - PP_PRIVATEFONTCHARSET_SYMBOL = 2, - PP_PRIVATEFONTCHARSET_MAC = 77, - PP_PRIVATEFONTCHARSET_SHIFTJIS = 128, - PP_PRIVATEFONTCHARSET_HANGUL = 129, - PP_PRIVATEFONTCHARSET_JOHAB = 130, - PP_PRIVATEFONTCHARSET_GB2312 =134, - PP_PRIVATEFONTCHARSET_CHINESEBIG5 = 136, - PP_PRIVATEFONTCHARSET_GREEK = 161, - PP_PRIVATEFONTCHARSET_TURKISH = 162, - PP_PRIVATEFONTCHARSET_VIETNAMESE = 163, - PP_PRIVATEFONTCHARSET_HEBREW = 177, - PP_PRIVATEFONTCHARSET_ARABIC = 178, - PP_PRIVATEFONTCHARSET_BALTIC = 186, - PP_PRIVATEFONTCHARSET_RUSSIAN = 204, - PP_PRIVATEFONTCHARSET_THAI = 222, - PP_PRIVATEFONTCHARSET_EASTEUROPE = 238, - PP_PRIVATEFONTCHARSET_OEM = 255 -} PP_PrivateFontCharset; - -struct PP_PrivateFontFileDescription { - const char* face; - uint32_t weight; - bool italic; -}; - -struct PP_PrivateFindResult { - int start_index; - int length; -}; - -struct PPB_PDF { - // Returns a localized string. - PP_Var (*GetLocalizedString)(PP_Module module, PP_ResourceString string_id); - - // Returns a resource image. - PP_Resource (*GetResourceImage)(PP_Module module, - PP_ResourceImage image_id); - - // Returns a resource identifying a font file corresponding to the given font - // request after applying the browser-specific fallback. - // - // Currently Linux-only. - PP_Resource (*GetFontFileWithFallback)( - PP_Module module, - const PP_FontDescription_Dev* description, - PP_PrivateFontCharset charset); - - // Given a resource previously returned by GetFontFileWithFallback, returns - // a pointer to the requested font table. Linux only. - bool (*GetFontTableForPrivateFontFile)(PP_Resource font_file, - uint32_t table, - void* output, - uint32_t* output_length); - - // Search the given string using ICU. Use PPB_Core's MemFree on results when - // done. - void (*SearchString)( - PP_Module module, - const unsigned short* string, - const unsigned short* term, - bool case_sensitive, - PP_PrivateFindResult** results, - int* count); - - // Since WebFrame doesn't know about PPAPI requests, it'll think the page has - // finished loading even if there are outstanding requests by the plugin. - // Take this out once WebFrame knows about requests by PPAPI plugins. - void (*DidStartLoading)(PP_Instance instance); - void (*DidStopLoading)(PP_Instance instance); - - // Sets content restriction for a full-page plugin (i.e. can't copy/print). - // The value is a bitfield of ContentRestriction enums. - void (*SetContentRestriction)(PP_Instance instance, int restrictions); - - // Use UMA so we know average pdf page count. - void (*HistogramPDFPageCount)(int count); - - // Notifies the browser that the given action has been performed. - void (*UserMetricsRecordAction)(PP_Var action); -}; - -#endif // WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_ diff --git a/webkit/plugins/ppapi/ppb_pdf_impl.cc b/webkit/plugins/ppapi/ppb_pdf_impl.cc index 6bcfc08..ee58aef 100644 --- a/webkit/plugins/ppapi/ppb_pdf_impl.cc +++ b/webkit/plugins/ppapi/ppb_pdf_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -12,6 +12,7 @@ #include "grit/webkit_strings.h" #include "skia/ext/platform_canvas.h" #include "ppapi/c/pp_resource.h" +#include "ppapi/c/private/ppb_pdf.h" #include "third_party/skia/include/core/SkBitmap.h" #include "unicode/usearch.h" #include "webkit/glue/webkit_glue.h" @@ -19,7 +20,6 @@ #include "webkit/plugins/ppapi/plugin_module.h" #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" #include "webkit/plugins/ppapi/ppb_image_data_impl.h" -#include "webkit/plugins/ppapi/ppb_pdf.h" #include "webkit/plugins/ppapi/var.h" namespace webkit { -- cgit v1.1