From: csagan5 <32685696+csagan5@users.noreply.github.com>
Date: Sat, 10 Nov 2018 19:47:39 +0100
Subject: Do not grant notifications to default search engine

Block gelocation by default instead of granting it for non-enterprise use cases (almost the totality of users)
---
 .../search_permissions/search_permissions_service.cc   | 18 +++++-------------
 chrome/common/chrome_features.cc                       |  2 +-
 2 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/chrome/browser/android/search_permissions/search_permissions_service.cc b/chrome/browser/android/search_permissions/search_permissions_service.cc
--- a/chrome/browser/android/search_permissions/search_permissions_service.cc
+++ b/chrome/browser/android/search_permissions/search_permissions_service.cc
@@ -344,11 +344,7 @@ void SearchPermissionsService::InitializeSettingsIfNeeded() {
     return;
   }
 
-  // If we get to here, the DSE is not disabled by enterprise policy. If it was
-  // previously enterprise controlled, we initialize the setting to BLOCK since
-  // we don't know what the user's setting was previously.
-  bool was_enterprise_controlled =
-      pref_service_->GetBoolean(prefs::kDSEWasDisabledByPolicy);
+  // If we get to here, the DSE is not disabled by enterprise policy.
   pref_service_->ClearPref(prefs::kDSEWasDisabledByPolicy);
 
   // Initialize the pref for geolocation if it hasn't been initialized yet.
@@ -381,10 +377,8 @@ void SearchPermissionsService::InitializeSettingsIfNeeded() {
       pref_service_->ClearPref(prefs::kDSEGeolocationSettingDeprecated);
     } else if (dse_geolocation_setting == CONTENT_SETTING_ASK) {
       // If the user hasn't explicitly allowed or blocked geolocation for the
-      // DSE, initialize it to allowed.
-      dse_geolocation_setting = was_enterprise_controlled
-                                    ? CONTENT_SETTING_BLOCK
-                                    : CONTENT_SETTING_ALLOW;
+      // DSE, initialize it to disallowed.
+      dse_geolocation_setting = CONTENT_SETTING_BLOCK;
     }
 
     // Update the content setting with the auto-grants for the DSE.
@@ -410,11 +404,9 @@ void SearchPermissionsService::InitializeSettingsIfNeeded() {
         GetContentSetting(dse_origin, CONTENT_SETTINGS_TYPE_NOTIFICATIONS);
     ContentSetting dse_notifications_setting = notifications_setting_to_restore;
     // If the user hasn't explicitly allowed or blocked notifications for the
-    // DSE, initialize it to allowed.
+    // DSE, initialize it to disallowed.
     if (dse_notifications_setting == CONTENT_SETTING_ASK) {
-      dse_notifications_setting = was_enterprise_controlled
-                                      ? CONTENT_SETTING_BLOCK
-                                      : CONTENT_SETTING_ALLOW;
+      dse_notifications_setting = CONTENT_SETTING_BLOCK;
     }
 
     // Update the content setting with the auto-grants for the DSE.
diff --git a/chrome/common/chrome_features.cc b/chrome/common/chrome_features.cc
--- a/chrome/common/chrome_features.cc
+++ b/chrome/common/chrome_features.cc
@@ -329,7 +329,7 @@ const base::Feature kGoogleBrandedContextMenu{
 
 #if defined(OS_ANDROID)
 const base::Feature kGrantNotificationsToDSE{"GrantNotificationsToDSE",
-                                             base::FEATURE_ENABLED_BY_DEFAULT};
+                                             base::FEATURE_DISABLED_BY_DEFAULT};
 #endif  // defined(OS_ANDROID)
 
 #if defined(OS_CHROMEOS)
-- 
2.11.0

