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

Unified Diff: pdf/pdfium/pdfium_engine.cc

Issue 845203002: Don't return Windows newlines through the PDF GetSelectedText JS API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@addMissingFeatures
Patch Set: Created 5 years, 11 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
« no previous file with comments | « pdf/out_of_process_instance.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pdf/pdfium/pdfium_engine.cc
diff --git a/pdf/pdfium/pdfium_engine.cc b/pdf/pdfium/pdfium_engine.cc
index de50c79ff5185b3015857693e3b2698f657eea48..228a8899cc4f5436c1ca4b7f7015ce40e68d05da 100644
--- a/pdf/pdfium/pdfium_engine.cc
+++ b/pdf/pdfium/pdfium_engine.cc
@@ -2250,6 +2250,9 @@ void PDFiumEngine::InvalidateAllPages() {
}
std::string PDFiumEngine::GetSelectedText() {
+ if (!HasPermission(PDFEngine::PERMISSION_COPY))
+ return std::string();
+
base::string16 result;
base::string16 new_line_char = base::UTF8ToUTF16("\n");
for (size_t i = 0; i < selection_.size(); ++i) {
@@ -3344,8 +3347,7 @@ void PDFiumEngine::GetRegion(const pp::Point& location,
}
void PDFiumEngine::OnSelectionChanged() {
- if (HasPermission(PDFEngine::PERMISSION_COPY))
- pp::PDF::SetSelectedText(GetPluginInstance(), GetSelectedText().c_str());
+ pp::PDF::SetSelectedText(GetPluginInstance(), GetSelectedText().c_str());
}
void PDFiumEngine::RotateInternal() {
« no previous file with comments | « pdf/out_of_process_instance.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698