Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1388)

Unified Diff: pdf/pdfium/pdfium_api_string_buffer_adapter.cc

Issue 1303103003: PDF: Use PDF metadata for the title instead of the last path element. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pdf/pdfium/pdfium_api_string_buffer_adapter.cc
diff --git a/pdf/pdfium/pdfium_api_string_buffer_adapter.cc b/pdf/pdfium/pdfium_api_string_buffer_adapter.cc
index c5be3021d5b367ca3c5f122b1d97be58b24a9db9..c5819f39efed4b97f40788ee293746e4e36681a8 100644
--- a/pdf/pdfium/pdfium_api_string_buffer_adapter.cc
+++ b/pdf/pdfium/pdfium_api_string_buffer_adapter.cc
@@ -58,8 +58,43 @@ void PDFiumAPIStringBufferAdapter<StringType>::Close(size_t actual_size) {
}
}
+template <class StringType>
+PDFiumAPIStringBufferSizeInBytesAdapter<StringType>::
+ PDFiumAPIStringBufferSizeInBytesAdapter(StringType* str,
+ size_t expected_size,
+ bool check_expected_size)
+ : adapter_(str,
+ expected_size / sizeof(typename StringType::value_type),
+ check_expected_size) {
+ DCHECK(expected_size % sizeof(typename StringType::value_type) == 0);
+}
+
+template <class StringType>
+PDFiumAPIStringBufferSizeInBytesAdapter<
+ StringType>::~PDFiumAPIStringBufferSizeInBytesAdapter() = default;
+
+template <class StringType>
+void* PDFiumAPIStringBufferSizeInBytesAdapter<StringType>::GetData() {
+ return adapter_.GetData();
+}
+
+template <class StringType>
+void PDFiumAPIStringBufferSizeInBytesAdapter<StringType>::Close(
+ int actual_size) {
+ DCHECK(actual_size % sizeof(typename StringType::value_type) == 0);
+ adapter_.Close(actual_size / sizeof(typename StringType::value_type));
+}
+
+template <class StringType>
+void PDFiumAPIStringBufferSizeInBytesAdapter<StringType>::Close(
+ size_t actual_size) {
+ DCHECK(actual_size % sizeof(typename StringType::value_type) == 0);
+ adapter_.Close(actual_size / sizeof(typename StringType::value_type));
+}
+
// explicit instantiations
template class PDFiumAPIStringBufferAdapter<std::string>;
template class PDFiumAPIStringBufferAdapter<base::string16>;
+template class PDFiumAPIStringBufferSizeInBytesAdapter<base::string16>;
} // namespace chrome_pdf

Powered by Google App Engine
This is Rietveld 408576698