Don't show PDF Searchify promo before ScreenAI component download.
ScreenAI component download is triggered when Chrome considers it useful for the user. Therefore the component may be unavailable when user opens a PDF without text. This CL blocks showing the promo for PDF Searchify until when the component is available and searchify can be done. This changed can be followed up by triggering searchify when ScreenAI component is downloaded (crbug.com/377820463). Bug: 360803943 Change-Id: Ie7d015200e2784f8c14678e6949e7a0b4bd18b24 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6001952 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Ramin Halavati <rhalavati@chromium.org> Cr-Commit-Position: refs/heads/main@{#1379778}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
6bb8b18760
commit
2849a3b585
chrome/browser/ui/pdf
@ -23,6 +23,9 @@ source_set("pdf") {
|
||||
"//services/screen_ai/buildflags",
|
||||
]
|
||||
if (enable_screen_ai_service) {
|
||||
deps += [ "//chrome/browser/ui/user_education" ]
|
||||
deps += [
|
||||
"//chrome/browser/screen_ai:screen_ai_install_state",
|
||||
"//chrome/browser/ui/user_education",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "pdf/pdf_features.h"
|
||||
|
||||
#if BUILDFLAG(ENABLE_SCREEN_AI_SERVICE)
|
||||
#include "chrome/browser/screen_ai/screen_ai_install_state.h"
|
||||
#include "chrome/browser/ui/user_education/browser_user_education_interface.h"
|
||||
#include "components/user_education/common/feature_promo/feature_promo_controller.h"
|
||||
#endif // BUILDFLAG(ENABLE_SCREEN_AI_SERVICE)
|
||||
@ -107,7 +108,10 @@ void ChromePDFDocumentHelperClient::SetPluginCanSave(
|
||||
void ChromePDFDocumentHelperClient::OnSearchifyStateChange(
|
||||
bool busy,
|
||||
content::WebContents* contents) {
|
||||
if (busy) {
|
||||
// Show the promo only when ScreenAI component is available and OCR can be
|
||||
// done.
|
||||
if (busy &&
|
||||
screen_ai::ScreenAIInstallState::GetInstance()->IsComponentAvailable()) {
|
||||
MaybeShowFeaturePromo(contents);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user