From 5c0b09e2e9f54ced8a020dc2d9ae381089d7a049 Mon Sep 17 00:00:00 2001 From: tsergeant Date: Thu, 17 Sep 2015 21:10:05 -0700 Subject: PDF: Use chrome.resourcesPrivate instead of Pepper to display translated strings This new API is significantly simpler, and easier to add new strings to. BUG=506035 Review URL: https://codereview.chromium.org/1329213002 Cr-Commit-Position: refs/heads/master@{#349611} --- pdf/out_of_process_instance.cc | 26 -------------------------- pdf/out_of_process_instance.h | 2 -- 2 files changed, 28 deletions(-) (limited to 'pdf') diff --git a/pdf/out_of_process_instance.cc b/pdf/out_of_process_instance.cc index 0c0124e..3478b78 100644 --- a/pdf/out_of_process_instance.cc +++ b/pdf/out_of_process_instance.cc @@ -103,11 +103,6 @@ const char kJSPreviewPageIndex[] = "index"; const char kJSSetScrollPositionType[] = "setScrollPosition"; const char kJSPositionX[] = "x"; const char kJSPositionY[] = "y"; -// Set translated strings (Plugin -> Page) -const char kJSSetTranslatedStringsType[] = "setTranslatedStrings"; -const char kJSGetPasswordString[] = "getPasswordString"; -const char kJSLoadingString[] = "loadingString"; -const char kJSLoadFailedString[] = "loadFailedString"; // Request accessibility JSON data (Page -> Plugin) const char kJSGetAccessibilityJSONType[] = "getAccessibilityJSON"; const char kJSAccessibilityPageNumber[] = "page"; @@ -328,19 +323,6 @@ bool OutOfProcessInstance::Init(uint32_t argc, if (full_) SetPluginToHandleFindRequests(); - // Send translated strings to the extension where they will be displayed. - // TODO(raymes): It would be better to get these in the extension directly - // through an API but no such API currently exists. - pp::VarDictionary translated_strings; - translated_strings.Set(kType, kJSSetTranslatedStringsType); - translated_strings.Set(kJSGetPasswordString, - GetLocalizedString(PP_RESOURCESTRING_PDFGETPASSWORD)); - translated_strings.Set(kJSLoadingString, - GetLocalizedString(PP_RESOURCESTRING_PDFLOADING)); - translated_strings.Set(kJSLoadFailedString, - GetLocalizedString(PP_RESOURCESTRING_PDFLOAD_FAILED)); - PostMessage(translated_strings); - text_input_.reset(new pp::TextInput_Dev(this)); const char* stream_url = nullptr; @@ -1359,14 +1341,6 @@ void OutOfProcessInstance::SetZoom(double scale) { OnGeometryChanged(old_zoom, device_scale_); } -std::string OutOfProcessInstance::GetLocalizedString(PP_ResourceString id) { - pp::Var rv(pp::PDF::GetLocalizedString(this, id)); - if (!rv.is_string()) - return std::string(); - - return rv.AsString(); -} - void OutOfProcessInstance::AppendBlankPrintPreviewPages() { if (print_preview_page_count_ == 0) return; diff --git a/pdf/out_of_process_instance.h b/pdf/out_of_process_instance.h index e763134..69c5bc3 100644 --- a/pdf/out_of_process_instance.h +++ b/pdf/out_of_process_instance.h @@ -169,8 +169,6 @@ class OutOfProcessInstance : public pp::Instance, void FormDidOpen(int32_t result); - std::string GetLocalizedString(PP_ResourceString id); - void UserMetricsRecordAction(const std::string& action); enum DocumentLoadState { -- cgit v1.1