| 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 "content/common/view_messages.h" | 10 #include "content/common/view_messages.h" |
| 11 #include "content/renderer/render_thread.h" | 11 #include "content/renderer/render_thread.h" |
| 12 #include "grit/webkit_resources.h" | 12 #include "grit/webkit_resources.h" |
| 13 #include "grit/webkit_strings.h" | 13 #include "grit/webkit_strings.h" |
| 14 #include "ppapi/c/pp_resource.h" | 14 #include "ppapi/c/pp_resource.h" |
| 15 #include "ppapi/c/private/ppb_pdf.h" | 15 #include "ppapi/c/private/ppb_pdf.h" |
| 16 #include "ppapi/shared_impl/resource.h" |
| 17 #include "ppapi/shared_impl/resource_tracker.h" |
| 18 #include "ppapi/shared_impl/tracker_base.h" |
| 16 #include "ppapi/shared_impl/var.h" | 19 #include "ppapi/shared_impl/var.h" |
| 17 #include "skia/ext/platform_canvas.h" | 20 #include "skia/ext/platform_canvas.h" |
| 18 #include "third_party/skia/include/core/SkBitmap.h" | 21 #include "third_party/skia/include/core/SkBitmap.h" |
| 19 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
| 20 #include "ui/base/resource/resource_bundle.h" | 23 #include "ui/base/resource/resource_bundle.h" |
| 21 #include "unicode/usearch.h" | 24 #include "unicode/usearch.h" |
| 22 #include "webkit/glue/webkit_glue.h" | 25 #include "webkit/glue/webkit_glue.h" |
| 23 #include "webkit/plugins/ppapi/plugin_delegate.h" | 26 #include "webkit/plugins/ppapi/plugin_delegate.h" |
| 24 #include "webkit/plugins/ppapi/plugin_module.h" | 27 #include "webkit/plugins/ppapi/plugin_module.h" |
| 25 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 28 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 // on Windows and Mac works through the renderer sandbox. | 204 // on Windows and Mac works through the renderer sandbox. |
| 202 return 0; | 205 return 0; |
| 203 #endif | 206 #endif |
| 204 } | 207 } |
| 205 | 208 |
| 206 bool GetFontTableForPrivateFontFile(PP_Resource font_file, | 209 bool GetFontTableForPrivateFontFile(PP_Resource font_file, |
| 207 uint32_t table, | 210 uint32_t table, |
| 208 void* output, | 211 void* output, |
| 209 uint32_t* output_length) { | 212 uint32_t* output_length) { |
| 210 #if defined(OS_LINUX) | 213 #if defined(OS_LINUX) |
| 211 scoped_refptr<webkit::ppapi::Resource> | 214 ppapi::Resource* resource = |
| 212 resource(webkit::ppapi::ResourceTracker::Get()->GetResource(font_file)); | 215 ppapi::TrackerBase::Get()->GetResourceTracker()->GetResource(font_file); |
| 213 if (!resource.get()) | 216 if (!resource) |
| 214 return false; | 217 return false; |
| 215 | 218 |
| 216 PrivateFontFile* font = static_cast<PrivateFontFile*>(resource.get()); | 219 PrivateFontFile* font = static_cast<PrivateFontFile*>(resource); |
| 217 if (!font) | |
| 218 return false; | |
| 219 return font->GetFontTable(table, output, output_length); | 220 return font->GetFontTable(table, output, output_length); |
| 220 #else | 221 #else |
| 221 return false; | 222 return false; |
| 222 #endif | 223 #endif |
| 223 } | 224 } |
| 224 | 225 |
| 225 void SearchString(PP_Instance instance, | 226 void SearchString(PP_Instance instance, |
| 226 const unsigned short* input_string, | 227 const unsigned short* input_string, |
| 227 const unsigned short* input_term, | 228 const unsigned short* input_term, |
| 228 bool case_sensitive, | 229 bool case_sensitive, |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 &SaveAs | 346 &SaveAs |
| 346 }; | 347 }; |
| 347 | 348 |
| 348 // static | 349 // static |
| 349 const PPB_PDF* PPB_PDF_Impl::GetInterface() { | 350 const PPB_PDF* PPB_PDF_Impl::GetInterface() { |
| 350 return &ppb_pdf; | 351 return &ppb_pdf; |
| 351 } | 352 } |
| 352 | 353 |
| 353 } // namespace chrome | 354 } // namespace chrome |
| 354 | 355 |
| OLD | NEW |