--- a/components/pdf/browser/pdf_document_helper_client.h
+++ b/components/pdf/browser/pdf_document_helper_client.h
@@ -4,6 +4,8 @@
 
 #ifndef COMPONENTS_PDF_BROWSER_PDF_DOCUMENT_HELPER_CLIENT_H_
 #define COMPONENTS_PDF_BROWSER_PDF_DOCUMENT_HELPER_CLIENT_H_
+
+#include "services/screen_ai/buildflags/buildflags.h"
 
 namespace content {
 class RenderFrameHost;
@@ -34,8 +34,10 @@
   virtual void OnDidScroll(const gfx::SelectionBound& start,
                            const gfx::SelectionBound& end) {}
 
+#if BUILDFLAG(ENABLE_SCREEN_AI_SERVICE)
   // Notifies that PDF searchifier started processing pages.
   virtual void OnSearchifyStarted(content::WebContents* contents) = 0;
+#endif
 };
 
 }  // namespace pdf
