Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit a1e722db authored by Carmelo Messina's avatar Carmelo Messina
Browse files

Disable integration with Gemini: due to errors, some points are not covered by...

Disable integration with Gemini: due to errors, some points are not covered by the gn arg check. This patch fixes build errors.
Note that the enable_glic argument is already disabled in cromite's gn args. It is explicitly stated in the patch for clarity.
This patch fixes desktop builds of 145.0.7632.120.
parent 08063443
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -317,6 +317,7 @@ Fix-chromium-build-bugs.patch
Try-to-fix-2082.patch
Temp-use-PREVIEW-for-IDCompositionDevice5.patch
Enable-Socket-Pool-Limit-Randomization.patch
Disable-integration-with-Gemini.patch

# adblock patches
eyeo-133.0.6943.49-base.patch
+150 −0
Original line number Diff line number Diff line
From: uazo <uazo@users.noreply.github.com>
Date: Fri, 21 Apr 2023 13:10:20 +0000
Subject: Disable integration with Gemini

Due to errors, some points are not covered by the gn arg check.
This patch fixes build errors.

License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html
---
 .../contextual_cueing_helper.cc               |  2 ++
 .../api/pdf_viewer_private/BUILD.gn           |  3 ---
 .../pdf_viewer_private_api.cc                 | 22 +------------------
 chrome/browser/pdf/BUILD.gn                   |  1 -
 chrome/browser/ui/pdf/BUILD.gn                |  1 -
 .../pdf/chrome_pdf_document_helper_client.cc  |  2 ++
 chrome/common/features.gni                    |  2 +-
 7 files changed, 6 insertions(+), 27 deletions(-)

diff --git a/chrome/browser/contextual_cueing/contextual_cueing_helper.cc b/chrome/browser/contextual_cueing/contextual_cueing_helper.cc
--- a/chrome/browser/contextual_cueing/contextual_cueing_helper.cc
+++ b/chrome/browser/contextual_cueing/contextual_cueing_helper.cc
@@ -382,6 +382,7 @@ void ContextualCueingHelper::OnCueingDecision(
     return;
   }
 
+#if BUILDFLAG(ENABLE_GLIC)
   // Handle side panel auto-open case: bypass nudge and open panel directly.
   // If auto-open fails or is disabled, falls through to standard nudge.
   const bool should_open_side_panel =
@@ -421,6 +422,7 @@ void ContextualCueingHelper::OnCueingDecision(
                           contextual_cueing_service_->GetWeakPtr(),
                           web_contents(), document_available_time,
                           decision_result->is_dynamic));
+#endif
 }
 
 // static
diff --git a/chrome/browser/extensions/api/pdf_viewer_private/BUILD.gn b/chrome/browser/extensions/api/pdf_viewer_private/BUILD.gn
--- a/chrome/browser/extensions/api/pdf_viewer_private/BUILD.gn
+++ b/chrome/browser/extensions/api/pdf_viewer_private/BUILD.gn
@@ -18,7 +18,6 @@ source_set("pdf_viewer_private") {
 
   deps = [
     "//base",
-    "//chrome/browser/glic",
     "//chrome/browser/pdf",
     "//chrome/browser/pdf:pdf_pref_names",
     "//chrome/browser/profiles:profile",
@@ -48,8 +47,6 @@ source_set("browser_tests") {
   # sources = [ "pdf_viewer_private_browsertest.cc" ]
   deps = [
     ":pdf_viewer_private",
-    "//chrome/browser/glic",
-    "//chrome/browser/glic/test_support",
     "//chrome/test:test_support",
     "//content/test:test_support",
   ]
diff --git a/chrome/browser/extensions/api/pdf_viewer_private/pdf_viewer_private_api.cc b/chrome/browser/extensions/api/pdf_viewer_private/pdf_viewer_private_api.cc
--- a/chrome/browser/extensions/api/pdf_viewer_private/pdf_viewer_private_api.cc
+++ b/chrome/browser/extensions/api/pdf_viewer_private/pdf_viewer_private_api.cc
@@ -12,9 +12,6 @@
 #include "base/numerics/safe_conversions.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/values.h"
-#include "chrome/browser/glic/public/glic_enabling.h"
-#include "chrome/browser/glic/public/glic_keyed_service.h"
-#include "chrome/browser/glic/public/glic_keyed_service_factory.h"
 #include "chrome/browser/pdf/pdf_pref_names.h"
 #include "chrome/browser/pdf/pdf_viewer_stream_manager.h"
 #include "chrome/browser/profiles/profile.h"
@@ -306,24 +303,7 @@ ExtensionFunction::ResponseAction PdfViewerPrivateGlicSummarizeFunction::Run() {
     return RespondNow(Error("No tab."));
   }
 
-  if (!glic::GlicEnabling::IsEnabledForProfile(
-          Profile::FromBrowserContext(contents->GetBrowserContext()))) {
-    return RespondNow(Error("Glic is not enabled."));
-  }
-
-  glic::GlicKeyedService* glic_service =
-      glic::GlicKeyedServiceFactory::GetGlicKeyedService(
-          contents->GetBrowserContext());
-  CHECK(glic_service);
-
-  glic_service->ToggleUI(tab_interface->GetBrowserWindowInterface(),
-                         /*prevent_close=*/true,
-                         glic::mojom::InvocationSource::kPdfSummarizeButton,
-                         /*prompt_suggestion=*/"summarize the pdf",
-                         /*auto_send=*/true);
-
-  success = true;
-  return RespondNow(NoArguments());
+  return RespondNow(Error("Glic is not enabled."));
 }
 
 }  // namespace extensions
diff --git a/chrome/browser/pdf/BUILD.gn b/chrome/browser/pdf/BUILD.gn
--- a/chrome/browser/pdf/BUILD.gn
+++ b/chrome/browser/pdf/BUILD.gn
@@ -32,7 +32,6 @@ source_set("pdf") {
     "//build:chromeos_buildflags",
     "//chrome/browser:browser_process",
     "//chrome/browser:resources",
-    "//chrome/browser/glic",
     "//chrome/browser/pdf:pdf_pref_names",
     "//chrome/browser/profiles:profile",
     "//chrome/browser/resources/pdf:resources",
diff --git a/chrome/browser/ui/pdf/BUILD.gn b/chrome/browser/ui/pdf/BUILD.gn
--- a/chrome/browser/ui/pdf/BUILD.gn
+++ b/chrome/browser/ui/pdf/BUILD.gn
@@ -15,7 +15,6 @@ source_set("pdf") {
   ]
   deps = [
     "//chrome/browser/download",
-    "//chrome/browser/glic",
     "//chrome/browser/pdf",
     "//chrome/browser/screen_ai:screen_ai_install_state",
     "//chrome/browser/ui/tab_contents",
diff --git a/chrome/browser/ui/pdf/chrome_pdf_document_helper_client.cc b/chrome/browser/ui/pdf/chrome_pdf_document_helper_client.cc
--- a/chrome/browser/ui/pdf/chrome_pdf_document_helper_client.cc
+++ b/chrome/browser/ui/pdf/chrome_pdf_document_helper_client.cc
@@ -65,6 +65,7 @@ void LogGlicSummarizeMetrics(content::RenderFrameHost* render_frame_host) {
     return;
   }
 
+#if BUILDFLAG(ENABLE_GLIC)
   bool glic_enabled = glic::GlicEnabling::IsEnabledForProfile(
       Profile::FromBrowserContext(web_contents_to_use->GetBrowserContext()));
   base::UmaHistogramBoolean("PDF.GlicEnabled", glic_enabled);
@@ -73,6 +74,7 @@ void LogGlicSummarizeMetrics(content::RenderFrameHost* render_frame_host) {
           web_contents_to_use->GetBrowserContext());
   base::UmaHistogramBoolean("PDF.GlicSummarizeButtonEnabled",
                             glic_summarize_button_enabled);
+#endif
 }
 
 }  // namespace
diff --git a/chrome/common/features.gni b/chrome/common/features.gni
--- a/chrome/common/features.gni
+++ b/chrome/common/features.gni
@@ -46,7 +46,7 @@ declare_args() {
   enable_chrome_notifications = is_mac || is_win || is_linux
 
   # Enables inclusion of glic in the build.
-  enable_glic = is_mac || is_win || is_linux || is_chromeos
+  enable_glic = false
 
   # Enables inclusion of glic in the build on Android.
   # This is temporary, and will eventually be replaced by enable_glic.
--