Do-not-grant-notifications-to-default-search-engine.patch 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. From: csagan5 <32685696+csagan5@users.noreply.github.com>
  2. Date: Sat, 10 Nov 2018 19:47:39 +0100
  3. Subject: Do not grant notifications to default search engine
  4. Block gelocation by default instead of granting it for non-enterprise use cases (almost the totality of users)
  5. ---
  6. .../search_permissions/search_permissions_service.cc | 20 ++++++--------------
  7. chrome/common/chrome_features.cc | 2 +-
  8. 2 files changed, 7 insertions(+), 15 deletions(-)
  9. diff --git a/chrome/browser/android/search_permissions/search_permissions_service.cc b/chrome/browser/android/search_permissions/search_permissions_service.cc
  10. --- a/chrome/browser/android/search_permissions/search_permissions_service.cc
  11. +++ b/chrome/browser/android/search_permissions/search_permissions_service.cc
  12. @@ -190,7 +190,7 @@ void SearchPermissionsService::ResetDSEPermission(ContentSettingsType type) {
  13. DCHECK(dse_url.is_empty() || IsPermissionControlledByDSE(type, dse_origin));
  14. if (!dse_url.is_empty())
  15. - SetContentSetting(dse_url, type, CONTENT_SETTING_ALLOW);
  16. + SetContentSetting(dse_url, type, CONTENT_SETTING_BLOCK);
  17. }
  18. void SearchPermissionsService::ResetDSEPermissions() {
  19. @@ -333,11 +333,7 @@ void SearchPermissionsService::InitializeSettingsIfNeeded() {
  20. return;
  21. }
  22. - // If we get to here, the DSE is not disabled by enterprise policy. If it was
  23. - // previously enterprise controlled, we initialize the setting to BLOCK since
  24. - // we don't know what the user's setting was previously.
  25. - bool was_enterprise_controlled =
  26. - pref_service_->GetBoolean(prefs::kDSEWasDisabledByPolicy);
  27. + // If this line is reached then DSE is not disabled by enterprise policy.
  28. pref_service_->ClearPref(prefs::kDSEWasDisabledByPolicy);
  29. // Initialize the pref for geolocation if it hasn't been initialized yet.
  30. @@ -370,10 +366,8 @@ void SearchPermissionsService::InitializeSettingsIfNeeded() {
  31. pref_service_->ClearPref(prefs::kDSEGeolocationSettingDeprecated);
  32. } else if (dse_geolocation_setting == CONTENT_SETTING_ASK) {
  33. // If the user hasn't explicitly allowed or blocked geolocation for the
  34. - // DSE, initialize it to allowed.
  35. - dse_geolocation_setting = was_enterprise_controlled
  36. - ? CONTENT_SETTING_BLOCK
  37. - : CONTENT_SETTING_ALLOW;
  38. + // DSE, initialize it to blocked.
  39. + dse_geolocation_setting = CONTENT_SETTING_BLOCK;
  40. }
  41. // Update the content setting with the auto-grants for the DSE.
  42. @@ -398,11 +392,9 @@ void SearchPermissionsService::InitializeSettingsIfNeeded() {
  43. GetContentSetting(dse_origin, CONTENT_SETTINGS_TYPE_NOTIFICATIONS);
  44. ContentSetting dse_notifications_setting = notifications_setting_to_restore;
  45. // If the user hasn't explicitly allowed or blocked notifications for the
  46. - // DSE, initialize it to allowed.
  47. + // DSE, initialize it to blocked.
  48. if (dse_notifications_setting == CONTENT_SETTING_ASK) {
  49. - dse_notifications_setting = was_enterprise_controlled
  50. - ? CONTENT_SETTING_BLOCK
  51. - : CONTENT_SETTING_ALLOW;
  52. + dse_notifications_setting = CONTENT_SETTING_BLOCK;
  53. }
  54. // Update the content setting with the auto-grants for the DSE.
  55. diff --git a/chrome/common/chrome_features.cc b/chrome/common/chrome_features.cc
  56. --- a/chrome/common/chrome_features.cc
  57. +++ b/chrome/common/chrome_features.cc
  58. @@ -247,7 +247,7 @@ const char kDisallowUnsafeHttpDownloadsParamName[] = "MimeTypeList";
  59. #if defined(OS_ANDROID)
  60. // Enable changing default downloads storage location on Android.
  61. const base::Feature kDownloadsLocationChange{"DownloadsLocationChange",
  62. - base::FEATURE_ENABLED_BY_DEFAULT};
  63. + base::FEATURE_DISABLED_BY_DEFAULT};
  64. #endif
  65. // Show the number of open incognito windows besides incognito icon on the
  66. --
  67. 2.11.0