0

Make PDFAnnotations feature flag Chrome OS only.

Bug: 1010663
Change-Id: Ic1aa4cc0c8c98183ea2c3fb0ed931a6b2bd3b8ca
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1868170
Reviewed-by: dstockwell <dstockwell@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#774486}
This commit is contained in:
Lei Zhang
2020-06-03 04:07:17 +00:00
committed by Commit Bot
parent 684a1b2f72
commit 6b477f1b0d
4 changed files with 17 additions and 12 deletions

@ -129,9 +129,6 @@ void AddAdditionalDataForPdf(base::DictionaryValue* dict) {
dict->SetKey("pdfFormSaveEnabled",
base::Value(base::FeatureList::IsEnabled(
chrome_pdf::features::kSaveEditedPDFForm)));
dict->SetKey("pdfAnnotationsEnabled",
base::Value(base::FeatureList::IsEnabled(
chrome_pdf::features::kPDFAnnotations)));
dict->SetKey("pdfTwoUpViewEnabled",
base::Value(base::FeatureList::IsEnabled(
chrome_pdf::features::kPDFTwoUpView)));
@ -140,11 +137,15 @@ void AddAdditionalDataForPdf(base::DictionaryValue* dict) {
chrome_pdf::features::kPDFViewerUpdate)));
bool enable_printing = true;
bool enable_annotations = false;
#if defined(OS_CHROMEOS)
// For Chrome OS, enable printing only if we are not at OOBE.
enable_printing = !chromeos::LoginDisplayHost::default_host();
enable_annotations =
base::FeatureList::IsEnabled(chrome_pdf::features::kPDFAnnotations);
#endif // defined(OS_CHROMEOS)
dict->SetKey("printingEnabled", base::Value(enable_printing));
dict->SetKey("pdfAnnotationsEnabled", base::Value(enable_annotations));
#endif // BUILDFLAG(ENABLE_PDF)
}

@ -1497,6 +1497,7 @@ void OutOfProcessInstance::SaveToBuffer(const std::string& token) {
message.Set(kJSDataToSave, buffer);
}
} else {
#if defined(OS_CHROMEOS)
DCHECK(base::FeatureList::IsEnabled(features::kPDFAnnotations));
uint32_t length = engine_->GetLoadedByteSize();
if (IsSaveDataSizeValid(length)) {
@ -1505,6 +1506,9 @@ void OutOfProcessInstance::SaveToBuffer(const std::string& token) {
message.Set(kJSDataToSave, buffer);
}
}
#else
NOTREACHED();
#endif
}
PostMessage(message);

@ -13,14 +13,6 @@ const base::Feature kAccessiblePDFForm = {"AccessiblePDFForm",
const base::Feature kAccessiblePDFHighlight = {
"AccessiblePDFHighlight", base::FEATURE_ENABLED_BY_DEFAULT};
const base::Feature kPDFAnnotations = {"PDFAnnotations",
#if defined(OS_CHROMEOS)
base::FEATURE_ENABLED_BY_DEFAULT
#else
base::FEATURE_DISABLED_BY_DEFAULT
#endif // defined(OS_CHROMEOS)
};
const base::Feature kPdfHonorJsContentSettings = {
"PdfHonorJsContentSettings", base::FEATURE_DISABLED_BY_DEFAULT};
@ -41,5 +33,10 @@ const base::Feature kSaveEditedPDFForm = {"SaveEditedPDFForm",
const base::Feature kTabAcrossPDFAnnotations = {
"TabAcrossPDFAnnotations", base::FEATURE_ENABLED_BY_DEFAULT};
#if defined(OS_CHROMEOS)
const base::Feature kPDFAnnotations{"PDFAnnotations",
base::FEATURE_ENABLED_BY_DEFAULT};
#endif
} // namespace features
} // namespace chrome_pdf

@ -15,13 +15,16 @@ namespace features {
extern const base::Feature kAccessiblePDFForm;
extern const base::Feature kAccessiblePDFHighlight;
extern const base::Feature kPDFAnnotations;
extern const base::Feature kPdfHonorJsContentSettings;
extern const base::Feature kPDFTwoUpView;
extern const base::Feature kPDFViewerUpdate;
extern const base::Feature kSaveEditedPDFForm;
extern const base::Feature kTabAcrossPDFAnnotations;
#if defined(OS_CHROMEOS)
extern const base::Feature kPDFAnnotations;
#endif
} // namespace features
} // namespace chrome_pdf