| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/renderer/chrome_ppb_pdf_impl.h" | 5 #include "chrome/renderer/chrome_ppb_pdf_impl.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" | 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" |
| 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 27 #include "third_party/skia/include/core/SkBitmap.h" | 27 #include "third_party/skia/include/core/SkBitmap.h" |
| 28 #include "ui/base/l10n/l10n_util.h" | 28 #include "ui/base/l10n/l10n_util.h" |
| 29 #include "ui/base/resource/resource_bundle.h" | 29 #include "ui/base/resource/resource_bundle.h" |
| 30 #include "unicode/usearch.h" | 30 #include "unicode/usearch.h" |
| 31 #include "webkit/plugins/ppapi/host_globals.h" | 31 #include "webkit/plugins/ppapi/host_globals.h" |
| 32 #include "webkit/plugins/ppapi/host_resource_tracker.h" | 32 #include "webkit/plugins/ppapi/host_resource_tracker.h" |
| 33 #include "webkit/plugins/ppapi/plugin_delegate.h" | 33 #include "webkit/plugins/ppapi/plugin_delegate.h" |
| 34 #include "webkit/plugins/ppapi/plugin_module.h" | |
| 35 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 34 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 36 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" | 35 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" |
| 37 | 36 |
| 38 using ppapi::PpapiGlobals; | 37 using ppapi::PpapiGlobals; |
| 39 using webkit::ppapi::HostGlobals; | 38 using webkit::ppapi::HostGlobals; |
| 40 using webkit::ppapi::PluginInstance; | 39 using webkit::ppapi::PluginInstance; |
| 41 using WebKit::WebView; | 40 using WebKit::WebView; |
| 42 using content::RenderThread; | 41 using content::RenderThread; |
| 43 | 42 |
| 44 namespace chrome { | 43 namespace chrome { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 } else if (string_id == PP_RESOURCESTRING_PDFLOADING) { | 134 } else if (string_id == PP_RESOURCESTRING_PDFLOADING) { |
| 136 rv = UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_PAGE_LOADING)); | 135 rv = UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_PAGE_LOADING)); |
| 137 } else if (string_id == PP_RESOURCESTRING_PDFLOAD_FAILED) { | 136 } else if (string_id == PP_RESOURCESTRING_PDFLOAD_FAILED) { |
| 138 rv = UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_PAGE_LOAD_FAILED)); | 137 rv = UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_PAGE_LOAD_FAILED)); |
| 139 } else if (string_id == PP_RESOURCESTRING_PDFPROGRESSLOADING) { | 138 } else if (string_id == PP_RESOURCESTRING_PDFPROGRESSLOADING) { |
| 140 rv = UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_PROGRESS_LOADING)); | 139 rv = UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_PROGRESS_LOADING)); |
| 141 } else { | 140 } else { |
| 142 NOTREACHED(); | 141 NOTREACHED(); |
| 143 } | 142 } |
| 144 | 143 |
| 145 return ppapi::StringVar::StringToPPVar(instance->module()->pp_module(), rv); | 144 return ppapi::StringVar::StringToPPVar(rv); |
| 146 } | 145 } |
| 147 | 146 |
| 148 PP_Resource GetResourceImage(PP_Instance instance_id, | 147 PP_Resource GetResourceImage(PP_Instance instance_id, |
| 149 PP_ResourceImage image_id) { | 148 PP_ResourceImage image_id) { |
| 150 int res_id = 0; | 149 int res_id = 0; |
| 151 for (size_t i = 0; i < arraysize(kResourceImageMap); ++i) { | 150 for (size_t i = 0; i < arraysize(kResourceImageMap); ++i) { |
| 152 if (kResourceImageMap[i].pp_id == image_id) { | 151 if (kResourceImageMap[i].pp_id == image_id) { |
| 153 res_id = kResourceImageMap[i].res_id; | 152 res_id = kResourceImageMap[i].res_id; |
| 154 break; | 153 break; |
| 155 } | 154 } |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 &SaveAs | 350 &SaveAs |
| 352 }; | 351 }; |
| 353 | 352 |
| 354 // static | 353 // static |
| 355 const PPB_PDF* PPB_PDF_Impl::GetInterface() { | 354 const PPB_PDF* PPB_PDF_Impl::GetInterface() { |
| 356 return &ppb_pdf; | 355 return &ppb_pdf; |
| 357 } | 356 } |
| 358 | 357 |
| 359 } // namespace chrome | 358 } // namespace chrome |
| 360 | 359 |
| OLD | NEW |