Add ENABLE_SCREEN_AI_SERVICE buildflag for ScreenAI service.

ScreenAI service is now under implementation for Linux and ChromeOS and
will later expand to other desktop platforms. For smoother transition a
buildflag is added.

After this change, the keyboard shortcut and registration of component
updated that were previously Linux-only are expanded to cover ChromeOS.

Bug: 1278249
Change-Id: I47d36c7c4259bc0f54759d6f9c0025396f1a9665
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3581030
Reviewed-by: Jochen Eisinger <[email protected]>
Commit-Queue: Ramin Halavati <[email protected]>
Reviewed-by: Greg Thompson <[email protected]>
Reviewed-by: Zentaro Kavanagh <[email protected]>
Reviewed-by: David Tseng <[email protected]>
Reviewed-by: Marc Treib <[email protected]>
Reviewed-by: Matthew Denton <[email protected]>
Reviewed-by: Alex Gough <[email protected]>
Cr-Commit-Position: refs/heads/main@{#997042}
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index f2c15ca..601fbb5 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -138,7 +138,7 @@
 #include "components/security_interstitials/content/insecure_form_blocking_page.h"
 #include "components/security_interstitials/content/stateful_ssl_host_state_delegate.h"
 #include "components/segmentation_platform/public/segmentation_platform_service.h"
-#include "components/services/screen_ai/public/cpp/pref_names.h"
+#include "components/services/screen_ai/buildflags/buildflags.h"
 #include "components/sessions/core/session_id_generator.h"
 #include "components/signin/public/base/signin_buildflags.h"
 #include "components/signin/public/identity_manager/identity_manager.h"
@@ -208,6 +208,10 @@
 #include "chrome/browser/plugins/plugin_info_host_impl.h"
 #endif
 
+#if BUILDFLAG(ENABLE_SCREEN_AI_SERVICE)
+#include "components/services/screen_ai/public/cpp/pref_names.h"  // nogncheck
+#endif
+
 #if BUILDFLAG(ENABLE_SUPERVISED_USERS)
 #include "chrome/browser/supervised_user/child_accounts/child_account_service.h"
 #include "chrome/browser/supervised_user/supervised_user_service.h"
@@ -1229,9 +1233,9 @@
   registry->RegisterBooleanPref(
       policy::policy_prefs::kSetTimeoutWithout1MsClampEnabled, false);
 
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+#if BUILDFLAG(ENABLE_SCREEN_AI_SERVICE)
   screen_ai::RegisterLocalStatePrefs(registry);
-#endif  // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+#endif  // BUILDFLAG(ENABLE_SCREEN_AI_SERVICE)
 
   // This is intentionally last.
   RegisterLocalStatePrefsForMigration(registry);