From: csagan5 <32685696+csagan5@users.noreply.github.com>
Date: Mon, 12 Feb 2018 21:37:52 +0100
Subject: ungoogled-chromium: Disable Gaia

Disables Gaia code.
Somehow it is still being activated even without being signed-in.

See also: https://github.com/Eloston/ungoogled-chromium/issues/104
---
 chrome/browser/browser_resources.grd                                  | 2 --
 chrome/browser/extensions/component_extensions_whitelist/whitelist.cc | 1 -
 chrome/browser/extensions/signin/gaia_auth_extension_loader.cc        | 3 ++-
 chrome/browser/resources/component_extension_resources.grd            | 2 --
 chrome/browser/ui/webui/signin/inline_login_ui.cc                     | 1 -
 google_apis/gaia/gaia_auth_fetcher.cc                                 | 4 +++-
 6 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd
--- a/chrome/browser/browser_resources.grd
+++ b/chrome/browser/browser_resources.grd
@@ -396,7 +396,6 @@
       <include name="IDR_INLINE_LOGIN_HTML" file="resources\inline_login\inline_login.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
       <include name="IDR_INLINE_LOGIN_CSS" file="resources\inline_login\inline_login.css" flattenhtml="true" type="BINDATA" />
       <include name="IDR_INLINE_LOGIN_JS" file="resources\inline_login\inline_login.js" flattenhtml="true" type="BINDATA" />
-      <include name="IDR_GAIA_AUTH_AUTHENTICATOR_JS" file="resources\gaia_auth_host\authenticator.js" flattenhtml="true" type="BINDATA" />
       <include name="IDR_INSPECT_CSS" file="resources\inspect\inspect.css" flattenhtml="true" type="BINDATA" />
       <include name="IDR_INSPECT_HTML" file="resources\inspect\inspect.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
       <include name="IDR_INSPECT_JS" file="resources\inspect\inspect.js" flattenhtml="true" type="BINDATA" />
@@ -496,7 +495,6 @@
       <include name="IDR_WEBRTC_LOGS_JS" file="resources\media\webrtc_logs.js" type="BINDATA" />
       <include name="IDR_WEBSTORE_MANIFEST" file="resources\webstore_app\manifest.json" type="BINDATA" />
       <include name="IDR_CRYPTOTOKEN_MANIFEST" file="resources\cryptotoken\manifest.json" type="BINDATA" />
-      <include name="IDR_GAIA_AUTH_MANIFEST" file="resources\gaia_auth\manifest.json" type="BINDATA" />
       <if expr="chromeos">
         <if expr="optimize_webui">
           <then>
diff --git a/chrome/browser/extensions/component_extensions_whitelist/whitelist.cc b/chrome/browser/extensions/component_extensions_whitelist/whitelist.cc
--- a/chrome/browser/extensions/component_extensions_whitelist/whitelist.cc
+++ b/chrome/browser/extensions/component_extensions_whitelist/whitelist.cc
@@ -68,7 +68,6 @@ bool IsComponentExtensionWhitelisted(int manifest_resource_id) {
 #endif
     case IDR_CRYPTOTOKEN_MANIFEST:
     case IDR_FEEDBACK_MANIFEST:
-    case IDR_GAIA_AUTH_MANIFEST:
 #if BUILDFLAG(ENABLE_HANGOUT_SERVICES_EXTENSION)
     case IDR_HANGOUT_SERVICES_MANIFEST:
 #endif
diff --git a/chrome/browser/extensions/signin/gaia_auth_extension_loader.cc b/chrome/browser/extensions/signin/gaia_auth_extension_loader.cc
--- a/chrome/browser/extensions/signin/gaia_auth_extension_loader.cc
+++ b/chrome/browser/extensions/signin/gaia_auth_extension_loader.cc
@@ -43,7 +43,7 @@ ComponentLoader* GetComponentLoader(BrowserContext* context) {
 
 void LoadGaiaAuthExtension(BrowserContext* context) {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
-
+/*
   ComponentLoader* component_loader = GetComponentLoader(context);
   const base::CommandLine* command_line =
       base::CommandLine::ForCurrentProcess();
@@ -56,6 +56,7 @@ void LoadGaiaAuthExtension(BrowserContext* context) {
 
   component_loader->Add(IDR_GAIA_AUTH_MANIFEST,
                         base::FilePath(FILE_PATH_LITERAL("gaia_auth")));
+*/
 }
 
 void UnloadGaiaAuthExtension(BrowserContext* context) {
diff --git a/chrome/browser/resources/component_extension_resources.grd b/chrome/browser/resources/component_extension_resources.grd
--- a/chrome/browser/resources/component_extension_resources.grd
+++ b/chrome/browser/resources/component_extension_resources.grd
@@ -32,8 +32,6 @@
 
       <!-- Bookmarks -->
       <include name="IDR_COMPONENT_BOOKMARKS_BOOKMARKS_HTML" file="bookmarks/bookmarks.html" type="BINDATA" />
-      <!-- Gaia auth extension -->
-      <include name="IDR_GAIA_AUTH_SUCCESS" file="gaia_auth/success.html" allowexternalscript="true" type="BINDATA" />
       <!-- Hangout Services extension, included in Google Chrome builds only. -->
       <if expr="_google_chrome or enable_hangout_services_extension">
         <include name="IDR_HANGOUT_SERVICES_BACKGROUND_HTML" file="hangout_services/background.html" type="BINDATA" />
diff --git a/chrome/browser/ui/webui/signin/inline_login_ui.cc b/chrome/browser/ui/webui/signin/inline_login_ui.cc
--- a/chrome/browser/ui/webui/signin/inline_login_ui.cc
+++ b/chrome/browser/ui/webui/signin/inline_login_ui.cc
@@ -51,7 +51,6 @@ content::WebUIDataSource* CreateWebUIDataSource() {
 
   source->AddResourcePath("inline_login.css", IDR_INLINE_LOGIN_CSS);
   source->AddResourcePath("inline_login.js", IDR_INLINE_LOGIN_JS);
-  source->AddResourcePath("gaia_auth_host.js", IDR_GAIA_AUTH_AUTHENTICATOR_JS);
 
   source->AddLocalizedString("title", IDS_CHROME_SIGNIN_TITLE);
   source->AddLocalizedString(
diff --git a/google_apis/gaia/gaia_auth_fetcher.cc b/google_apis/gaia/gaia_auth_fetcher.cc
--- a/google_apis/gaia/gaia_auth_fetcher.cc
+++ b/google_apis/gaia/gaia_auth_fetcher.cc
@@ -45,7 +45,7 @@ namespace {
 const int kLoadFlagsIgnoreCookies = net::LOAD_DO_NOT_SEND_COOKIES |
                                     net::LOAD_DO_NOT_SAVE_COOKIES;
 
-const size_t kMaxMessageSize = 1024 * 1024;  // 1MB
+//const size_t kMaxMessageSize = 1024 * 1024;  // 1MB
 
 std::unique_ptr<const GaiaAuthConsumer::ClientOAuthResult>
 ExtractOAuth2TokenPairResponse(const std::string& data) {
@@ -261,6 +261,7 @@ void GaiaAuthFetcher::CreateAndStartGaiaFetcher(
     const net::NetworkTrafficAnnotationTag& traffic_annotation) {
   DCHECK(!fetch_pending_) << "Tried to fetch two things at once!";
 
+/*
   auto resource_request = std::make_unique<network::ResourceRequest>();
   resource_request->url = gaia_gurl;
   original_url_ = gaia_gurl;
@@ -315,6 +316,7 @@ void GaiaAuthFetcher::CreateAndStartGaiaFetcher(
       base::BindOnce(&GaiaAuthFetcher::OnURLLoadComplete,
                      base::Unretained(this)),
       kMaxMessageSize);
+*/
 }
 
 // static
-- 
2.11.0

