diff --git a/components/pdf.gypi b/components/pdf.gypi index c9346171c932f4..ead16466ae0c78 100644 --- a/components/pdf.gypi +++ b/components/pdf.gypi @@ -49,8 +49,6 @@ 'pdf_common', ], 'sources': [ - 'pdf/renderer/pdf_resource_util.cc', - 'pdf/renderer/pdf_resource_util.h', 'pdf/renderer/pepper_pdf_host.cc', 'pdf/renderer/pepper_pdf_host.h', ], diff --git a/components/pdf/renderer/BUILD.gn b/components/pdf/renderer/BUILD.gn index f11c2f6102d6d3..966ba98beeb61c 100644 --- a/components/pdf/renderer/BUILD.gn +++ b/components/pdf/renderer/BUILD.gn @@ -6,8 +6,6 @@ import("//build/config/features.gni") static_library("renderer") { sources = [ - "pdf_resource_util.cc", - "pdf_resource_util.h", "pepper_pdf_host.cc", "pepper_pdf_host.h", ] diff --git a/components/pdf/renderer/pdf_resource_util.cc b/components/pdf/renderer/pdf_resource_util.cc deleted file mode 100644 index 5494fc65cb5d00..00000000000000 --- a/components/pdf/renderer/pdf_resource_util.cc +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2014 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. - -#include "components/pdf/renderer/pdf_resource_util.h" - -#include "base/strings/utf_string_conversions.h" -#include "components/strings/grit/components_strings.h" -#include "grit/components_scaled_resources.h" -#include "ui/base/l10n/l10n_util.h" -#include "ui/base/resource/resource_bundle.h" - -namespace pdf { - -std::string GetStringResource(PP_ResourceString string_id) { - int resource_id = 0; - switch (string_id) { - case PP_RESOURCESTRING_PDFGETPASSWORD: - resource_id = IDS_PDF_NEED_PASSWORD; - break; - case PP_RESOURCESTRING_PDFLOADING: - resource_id = IDS_PDF_PAGE_LOADING; - break; - case PP_RESOURCESTRING_PDFLOAD_FAILED: - resource_id = IDS_PDF_PAGE_LOAD_FAILED; - break; - case PP_RESOURCESTRING_PDFPROGRESSLOADING: - resource_id = IDS_PDF_PROGRESS_LOADING; - break; - } - - return l10n_util::GetStringUTF8(resource_id); -} - -} // namespace pdf diff --git a/components/pdf/renderer/pdf_resource_util.h b/components/pdf/renderer/pdf_resource_util.h deleted file mode 100644 index c9007f50e1eb04..00000000000000 --- a/components/pdf/renderer/pdf_resource_util.h +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2014 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 COMPONENTS_PDF_RENDERER_PDF_RESOURCE_UTIL_H_ -#define COMPONENTS_PDF_RENDERER_PDF_RESOURCE_UTIL_H_ - -#include - -#include "ppapi/c/private/ppb_pdf.h" - -namespace pdf { - -std::string GetStringResource(PP_ResourceString string_id); - -} // namespace pdf - -#endif // COMPONENTS_PDF_RENDERER_PDF_RESOURCE_UTIL_H_ diff --git a/components/pdf/renderer/pepper_pdf_host.cc b/components/pdf/renderer/pepper_pdf_host.cc index dfe8f31a3135e2..5714d26acbbd3b 100644 --- a/components/pdf/renderer/pepper_pdf_host.cc +++ b/components/pdf/renderer/pepper_pdf_host.cc @@ -5,7 +5,7 @@ #include "components/pdf/renderer/pepper_pdf_host.h" #include "components/pdf/common/pdf_messages.h" -#include "components/pdf/renderer/pdf_resource_util.h" +#include "components/strings/grit/components_strings.h" #include "content/public/common/referrer.h" #include "content/public/renderer/pepper_plugin_instance.h" #include "content/public/renderer/render_thread.h" @@ -26,7 +26,9 @@ #include "third_party/WebKit/public/web/WebLocalFrame.h" #include "third_party/WebKit/public/web/WebPluginContainer.h" #include "third_party/WebKit/public/web/WebView.h" +#include "ui/base/l10n/l10n_util.h" #include "ui/base/layout.h" +#include "ui/base/resource/resource_bundle.h" #include "ui/gfx/geometry/point.h" namespace pdf { @@ -38,6 +40,26 @@ namespace { base::LazyInstance>::Leaky g_print_client_tls = LAZY_INSTANCE_INITIALIZER; +std::string GetStringResource(PP_ResourceString string_id) { + int resource_id = 0; + switch (string_id) { + case PP_RESOURCESTRING_PDFGETPASSWORD: + resource_id = IDS_PDF_NEED_PASSWORD; + break; + case PP_RESOURCESTRING_PDFLOADING: + resource_id = IDS_PDF_PAGE_LOADING; + break; + case PP_RESOURCESTRING_PDFLOAD_FAILED: + resource_id = IDS_PDF_PAGE_LOAD_FAILED; + break; + case PP_RESOURCESTRING_PDFPROGRESSLOADING: + resource_id = IDS_PDF_PROGRESS_LOADING; + break; + } + + return l10n_util::GetStringUTF8(resource_id); +} + } // namespace PepperPDFHost::PepperPDFHost(content::RendererPpapiHost* host, diff --git a/ppapi/api/private/finish_writing_these/ppb_pdf.idl b/ppapi/api/private/finish_writing_these/ppb_pdf.idl deleted file mode 100644 index 20e077f346a138..00000000000000 --- a/ppapi/api/private/finish_writing_these/ppb_pdf.idl +++ /dev/null @@ -1,165 +0,0 @@ -/* Copyright (c) 2012 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. - */ - -/* This file contains PPB_PDF interface. */ - -enum PP_ResourceString{ - PP_RESOURCESTRING_PDFGETPASSWORD = 0, - PP_RESOURCESTRING_PDFLOADING = 1, - PP_RESOURCESTRING_PDFLOAD_FAILED = 2 -}; - -enum PP_ResourceImage{ - 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 -}; - -enum PP_PrivateFontCharset { - 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 -}; - -struct PP_PrivateFontFileDescription { - str_t face; - uint32_t weight; - PP_Bool italic; -}; - -struct PP_PrivateFindResult { - int32_t start_index; - int32_t length; -}; - -interface PPB_PDF_0_1 { - /* Returns a localized string. */ - PP_Var GetLocalizedString( - [in] PP_Instance instance, - [in] PP_ResourceString string_id); - - /* Returns a resource image. */ - PP_Resource GetResourceImage( - [in] PP_Instance instance, - [in] 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( - [in] PP_Instance instance, - [in] PP_FontDescription_Dev description, - [in] PP_PrivateFontCharset charset); - - /* Given a resource previously returned by GetFontFileWithFallback, returns - * a pointer to the requested font table. Linux only. - */ - PP_Bool GetFontTableForPrivateFontFile( - [in] PP_Resource font_file, - [in] uint32_t table, - [out] mem_t output, - [out] uint32_t output_length); - - /* Search the given string using ICU. Use PPB_Core's MemFree on results when - * done. - */ - void SearchString( - [in] PP_Instance instance, - [in] mem_t string, - [in] mem_t term, - [in] PP_Bool case_sensitive, - [out, size_is(count)] PP_PrivateFindResult[] results, - [out] int32_t 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( - [in] PP_Instance instance); - void DidStopLoading( - [in] 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( - [in] PP_Instance instance, - [in] int32_t restrictions); - - /* Use UMA so we know average pdf page count. */ - void HistogramPDFPageCount( - [in] int32_t count); - - /* Notifies the browser that the given action has been performed. */ - void UserMetricsRecordAction( - [in] PP_Var action); - - /* Notifies the browser that the PDF has an unsupported feature. */ - void HasUnsupportedFeature( - [in] PP_Instance instance); - - /* Tells the browser to open a dialog box to receive a password from the - * user, masking input characters. Returns the value entered by the user, or - * an empty string if the user cancels instead. - */ - PP_Var ModalPromptForPassword( - [in] PP_Instance instance, - [in] PP_Var message); - - /* Returns PP_TRUE if the plugin is out of process. */ - PP_Bool IsOutOfProcess( - [in] PP_Instance instance); - - /* Sets the selected text of the plugin. If |selected_text| is empty, then no - * text is selected. */ - void SetSelectedText( - [in] PP_Instance instance, - [in] str_t selected_text); - - /* Sets the link under the cursor. If |url| is empty, then no link is under - * the cursor. */ - void SetLinkUnderCursor( - [in] PP_Instance instance, - [in] str_t url); -}; diff --git a/ppapi/c/private/ppb_pdf.h b/ppapi/c/private/ppb_pdf.h index 3e708ddecc0321..bedb77ac4eca5f 100644 --- a/ppapi/c/private/ppb_pdf.h +++ b/ppapi/c/private/ppb_pdf.h @@ -24,55 +24,6 @@ typedef enum { PP_RESOURCESTRING_PDFPROGRESSLOADING = 3 } PP_ResourceString; -typedef enum { - PP_RESOURCEIMAGE_PDF_BUTTON_FTP = 0, - PP_RESOURCEIMAGE_PDF_BUTTON_FTP_HOVER = 1, - PP_RESOURCEIMAGE_PDF_BUTTON_FTP_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_PDF_PROGRESS_BAR_0 = 23, - PP_RESOURCEIMAGE_PDF_PROGRESS_BAR_1 = 24, - PP_RESOURCEIMAGE_PDF_PROGRESS_BAR_2 = 25, - PP_RESOURCEIMAGE_PDF_PROGRESS_BAR_3 = 26, - PP_RESOURCEIMAGE_PDF_PROGRESS_BAR_4 = 27, - PP_RESOURCEIMAGE_PDF_PROGRESS_BAR_5 = 28, - PP_RESOURCEIMAGE_PDF_PROGRESS_BAR_6 = 29, - PP_RESOURCEIMAGE_PDF_PROGRESS_BAR_7 = 30, - PP_RESOURCEIMAGE_PDF_PROGRESS_BAR_8 = 31, - PP_RESOURCEIMAGE_PDF_PROGRESS_BAR_BACKGROUND = 32, - PP_RESOURCEIMAGE_PDF_PAGE_DROPSHADOW = 33, - PP_RESOURCEIMAGE_PDF_BUTTON_SAVE = 34, - PP_RESOURCEIMAGE_PDF_BUTTON_SAVE_HOVER = 35, - PP_RESOURCEIMAGE_PDF_BUTTON_SAVE_PRESSED = 36, - PP_RESOURCEIMAGE_PDF_BUTTON_PRINT = 37, - PP_RESOURCEIMAGE_PDF_BUTTON_PRINT_HOVER = 38, - PP_RESOURCEIMAGE_PDF_BUTTON_PRINT_PRESSED = 39, - PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMIN_END = 40, - PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMIN_END_HOVER = 41, - PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMIN_END_PRESSED = 42, - PP_RESOURCEIMAGE_PDF_PAN_SCROLL_ICON = 43, - PP_RESOURCEIMAGE_PDF_PAGE_INDICATOR_BACKGROUND = 44, - PP_RESOURCEIMAGE_PDF_BUTTON_PRINT_DISABLED = 45 -} PP_ResourceImage; - typedef enum { PP_PDFFEATURE_HIDPI = 0, PP_PDFFEATURE_PRINTING = 1 @@ -94,10 +45,6 @@ struct PPB_PDF { struct PP_Var (*GetLocalizedString)(PP_Instance instance, PP_ResourceString string_id); - // Returns a resource image. - PP_Resource (*GetResourceImage)(PP_Instance instance, - PP_ResourceImage image_id); - // Returns a resource identifying a font file corresponding to the given font // request after applying the browser-specific fallback. // @@ -134,9 +81,6 @@ struct PPB_PDF { // 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)(PP_Instance instance, int count); - // Notifies the browser that the given action has been performed. void (*UserMetricsRecordAction)(PP_Instance instance, struct PP_Var action); @@ -151,19 +95,6 @@ struct PPB_PDF { PP_Bool(*IsFeatureEnabled)(PP_Instance instance, PP_PDFFeature feature); - // Returns a resource image appropriate for a device with |scale| density. - // Returns 0 (NULL resource) if there is no resource at that scale - PP_Resource (*GetResourceImageForScale)(PP_Instance instance, - PP_ResourceImage image_id, - float scale); - - // Invoke password dialog for plugin. - struct PP_Var (*ModalPromptForPassword)(PP_Instance instance, - struct PP_Var message); - - // Returns PP_TRUE if the plugin is out of process. - PP_Bool (*IsOutOfProcess)(PP_Instance instance); - // Sets the selected text of the plugin. void(*SetSelectedText)(PP_Instance instance, const char* selected_text); diff --git a/ppapi/cpp/private/pdf.cc b/ppapi/cpp/private/pdf.cc index 17b0b4d2a71294..24127f10689504 100644 --- a/ppapi/cpp/private/pdf.cc +++ b/ppapi/cpp/private/pdf.cc @@ -36,17 +36,6 @@ Var PDF::GetLocalizedString(const InstanceHandle& instance, return Var(); } -// static -ImageData PDF::GetResourceImage(const InstanceHandle& instance, - PP_ResourceImage image_id) { - if (has_interface()) { - return ImageData(PASS_REF, - get_interface()->GetResourceImage( - instance.pp_instance(), image_id)); - } - return ImageData(); -} - // static PP_Resource PDF::GetFontFileWithFallback( const InstanceHandle& instance, @@ -105,14 +94,6 @@ void PDF::SetContentRestriction(const InstanceHandle& instance, } } -// static -void PDF::HistogramPDFPageCount(const InstanceHandle& instance, - int count) { - if (has_interface()) - get_interface()->HistogramPDFPageCount(instance.pp_instance(), - count); -} - // static void PDF::UserMetricsRecordAction(const InstanceHandle& instance, const Var& action) { @@ -149,39 +130,6 @@ bool PDF::IsFeatureEnabled(const InstanceHandle& instance, return false; } -// static -ImageData PDF::GetResourceImageForScale(const InstanceHandle& instance, - PP_ResourceImage image_id, - float scale) { - if (has_interface()) { - return ImageData(PASS_REF, - get_interface()->GetResourceImageForScale( - instance.pp_instance(), image_id, scale)); - } - return ImageData(); -} - -// static -Var PDF::ModalPromptForPassword(const InstanceHandle& instance, - Var message) { - if (has_interface()) { - return Var(PASS_REF, - get_interface()->ModalPromptForPassword( - instance.pp_instance(), - message.pp_var())); - } - return Var(); -} - -// static -bool PDF::IsOutOfProcess(const InstanceHandle& instance) { - if (has_interface()) { - return PP_ToBool(get_interface()->IsOutOfProcess( - instance.pp_instance())); - } - return false; -} - // static void PDF::SetSelectedText(const InstanceHandle& instance, const char* selected_text) { diff --git a/ppapi/cpp/private/pdf.h b/ppapi/cpp/private/pdf.h index 160c826426937f..48ba668e3f9acd 100644 --- a/ppapi/cpp/private/pdf.h +++ b/ppapi/cpp/private/pdf.h @@ -24,8 +24,6 @@ class PDF { static Var GetLocalizedString(const InstanceHandle& instance, PP_ResourceString string_id); - static ImageData GetResourceImage(const InstanceHandle& instance, - PP_ResourceImage image_id); static PP_Resource GetFontFileWithFallback( const InstanceHandle& instance, const PP_BrowserFont_Trusted_Description* description, @@ -44,8 +42,6 @@ class PDF { static void DidStopLoading(const InstanceHandle& instance); static void SetContentRestriction(const InstanceHandle& instance, int restrictions); - static void HistogramPDFPageCount(const InstanceHandle& instance, - int count); static void UserMetricsRecordAction(const InstanceHandle& instance, const Var& action); static void HasUnsupportedFeature(const InstanceHandle& instance); @@ -53,12 +49,6 @@ class PDF { static void Print(const InstanceHandle& instance); static bool IsFeatureEnabled(const InstanceHandle& instance, PP_PDFFeature feature); - static ImageData GetResourceImageForScale(const InstanceHandle& instance, - PP_ResourceImage image_id, - float scale); - static Var ModalPromptForPassword(const InstanceHandle& instance, - Var message); - static bool IsOutOfProcess(const InstanceHandle& instance); static void SetSelectedText(const InstanceHandle& instance, const char* selected_text); static void SetLinkUnderCursor(const InstanceHandle& instance, diff --git a/ppapi/proxy/pdf_resource.cc b/ppapi/proxy/pdf_resource.cc index a735d4334d92cf..ed3dcde9b73f16 100644 --- a/ppapi/proxy/pdf_resource.cc +++ b/ppapi/proxy/pdf_resource.cc @@ -14,7 +14,6 @@ #include "ppapi/c/pp_errors.h" #include "ppapi/c/private/ppb_pdf.h" #include "ppapi/proxy/ppapi_messages.h" -#include "ppapi/proxy/ppb_image_data_proxy.h" #include "ppapi/shared_impl/var.h" #include "third_party/icu/source/i18n/unicode/usearch.h" @@ -125,10 +124,6 @@ void PDFResource::SetContentRestriction(int restrictions) { Post(RENDERER, PpapiHostMsg_PDF_SetContentRestriction(restrictions)); } -void PDFResource::HistogramPDFPageCount(int count) { - UMA_HISTOGRAM_COUNTS_10000("PDF.PageCount", count); -} - void PDFResource::UserMetricsRecordAction(const PP_Var& action) { scoped_refptr action_str( ppapi::StringVar::FromPPVar(action)); @@ -164,42 +159,6 @@ PP_Bool PDFResource::IsFeatureEnabled(PP_PDFFeature feature) { return result; } -PP_Resource PDFResource::GetResourceImageForScale(PP_ResourceImage image_id, - float scale) { - IPC::Message reply; - ResourceMessageReplyParams reply_params; - int32_t result = GenericSyncCall( - RENDERER, PpapiHostMsg_PDF_GetResourceImage(image_id, scale), &reply, - &reply_params); - if (result != PP_OK) - return 0; - - HostResource resource; - PP_ImageDataDesc image_desc; - if (!UnpackMessage( - reply, &resource, &image_desc)) { - return 0; - } - - if (resource.is_null()) - return 0; - if (!PPB_ImageData_Shared::IsImageDataDescValid(image_desc)) - return 0; - - base::SharedMemoryHandle handle; - if (!reply_params.TakeSharedMemoryHandleAtIndex(0, &handle)) - return 0; - return (new SimpleImageData(resource, image_desc, handle))->GetReference(); -} - -PP_Resource PDFResource::GetResourceImage(PP_ResourceImage image_id) { - return GetResourceImageForScale(image_id, 1.0f); -} - -PP_Bool PDFResource::IsOutOfProcess() { - return PP_TRUE; -} - void PDFResource::SetSelectedText(const char* selected_text) { Post(RENDERER, PpapiHostMsg_PDF_SetSelectedText(base::UTF8ToUTF16(selected_text))); diff --git a/ppapi/proxy/pdf_resource.h b/ppapi/proxy/pdf_resource.h index f68c1a2d89544d..c701f8a9c97ca6 100644 --- a/ppapi/proxy/pdf_resource.h +++ b/ppapi/proxy/pdf_resource.h @@ -9,7 +9,6 @@ #include "base/compiler_specific.h" #include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_var.h" -#include "ppapi/c/private/ppb_flash.h" #include "ppapi/proxy/connection.h" #include "ppapi/proxy/plugin_resource.h" #include "ppapi/proxy/ppapi_proxy_export.h" @@ -45,16 +44,11 @@ class PPAPI_PROXY_EXPORT PDFResource void DidStartLoading() override; void DidStopLoading() override; void SetContentRestriction(int restrictions) override; - void HistogramPDFPageCount(int count) override; void UserMetricsRecordAction(const PP_Var& action) override; void HasUnsupportedFeature() override; void Print() override; void SaveAs() override; PP_Bool IsFeatureEnabled(PP_PDFFeature feature) override; - PP_Resource GetResourceImageForScale(PP_ResourceImage image_id, - float scale) override; - PP_Resource GetResourceImage(PP_ResourceImage image_id) override; - PP_Bool IsOutOfProcess() override; void SetSelectedText(const char* selected_text) override; void SetLinkUnderCursor(const char* url) override; void GetV8ExternalSnapshotData(const char** natives_data_out, diff --git a/ppapi/proxy/pdf_resource_unittest.cc b/ppapi/proxy/pdf_resource_unittest.cc index 62fcea877bc1b5..0b228722ff2cfd 100644 --- a/ppapi/proxy/pdf_resource_unittest.cc +++ b/ppapi/proxy/pdf_resource_unittest.cc @@ -156,51 +156,5 @@ TEST_F(PDFResourceTest, SaveAs) { PpapiHostMsg_PDF_SaveAs::ID, ¶ms, &msg)); } -TEST_F(PDFResourceTest, GetResourceImageForScale) { - const PPB_PDF* pdf_iface = thunk::GetPPB_PDF_Thunk(); - - HostResource expected_resource; - expected_resource.SetHostResource(pp_instance(), 5); - PP_ImageDataDesc expected_desc = { - PP_IMAGEDATAFORMAT_BGRA_PREMUL, - { 5, 10 }, - 20, - }; - SerializedHandle serialized_handle(SerializedHandle::SHARED_MEMORY); - PpapiPluginMsg_PDF_GetResourceImageReply reply_msg(expected_resource, - expected_desc); - ResourceSyncCallHandler handler( - &sink(), - PpapiHostMsg_PDF_GetResourceImage::ID, - PP_OK, - reply_msg); - handler.set_serialized_handle(&serialized_handle); - sink().AddFilter(&handler); - - PP_Resource resource = pdf_iface->GetResourceImageForScale(pp_instance(), - PP_RESOURCEIMAGE_PDF_BUTTON_FTP, 1.0f); - { - ProxyAutoLock lock; - PluginResourceTracker* resource_tracker = - static_cast( - PluginGlobals::Get()->GetResourceTracker()); - Resource* resource_object = resource_tracker->GetResource(resource); - ImageData* image_data_object = static_cast(resource_object); - PP_ImageDataDesc actual_desc = image_data_object->desc(); - ASSERT_EQ(expected_desc.format, actual_desc.format); - ASSERT_EQ(expected_desc.size.width, actual_desc.size.width); - ASSERT_EQ(expected_desc.size.height, actual_desc.size.height); - ASSERT_EQ(expected_desc.stride, actual_desc.stride); - - ASSERT_EQ(resource_tracker->PluginResourceForHostResource( - expected_resource), resource); - - resource_tracker->ReleaseResource(resource); - } - - // Remove the filter or it will be destroyed before the sink() is destroyed. - sink().RemoveFilter(&handler); -} - } // namespace proxy } // namespace ppapi diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h index 8a2aeeaca1cb6c..2308a156feab27 100644 --- a/ppapi/proxy/ppapi_messages.h +++ b/ppapi/proxy/ppapi_messages.h @@ -115,7 +115,6 @@ IPC_ENUM_TRAITS(PP_PrintOutputFormat_Dev) IPC_ENUM_TRAITS(PP_PrintScalingOption_Dev) IPC_ENUM_TRAITS_MAX_VALUE(PP_PrivateDuplexMode_Dev, PP_PRIVATEDUPLEXMODE_LAST) IPC_ENUM_TRAITS(PP_PrivateFontCharset) -IPC_ENUM_TRAITS(PP_ResourceImage) IPC_ENUM_TRAITS(PP_ResourceString) IPC_ENUM_TRAITS_MAX_VALUE(PP_SessionType, PP_SESSIONTYPE_PERSISTENT_RELEASE) IPC_ENUM_TRAITS_MAX_VALUE(PP_TCPSocket_Option, @@ -2307,18 +2306,6 @@ IPC_MESSAGE_CONTROL0(PpapiHostMsg_PDF_Print) // Notifies the renderer to save the current PDF. IPC_MESSAGE_CONTROL0(PpapiHostMsg_PDF_SaveAs) -// Requests a resource image for the plugin at a particular scale. -IPC_MESSAGE_CONTROL2(PpapiHostMsg_PDF_GetResourceImage, - PP_ResourceImage /* image_id */, - float /* scale */) - -// Reply for PpapiHostMsg_PDF_GetResourceImage containing the host resource id -// of the image and a PP_ImageDataDesc which describes the image. Also carries -// a shared memory handle pointing to the memory containg the image. -IPC_MESSAGE_CONTROL2(PpapiPluginMsg_PDF_GetResourceImageReply, - ppapi::HostResource /* resource_id */, - PP_ImageDataDesc /* image_data_desc */) - // Called by the plugin when its selection changes. IPC_MESSAGE_CONTROL1(PpapiHostMsg_PDF_SetSelectedText, base::string16 /* selected_text */) diff --git a/ppapi/thunk/ppb_pdf_api.h b/ppapi/thunk/ppb_pdf_api.h index 8e0f4b0b3de201..7ffaf545eb708d 100644 --- a/ppapi/thunk/ppb_pdf_api.h +++ b/ppapi/thunk/ppb_pdf_api.h @@ -14,7 +14,6 @@ namespace thunk { class PPB_PDF_API { public: virtual PP_Var GetLocalizedString(PP_ResourceString string_id) = 0; - virtual PP_Resource GetResourceImage(PP_ResourceImage image_id) = 0; virtual void SearchString(const unsigned short* input_string, const unsigned short* input_term, bool case_sensitive, @@ -23,15 +22,11 @@ class PPB_PDF_API { virtual void DidStartLoading() = 0; virtual void DidStopLoading() = 0; virtual void SetContentRestriction(int restrictions) = 0; - virtual void HistogramPDFPageCount(int count) = 0; virtual void UserMetricsRecordAction(const PP_Var& action) = 0; virtual void HasUnsupportedFeature() = 0; virtual void SaveAs() = 0; virtual PP_Bool IsFeatureEnabled(PP_PDFFeature feature) = 0; virtual void Print() = 0; - virtual PP_Resource GetResourceImageForScale(PP_ResourceImage image_id, - float scale) = 0; - virtual PP_Bool IsOutOfProcess() = 0; virtual void SetSelectedText(const char* selected_text) = 0; virtual void SetLinkUnderCursor(const char* url) = 0; virtual void GetV8ExternalSnapshotData(const char** natives_data_out, diff --git a/ppapi/thunk/ppb_pdf_thunk.cc b/ppapi/thunk/ppb_pdf_thunk.cc index fb06a90fe2b72b..05c397ce8f9f70 100644 --- a/ppapi/thunk/ppb_pdf_thunk.cc +++ b/ppapi/thunk/ppb_pdf_thunk.cc @@ -23,14 +23,6 @@ PP_Var GetLocalizedString(PP_Instance instance, PP_ResourceString string_id) { return enter.functions()->GetLocalizedString(string_id); } -PP_Resource GetResourceImage(PP_Instance instance, - PP_ResourceImage image_id) { - EnterInstanceAPI enter(instance); - if (enter.failed()) - return 0; - return enter.functions()->GetResourceImage(image_id); -} - PP_Resource GetFontFileWithFallback( PP_Instance instance, const PP_BrowserFont_Trusted_Description* description, @@ -87,12 +79,6 @@ void SetContentRestriction(PP_Instance instance, int restrictions) { enter.functions()->SetContentRestriction(restrictions); } -void HistogramPDFPageCount(PP_Instance instance, int count) { - EnterInstanceAPI enter(instance); - if (enter.succeeded()) - enter.functions()->HistogramPDFPageCount(count); -} - void UserMetricsRecordAction(PP_Instance instance, PP_Var action) { EnterInstanceAPI enter(instance); if (enter.succeeded()) @@ -124,29 +110,6 @@ PP_Bool IsFeatureEnabled(PP_Instance instance, PP_PDFFeature feature) { return enter.functions()->IsFeatureEnabled(feature); } -PP_Resource GetResourceImageForScale(PP_Instance instance, - PP_ResourceImage image_id, - float scale) { - EnterInstanceAPI enter(instance); - if (enter.failed()) - return 0; - return enter.functions()->GetResourceImageForScale(image_id, scale); -} - -PP_Var ModalPromptForPassword(PP_Instance instance_id, - PP_Var message) { - // TODO(raymes): Implement or remove this function. - NOTIMPLEMENTED(); - return PP_MakeUndefined(); -} - -PP_Bool IsOutOfProcess(PP_Instance instance) { - EnterInstanceAPI enter(instance); - if (enter.failed()) - return PP_FALSE; - return enter.functions()->IsOutOfProcess(); -} - void SetSelectedText(PP_Instance instance, const char* selected_text) { EnterInstanceAPI enter(instance); @@ -175,22 +138,17 @@ void GetV8ExternalSnapshotData(PP_Instance instance, const PPB_PDF g_ppb_pdf_thunk = { &GetLocalizedString, - &GetResourceImage, &GetFontFileWithFallback, &GetFontTableForPrivateFontFile, &SearchString, &DidStartLoading, &DidStopLoading, &SetContentRestriction, - &HistogramPDFPageCount, &UserMetricsRecordAction, &HasUnsupportedFeature, &SaveAs, &Print, &IsFeatureEnabled, - &GetResourceImageForScale, - &ModalPromptForPassword, - &IsOutOfProcess, &SetSelectedText, &SetLinkUnderCursor, &GetV8ExternalSnapshotData,