From d1e398ce3a36b4da8f648d23eb454721a5af8029 Mon Sep 17 00:00:00 2001 From: Carmelo Messina Date: Fri, 7 Aug 2020 18:36:16 +0200 Subject: [PATCH 1/2] add first version --- build/patches/history-on-incognito.patch | 282 +++++++++++++++++++++++ 1 file changed, 282 insertions(+) create mode 100644 build/patches/history-on-incognito.patch diff --git a/build/patches/history-on-incognito.patch b/build/patches/history-on-incognito.patch new file mode 100644 index 00000000..f80ea2a4 --- /dev/null +++ b/build/patches/history-on-incognito.patch @@ -0,0 +1,282 @@ +Date: Fri, 7 Aug 2020 16:33:47 +0000 +Subject: [PATCH] history_on_incognito + +--- + .../java/res/xml/privacy_preferences.xml | 5 +++++ + .../privacy/settings/PrivacySettings.java | 18 ++++++++++++++++++ + chrome/browser/android/preferences/prefs.h | 2 ++ + chrome/browser/history/history_tab_helper.cc | 16 ++++++++++++++++ + chrome/browser/history/history_tab_helper.h | 4 ++++ + chrome/browser/prefs/browser_prefs.cc | 2 ++ + .../android/strings/android_chrome_strings.grd | 6 ++++++ + .../translations/android_chrome_strings_it.xtb | 2 ++ + chrome/common/pref_names.cc | 5 +++++ + chrome/common/pref_names.h | 4 ++++ + 10 files changed, 64 insertions(+) + mode change 100644 => 100755 chrome/android/java/res/xml/privacy_preferences.xml + mode change 100644 => 100755 chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java + mode change 100644 => 100755 chrome/browser/android/preferences/prefs.h + mode change 100644 => 100755 chrome/browser/history/history_tab_helper.cc + mode change 100644 => 100755 chrome/browser/history/history_tab_helper.h + mode change 100644 => 100755 chrome/browser/prefs/browser_prefs.cc + mode change 100644 => 100755 chrome/browser/ui/android/strings/android_chrome_strings.grd + mode change 100644 => 100755 chrome/browser/ui/android/strings/translations/android_chrome_strings_it.xtb + mode change 100644 => 100755 chrome/common/pref_names.cc + mode change 100644 => 100755 chrome/common/pref_names.h + +diff --git a/chrome/android/java/res/xml/privacy_preferences.xml b/chrome/android/java/res/xml/privacy_preferences.xml +old mode 100644 +new mode 100755 +index 5e1e76c2a8..d87f8def22 +--- a/chrome/android/java/res/xml/privacy_preferences.xml ++++ b/chrome/android/java/res/xml/privacy_preferences.xml +@@ -34,6 +34,11 @@ + android:title="@string/always_incognito_title" + android:summary="@string/always_incognito_summary" + android:defaultValue="false" /> ++ + GetBrowserContext()); ++ ++#if defined(OS_ANDROID) ++ if(profile->GetOriginalProfile()->GetPrefs()->GetBoolean(prefs::kIncognitoTabHistoryEnabled)) { ++ return HistoryServiceFactory::GetForProfile(profile, ServiceAccessType::IMPLICIT_ACCESS); ++ } ++#endif ++ + if (profile->IsOffTheRecord()) + return NULL; + +@@ -247,6 +257,12 @@ history::HistoryService* HistoryTabHelper::GetHistoryService() { + profile, ServiceAccessType::IMPLICIT_ACCESS); + } + ++// static ++void HistoryTabHelper::RegisterProfilePrefs(PrefRegistrySimple* registry) { ++ registry->RegisterBooleanPref(prefs::kIncognitoTabHistoryEnabled, ++ /*default_value=*/false); ++} ++ + void HistoryTabHelper::WebContentsDestroyed() { + // We update the history for this URL. + WebContents* tab = web_contents(); +diff --git a/chrome/browser/history/history_tab_helper.h b/chrome/browser/history/history_tab_helper.h +old mode 100644 +new mode 100755 +index 6782ba38ba..6d1bf75e6b +--- a/chrome/browser/history/history_tab_helper.h ++++ b/chrome/browser/history/history_tab_helper.h +@@ -10,6 +10,8 @@ + #include "base/time/time.h" + #include "content/public/browser/web_contents_observer.h" + #include "content/public/browser/web_contents_user_data.h" ++#include "components/prefs/pref_registry_simple.h" ++#include "components/prefs/pref_service.h" + + namespace history { + struct HistoryAddPageArgs; +@@ -34,6 +36,8 @@ class HistoryTabHelper : public content::WebContentsObserver, + int nav_entry_id, + content::NavigationHandle* navigation_handle); + ++ static void RegisterProfilePrefs(PrefRegistrySimple* registry); ++ + private: + explicit HistoryTabHelper(content::WebContents* web_contents); + friend class content::WebContentsUserData; +diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc +old mode 100644 +new mode 100755 +index 3d00fae9dc..6d6953cca7 +--- a/chrome/browser/prefs/browser_prefs.cc ++++ b/chrome/browser/prefs/browser_prefs.cc +@@ -232,6 +232,7 @@ + #include "components/ntp_tiles/popular_sites_impl.h" + #include "components/permissions/contexts/geolocation_permission_context_android.h" + #include "components/query_tiles/tile_service_prefs.h" ++#include "chrome/browser/history/history_tab_helper.h" + #if BUILDFLAG(ENABLE_FEED_IN_CHROME) + #include "components/feed/core/common/pref_names.h" + #endif // BUILDFLAG(ENABLE_FEED_IN_CHROME) +@@ -978,6 +979,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry, + usage_stats::UsageStatsBridge::RegisterProfilePrefs(registry); + variations::VariationsService::RegisterProfilePrefs(registry); + feed::prefs::RegisterFeedSharedProfilePrefs(registry); ++ HistoryTabHelper::RegisterProfilePrefs(registry); + #if BUILDFLAG(ENABLE_FEED_IN_CHROME) + feed::RegisterProfilePrefs(registry); + #endif // BUILDFLAG(ENABLE_FEED_IN_CHROME) +diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd +old mode 100644 +new mode 100755 +index 433ab2dfa3..c46bb2c55e +--- a/chrome/browser/ui/android/strings/android_chrome_strings.grd ++++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd +@@ -746,6 +746,12 @@ Your Google account may have other forms of browsing history like searches and a + + Opens links in incognito tabs when you click on new tab or on a link + ++ ++ Enable history in incognito tabs ++ ++ ++ Record history even in incognito mode ++ + + Clears history and autocompletions in the address bar. Your Google Account may have other forms of browsing history at <link>myactivity.google.com</link>. + +diff --git a/chrome/browser/ui/android/strings/translations/android_chrome_strings_it.xtb b/chrome/browser/ui/android/strings/translations/android_chrome_strings_it.xtb +old mode 100644 +new mode 100755 +index b425abafde..9960138a7a +--- a/chrome/browser/ui/android/strings/translations/android_chrome_strings_it.xtb ++++ b/chrome/browser/ui/android/strings/translations/android_chrome_strings_it.xtb +@@ -1011,4 +1011,6 @@ Ad esempio, alcuni siti web potrebbero rispondere alla richiesta mostrando annun + Utilizza un servizio di previsione per visualizzare query correlate e siti web popolari durante la digitazione nella barra degli indirizzi + Sincronizzazione con + Gestione attività di Google ++Abilita la cronologia nelle sessioni in incognito ++Abilita la registrazione della navigazione nella cronologia anche per le sessioni in incognito + +diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc +old mode 100644 +new mode 100755 +index e49716dcc3..72109377cb +--- a/chrome/common/pref_names.cc ++++ b/chrome/common/pref_names.cc +@@ -2996,4 +2996,9 @@ const char kMediaFeedsSafeSearchEnabled[] = "media_feeds_safe_search_enabled"; + // TODO(enne): Remove this once AppCache has been removed. + const char kAppCacheForceEnabled[] = "app_cache_force_enabled"; + ++#if defined(OS_ANDROID) ++const char kIncognitoTabHistoryEnabled[] = ++ "incognito_tab_history_enabled"; ++#endif ++ + } // namespace prefs +diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h +old mode 100644 +new mode 100755 +index 2e3213f192..acb3c82d75 +--- a/chrome/common/pref_names.h ++++ b/chrome/common/pref_names.h +@@ -1064,6 +1064,10 @@ extern const char kMediaFeedsSafeSearchEnabled[]; + + extern const char kAppCacheForceEnabled[]; + ++#if defined(OS_ANDROID) ++extern const char kIncognitoTabHistoryEnabled[]; ++#endif ++ + } // namespace prefs + + #endif // CHROME_COMMON_PREF_NAMES_H_ +-- +2.17.1 + From 5dd2efd4986a9a59f87338a0d15948b899b07856 Mon Sep 17 00:00:00 2001 From: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Sat, 15 Aug 2020 23:22:16 +0200 Subject: [PATCH 2/2] Minor patch cleanup --- build/bromite_patches_list.txt | 1 + ... => Add-history-support-in-incognito-mode.patch} | 13 ++----------- 2 files changed, 3 insertions(+), 11 deletions(-) rename build/patches/{history-on-incognito.patch => Add-history-support-in-incognito-mode.patch} (97%) diff --git a/build/bromite_patches_list.txt b/build/bromite_patches_list.txt index b2c1490c..87e35d43 100644 --- a/build/bromite_patches_list.txt +++ b/build/bromite_patches_list.txt @@ -146,4 +146,5 @@ Block-gateway-attacks-via-websockets.patch Enable-prefetch-privacy-changes-by-default.patch Enable-reduced-referrer-granularity-by-default.patch Restore-duet-flags.patch +Add-history-support-in-incognito-mode.patch Automated-domain-substitution.patch diff --git a/build/patches/history-on-incognito.patch b/build/patches/Add-history-support-in-incognito-mode.patch similarity index 97% rename from build/patches/history-on-incognito.patch rename to build/patches/Add-history-support-in-incognito-mode.patch index f80ea2a4..d20e346d 100644 --- a/build/patches/history-on-incognito.patch +++ b/build/patches/Add-history-support-in-incognito-mode.patch @@ -1,5 +1,6 @@ +From: uazo Date: Fri, 7 Aug 2020 16:33:47 +0000 -Subject: [PATCH] history_on_incognito +Subject: Add history support in incognito mode --- .../java/res/xml/privacy_preferences.xml | 5 +++++ @@ -27,7 +28,6 @@ Subject: [PATCH] history_on_incognito diff --git a/chrome/android/java/res/xml/privacy_preferences.xml b/chrome/android/java/res/xml/privacy_preferences.xml old mode 100644 new mode 100755 -index 5e1e76c2a8..d87f8def22 --- a/chrome/android/java/res/xml/privacy_preferences.xml +++ b/chrome/android/java/res/xml/privacy_preferences.xml @@ -34,6 +34,11 @@ @@ -45,7 +45,6 @@ index 5e1e76c2a8..d87f8def22 diff --git a/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java b/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java old mode 100644 new mode 100755 -index 7c40db13be..5c8f97209f --- a/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java @@ -34,6 +34,8 @@ import org.chromium.components.browser_ui.settings.SettingsUtils; @@ -104,7 +103,6 @@ index 7c40db13be..5c8f97209f diff --git a/chrome/browser/android/preferences/prefs.h b/chrome/browser/android/preferences/prefs.h old mode 100644 new mode 100755 -index 3d8971833e..b5c2057b63 --- a/chrome/browser/android/preferences/prefs.h +++ b/chrome/browser/android/preferences/prefs.h @@ -67,6 +67,7 @@ enum Pref { @@ -126,7 +124,6 @@ index 3d8971833e..b5c2057b63 diff --git a/chrome/browser/history/history_tab_helper.cc b/chrome/browser/history/history_tab_helper.cc old mode 100644 new mode 100755 -index a1d75306b2..c8406bb58f --- a/chrome/browser/history/history_tab_helper.cc +++ b/chrome/browser/history/history_tab_helper.cc @@ -29,6 +29,9 @@ @@ -169,7 +166,6 @@ index a1d75306b2..c8406bb58f diff --git a/chrome/browser/history/history_tab_helper.h b/chrome/browser/history/history_tab_helper.h old mode 100644 new mode 100755 -index 6782ba38ba..6d1bf75e6b --- a/chrome/browser/history/history_tab_helper.h +++ b/chrome/browser/history/history_tab_helper.h @@ -10,6 +10,8 @@ @@ -193,7 +189,6 @@ index 6782ba38ba..6d1bf75e6b diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc old mode 100644 new mode 100755 -index 3d00fae9dc..6d6953cca7 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc @@ -232,6 +232,7 @@ @@ -215,7 +210,6 @@ index 3d00fae9dc..6d6953cca7 diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd old mode 100644 new mode 100755 -index 433ab2dfa3..c46bb2c55e --- a/chrome/browser/ui/android/strings/android_chrome_strings.grd +++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd @@ -746,6 +746,12 @@ Your Google account may have other forms of browsing history like searches and a @@ -234,7 +228,6 @@ index 433ab2dfa3..c46bb2c55e diff --git a/chrome/browser/ui/android/strings/translations/android_chrome_strings_it.xtb b/chrome/browser/ui/android/strings/translations/android_chrome_strings_it.xtb old mode 100644 new mode 100755 -index b425abafde..9960138a7a --- a/chrome/browser/ui/android/strings/translations/android_chrome_strings_it.xtb +++ b/chrome/browser/ui/android/strings/translations/android_chrome_strings_it.xtb @@ -1011,4 +1011,6 @@ Ad esempio, alcuni siti web potrebbero rispondere alla richiesta mostrando annun @@ -247,7 +240,6 @@ index b425abafde..9960138a7a diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc old mode 100644 new mode 100755 -index e49716dcc3..72109377cb --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc @@ -2996,4 +2996,9 @@ const char kMediaFeedsSafeSearchEnabled[] = "media_feeds_safe_search_enabled"; @@ -263,7 +255,6 @@ index e49716dcc3..72109377cb diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h old mode 100644 new mode 100755 -index 2e3213f192..acb3c82d75 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h @@ -1064,6 +1064,10 @@ extern const char kMediaFeedsSafeSearchEnabled[];