Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a672f8d057 | ||
|
|
503e4b8f27 | ||
|
|
b615a77f51 | ||
|
|
7f6cc79541 | ||
|
|
2951298a6b | ||
|
|
d5b09217ef |
@@ -1,3 +1,24 @@
|
||||
# 72.0.3626.120
|
||||
* add support for resource type in adblock engine (fixes https://github.com/bromite/bromite/issues/115)
|
||||
* adblock engine speed optimizations
|
||||
* use adblock engine also in SystemWebView
|
||||
* add back uBlock Origin and EasyList filters
|
||||
* added Fanboy's Annoyance List
|
||||
|
||||
# 72.0.3626.119
|
||||
* use AdGuard filters
|
||||
* fixes for new tile rows usage
|
||||
* re-introduce patch to hide NTP tiles
|
||||
* disable NTP tile metrics collection
|
||||
|
||||
# 72.0.3626.114
|
||||
* use 4 tile rows instead of 2 in the new tab page
|
||||
* do not grant geolocation permission to default search engine (fixes https://github.com/bromite/bromite/issues/250)
|
||||
|
||||
# 72.0.3626.108
|
||||
|
||||
# 72.0.3626.99
|
||||
|
||||
# 72.0.3626.87
|
||||
* update bookmarks view after import
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ Yes, since version 69. While the desktop version of Chromium has an option to di
|
||||
|
||||
# Features
|
||||
|
||||
* baked-in adblock engine with filters from EasyList, EasyPrivacy and others
|
||||
* baked-in adblock engine
|
||||
* remove click-tracking and AMP from search results
|
||||
* DNS-over-HTTPS support via Google, Cloudflare, Quad9 and AdGuard servers
|
||||
* [proxy configuration page](https://github.com/bromite/bromite/wiki/ProxyConfiguration) with PAC and custom proxy lists support
|
||||
@@ -88,10 +88,10 @@ Yes, since version 69. While the desktop version of Chromium has an option to di
|
||||
* privacy enhancement patches from [Iridium](https://iridiumbrowser.de/), [Inox patchset](https://github.com/gcarq/inox-patchset), [Brave](https://brave.com/) and [ungoogled-chromium](https://github.com/Eloston/ungoogled-chromium) projects
|
||||
|
||||
## Features not related to privacy
|
||||
* AV1 codec support
|
||||
* import/export bookmarks
|
||||
* allow playing videos in background tabs and disable pause on switching tabs
|
||||
* all codecs included (proprietary, open H.264 etc.)
|
||||
* [AV1 codec support](https://github.com/bromite/bromite/wiki/AV1-support)
|
||||
* built with official speed optimizations
|
||||
|
||||
You can inspect all functionality/privacy changes by reading the patches: https://github.com/bromite/bromite/tree/master/build/patches
|
||||
@@ -148,9 +148,15 @@ The patches are to be applied second the order specified in the `patches_list.tx
|
||||
* [Inox patchset](https://github.com/gcarq/inox-patchset) for some patches (via ungoogled-chromium)
|
||||
* [Brave Browser](https://github.com/brave/browser-android-tabs) for some patches
|
||||
* nochromo for the original adblock patch
|
||||
* [AdBlock Plus](https://adblockplus.org/), [uBlock Origin](https://github.com/uBlockOrigin), [Peter Lowe's adservers list](https://pgl.yoyo.org/adservers/), [EasyList and EasyPrivacy](https://easylist.to/) for the filters included
|
||||
* [Vadim Pleshkov](http://vadimpleshkov.me/) for Bromite's logo
|
||||
|
||||
# Filters credits
|
||||
* [EasyList](https://easylist.to/#easylist)
|
||||
* [EasyPrivacy](https://easylist.to/#easyprivacy)
|
||||
* [Fanboy's Annoyance List](https://easylist.to/#fanboy-s-annoyance-list)
|
||||
* [uBlock Origin](https://github.com/uBlockOrigin)
|
||||
* [Peter Lowe's adservers list](https://pgl.yoyo.org/adservers/)
|
||||
|
||||
# License
|
||||
|
||||
The patches published as part of the Bromite project are released under [GNU GPL v3](./LICENSE).
|
||||
|
||||
+76005
-57128
File diff suppressed because one or more lines are too long
@@ -39,7 +39,7 @@ diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
|
||||
#endif // OS_ANDROID
|
||||
|
||||
const FeatureEntry::Choice kNumRasterThreadsChoices[] = {
|
||||
@@ -3556,6 +3564,12 @@ const FeatureEntry kFeatureEntries[] = {
|
||||
@@ -3561,6 +3569,12 @@ const FeatureEntry kFeatureEntries[] = {
|
||||
FEATURE_VALUE_TYPE(features::kAsyncDns)},
|
||||
#endif // defined(OS_ANDROID)
|
||||
|
||||
@@ -55,7 +55,7 @@ diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
|
||||
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
|
||||
--- a/chrome/browser/flag_descriptions.cc
|
||||
+++ b/chrome/browser/flag_descriptions.cc
|
||||
@@ -2254,6 +2254,9 @@ const char kAutoFetchOnNetErrorPageDescription[] =
|
||||
@@ -2260,6 +2260,9 @@ const char kAutoFetchOnNetErrorPageDescription[] =
|
||||
"When enabled, and navigation fails with an offline error, schedule a "
|
||||
"fetch of the page when online again.";
|
||||
|
||||
@@ -68,7 +68,7 @@ diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descripti
|
||||
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h
|
||||
--- a/chrome/browser/flag_descriptions.h
|
||||
+++ b/chrome/browser/flag_descriptions.h
|
||||
@@ -1352,6 +1352,9 @@ extern const char kAsyncDnsDescription[];
|
||||
@@ -1355,6 +1355,9 @@ extern const char kAsyncDnsDescription[];
|
||||
extern const char kAutoFetchOnNetErrorPageName[];
|
||||
extern const char kAutoFetchOnNetErrorPageDescription[];
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ Disable it by default on Android as it is everywhere else
|
||||
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
|
||||
--- a/chrome/browser/about_flags.cc
|
||||
+++ b/chrome/browser/about_flags.cc
|
||||
@@ -3330,6 +3330,11 @@ const FeatureEntry kFeatureEntries[] = {
|
||||
@@ -3335,6 +3335,11 @@ const FeatureEntry kFeatureEntries[] = {
|
||||
FEATURE_VALUE_TYPE(features::kUseGoogleLocalNtp)},
|
||||
#endif // !defined(OS_ANDROID)
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ Subject: Add flag to disable IPv6 probes
|
||||
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
|
||||
--- a/chrome/browser/about_flags.cc
|
||||
+++ b/chrome/browser/about_flags.cc
|
||||
@@ -3382,6 +3382,11 @@ const FeatureEntry kFeatureEntries[] = {
|
||||
@@ -3387,6 +3387,11 @@ const FeatureEntry kFeatureEntries[] = {
|
||||
FEATURE_VALUE_TYPE(features::kEnableVirtualKeyboardUkm)},
|
||||
#endif // OS_CHROMEOS
|
||||
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
From: csagan5 <32685696+csagan5@users.noreply.github.com>
|
||||
Date: Mon, 9 Jul 2018 20:12:19 +0200
|
||||
Subject: Add flag to show/hide NTP tiles
|
||||
|
||||
---
|
||||
chrome/browser/about_flags.cc | 4 ++++
|
||||
chrome/browser/android/ntp/most_visited_sites_bridge.cc | 8 ++++++++
|
||||
chrome/browser/flag_descriptions.cc | 4 ++++
|
||||
chrome/browser/flag_descriptions.h | 3 +++
|
||||
chrome/common/chrome_switches.cc | 3 +++
|
||||
chrome/common/chrome_switches.h | 1 +
|
||||
6 files changed, 23 insertions(+)
|
||||
|
||||
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
|
||||
--- a/chrome/browser/about_flags.cc
|
||||
+++ b/chrome/browser/about_flags.cc
|
||||
@@ -1996,6 +1996,10 @@ const FeatureEntry kFeatureEntries[] = {
|
||||
SINGLE_VALUE_TYPE(switches::kHostedAppQuitNotification)},
|
||||
#endif // OS_MACOSX
|
||||
#if defined(OS_ANDROID)
|
||||
+ {"hide-ntp-tiles",
|
||||
+ flag_descriptions::kHideNTPTilesName,
|
||||
+ flag_descriptions::kHideNTPTilesDescription, kOsAndroid,
|
||||
+ SINGLE_VALUE_TYPE(switches::kHideNTPTiles)},
|
||||
{"disable-pull-to-refresh-effect",
|
||||
flag_descriptions::kPullToRefreshEffectName,
|
||||
flag_descriptions::kPullToRefreshEffectDescription, kOsAndroid,
|
||||
diff --git a/chrome/browser/android/ntp/most_visited_sites_bridge.cc b/chrome/browser/android/ntp/most_visited_sites_bridge.cc
|
||||
--- a/chrome/browser/android/ntp/most_visited_sites_bridge.cc
|
||||
+++ b/chrome/browser/android/ntp/most_visited_sites_bridge.cc
|
||||
@@ -13,9 +13,11 @@
|
||||
#include "base/android/jni_array.h"
|
||||
#include "base/android/jni_string.h"
|
||||
#include "base/android/scoped_java_ref.h"
|
||||
+#include "base/command_line.h"
|
||||
#include "base/strings/string16.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "chrome/browser/browser_process.h"
|
||||
+#include "chrome/common/chrome_switches.h"
|
||||
#include "chrome/browser/history/history_service_factory.h"
|
||||
#include "chrome/browser/ntp_tiles/chrome_most_visited_sites_factory.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
@@ -162,6 +164,10 @@ void MostVisitedSitesBridge::JavaObserver::OnURLsAvailable(
|
||||
std::vector<int> sources;
|
||||
std::vector<int> section_types;
|
||||
std::vector<int64_t> data_generation_times;
|
||||
+
|
||||
+ // do not source any tile if NTP is disabled
|
||||
+ if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
|
||||
+ switches::kHideNTPTiles)) {
|
||||
for (const auto& section : sections) {
|
||||
const NTPTilesVector& tiles = section.second;
|
||||
section_types.resize(section_types.size() + tiles.size(),
|
||||
@@ -176,6 +182,8 @@ void MostVisitedSitesBridge::JavaObserver::OnURLsAvailable(
|
||||
tile.data_generation_time.ToJavaTime());
|
||||
}
|
||||
}
|
||||
+ }
|
||||
+
|
||||
Java_MostVisitedSitesBridge_onURLsAvailable(
|
||||
env, observer_, ToJavaArrayOfStrings(env, titles),
|
||||
ToJavaArrayOfStrings(env, urls), ToJavaIntArray(env, section_types),
|
||||
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
|
||||
--- a/chrome/browser/flag_descriptions.cc
|
||||
+++ b/chrome/browser/flag_descriptions.cc
|
||||
@@ -167,6 +167,10 @@ const char kAwaitOptimizationName[] = "Await optimization";
|
||||
const char kAwaitOptimizationDescription[] =
|
||||
"Enables await taking 1 tick on the microtask queue.";
|
||||
|
||||
+const char kHideNTPTilesName[] = "Hide NTP tiles";
|
||||
+const char kHideNTPTilesDescription[] =
|
||||
+ "Hide all tiles on the New Tab Page, making it effectively empty all the time.";
|
||||
+
|
||||
const char kBleAdvertisingInExtensionsName[] = "BLE Advertising in Chrome Apps";
|
||||
const char kBleAdvertisingInExtensionsDescription[] =
|
||||
"Enables BLE Advertising in Chrome Apps. BLE Advertising might interfere "
|
||||
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h
|
||||
--- a/chrome/browser/flag_descriptions.h
|
||||
+++ b/chrome/browser/flag_descriptions.h
|
||||
@@ -126,6 +126,9 @@ extern const char kAutoplayPolicyDocumentUserActivation[];
|
||||
extern const char kAwaitOptimizationName[];
|
||||
extern const char kAwaitOptimizationDescription[];
|
||||
|
||||
+extern const char kHideNTPTilesName[];
|
||||
+extern const char kHideNTPTilesDescription[];
|
||||
+
|
||||
extern const char kBleAdvertisingInExtensionsName[];
|
||||
extern const char kBleAdvertisingInExtensionsDescription[];
|
||||
|
||||
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
|
||||
--- a/chrome/common/chrome_switches.cc
|
||||
+++ b/chrome/common/chrome_switches.cc
|
||||
@@ -88,6 +88,9 @@ const char kAutoSelectDesktopCaptureSource[] =
|
||||
const char kBypassAppBannerEngagementChecks[] =
|
||||
"bypass-app-banner-engagement-checks";
|
||||
|
||||
+// Hide all New Tab Page tiles, making it effectively empty all the time.
|
||||
+const char kHideNTPTiles[] = "hide-ntp-tiles";
|
||||
+
|
||||
// How often (in seconds) to check for updates. Should only be used for testing
|
||||
// purposes.
|
||||
const char kCheckForUpdateIntervalSec[] = "check-for-update-interval";
|
||||
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
|
||||
--- a/chrome/common/chrome_switches.h
|
||||
+++ b/chrome/common/chrome_switches.h
|
||||
@@ -46,6 +46,7 @@ extern const char kAuthServerWhitelist[];
|
||||
extern const char kAutoOpenDevToolsForTabs[];
|
||||
extern const char kAutoSelectDesktopCaptureSource[];
|
||||
extern const char kBypassAppBannerEngagementChecks[];
|
||||
+extern const char kHideNTPTiles[];
|
||||
extern const char kCheckForUpdateIntervalSec[];
|
||||
extern const char kCipherSuiteBlacklist[];
|
||||
extern const char kCloudPrintFile[];
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@@ -150,7 +150,7 @@ diff --git a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.
|
||||
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
|
||||
--- a/chrome/browser/chrome_content_browser_client.cc
|
||||
+++ b/chrome/browser/chrome_content_browser_client.cc
|
||||
@@ -4990,19 +4990,7 @@ ChromeContentBrowserClient::GetSafeBrowsingUrlCheckerDelegate(
|
||||
@@ -5010,19 +5010,7 @@ ChromeContentBrowserClient::GetSafeBrowsingUrlCheckerDelegate(
|
||||
content::ResourceContext* resource_context) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
||||
|
||||
|
||||
@@ -10,23 +10,127 @@ Add menu option to toggle global Adblock preference
|
||||
Allow toggling Chromium's "ads enabled" content settings option together with Bromite adblock engine.
|
||||
Perform adblock interception in StartJob to address lagging issues
|
||||
New mechanism for adblocking based on Brave's adblocking hook
|
||||
Add support for Webview content blocking
|
||||
---
|
||||
android_webview/browser/net/aw_network_delegate.cc | 68 ++++
|
||||
android_webview/browser/net/aw_network_delegate.h | 3 +
|
||||
chrome/android/java/res/menu/custom_tabs_menu.xml | 12 +
|
||||
chrome/android/java/res/menu/main_menu.xml | 11 +
|
||||
.../chromium/chrome/browser/ChromeActivity.java | 8 +
|
||||
.../chrome/browser/ChromeTabbedActivity.java | 8 +
|
||||
.../browser/appmenu/AppMenuPropertiesDelegate.java | 38 +++
|
||||
.../browser/appmenu/AppMenuPropertiesDelegate.java | 38 ++
|
||||
.../CustomTabAppMenuPropertiesDelegate.java | 2 +
|
||||
.../java/strings/android_chrome_strings.grd | 11 +
|
||||
chrome/browser/net/chrome_network_delegate.cc | 75 +++++
|
||||
chrome/browser/net/chrome_network_delegate.cc | 83 +++++
|
||||
.../subresource_filter_content_settings_manager.cc | 1 +
|
||||
net/BUILD.gn | 7 +
|
||||
net/url_request/adblock_intercept.cc | 341 +++++++++++++++++++++
|
||||
net/url_request/adblock_intercept.h | 41 +++
|
||||
12 files changed, 555 insertions(+)
|
||||
net/url_request/adblock_intercept.cc | 389 +++++++++++++++++++++
|
||||
net/url_request/adblock_intercept.h | 35 ++
|
||||
14 files changed, 676 insertions(+)
|
||||
create mode 100644 net/url_request/adblock_intercept.cc
|
||||
create mode 100644 net/url_request/adblock_intercept.h
|
||||
|
||||
diff --git a/android_webview/browser/net/aw_network_delegate.cc b/android_webview/browser/net/aw_network_delegate.cc
|
||||
--- a/android_webview/browser/net/aw_network_delegate.cc
|
||||
+++ b/android_webview/browser/net/aw_network_delegate.cc
|
||||
@@ -19,9 +19,11 @@
|
||||
#include "net/base/proxy_server.h"
|
||||
#include "net/http/http_response_headers.h"
|
||||
#include "net/proxy_resolution/proxy_info.h"
|
||||
+#include "net/url_request/adblock_intercept.h"
|
||||
#include "net/url_request/url_request.h"
|
||||
|
||||
using content::BrowserThread;
|
||||
+using content::ResourceRequestInfo;
|
||||
|
||||
namespace android_webview {
|
||||
|
||||
@@ -48,6 +50,72 @@ AwNetworkDelegate::AwNetworkDelegate() {}
|
||||
AwNetworkDelegate::~AwNetworkDelegate() {
|
||||
}
|
||||
|
||||
+#define TRANSPARENT1PXGIF "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"
|
||||
+#define EMPTYJS "data:text/javascript;base64,Cg=="
|
||||
+#define EMPTYCSS "data:text/css;base64,Cg=="
|
||||
+
|
||||
+static bool requestIntercepted(net::URLRequest* request, GURL* new_url) {
|
||||
+ bool block = false, isValidUrl;
|
||||
+
|
||||
+ isValidUrl = request->url().is_valid();
|
||||
+ std::string scheme = request->url().scheme();
|
||||
+ if (isValidUrl && scheme.length()) {
|
||||
+ std::transform(scheme.begin(), scheme.end(), scheme.begin(), ::tolower);
|
||||
+ if ("http" != scheme && "https" != scheme) {
|
||||
+ isValidUrl = false;
|
||||
+ }
|
||||
+ }
|
||||
+ const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);
|
||||
+
|
||||
+ // there are no per-site nor global ad/content settings when using the SystemWebView
|
||||
+ bool adblock_enabled = true;
|
||||
+ if (isValidUrl && info) {
|
||||
+ auto resource_type = info->GetResourceType();
|
||||
+
|
||||
+ if (adblock_enabled
|
||||
+ && content::RESOURCE_TYPE_MAIN_FRAME != resource_type
|
||||
+ && net::adblock_intercept(request->url(),
|
||||
+ request->initiator()->host(),
|
||||
+ resource_type)) {
|
||||
+ block = true;
|
||||
+ }
|
||||
+
|
||||
+ if (block) {
|
||||
+ switch (resource_type) {
|
||||
+ case content::RESOURCE_TYPE_IMAGE:
|
||||
+ case content::RESOURCE_TYPE_FAVICON:
|
||||
+ *new_url = GURL(TRANSPARENT1PXGIF);
|
||||
+ break;
|
||||
+ case content::RESOURCE_TYPE_SCRIPT:
|
||||
+ *new_url = GURL(EMPTYJS);
|
||||
+ break;
|
||||
+ case content::RESOURCE_TYPE_STYLESHEET:
|
||||
+ *new_url = GURL(EMPTYCSS);
|
||||
+ break;
|
||||
+ default:
|
||||
+ *new_url = GURL("");
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ } // valid URL and info
|
||||
+ return false;
|
||||
+}
|
||||
+#undef TRANSPARENT1PXGIF
|
||||
+#undef EMPTYJS
|
||||
+#undef EMPTYCSS
|
||||
+
|
||||
+int AwNetworkDelegate::OnBeforeURLRequest(net::URLRequest* request,
|
||||
+ net::CompletionOnceCallback callback,
|
||||
+ GURL* new_url) {
|
||||
+ if (request) {
|
||||
+ // most requests will be modified rather than intercepted
|
||||
+ if (requestIntercepted(request, new_url))
|
||||
+ return net::ERR_BLOCKED_BY_ADMINISTRATOR;
|
||||
+ } // request
|
||||
+
|
||||
+ return net::OK;
|
||||
+}
|
||||
+
|
||||
int AwNetworkDelegate::OnBeforeStartTransaction(
|
||||
net::URLRequest* request,
|
||||
net::CompletionOnceCallback callback,
|
||||
diff --git a/android_webview/browser/net/aw_network_delegate.h b/android_webview/browser/net/aw_network_delegate.h
|
||||
--- a/android_webview/browser/net/aw_network_delegate.h
|
||||
+++ b/android_webview/browser/net/aw_network_delegate.h
|
||||
@@ -22,6 +22,9 @@ class AwNetworkDelegate : public net::NetworkDelegateImpl {
|
||||
|
||||
private:
|
||||
// NetworkDelegate implementation.
|
||||
+ int OnBeforeURLRequest(net::URLRequest* request,
|
||||
+ net::CompletionOnceCallback callback,
|
||||
+ GURL* new_url) override;
|
||||
int OnBeforeStartTransaction(net::URLRequest* request,
|
||||
net::CompletionOnceCallback callback,
|
||||
net::HttpRequestHeaders* headers) override;
|
||||
diff --git a/chrome/android/java/res/menu/custom_tabs_menu.xml b/chrome/android/java/res/menu/custom_tabs_menu.xml
|
||||
--- a/chrome/android/java/res/menu/custom_tabs_menu.xml
|
||||
+++ b/chrome/android/java/res/menu/custom_tabs_menu.xml
|
||||
@@ -213,7 +317,7 @@ diff --git a/chrome/browser/net/chrome_network_delegate.cc b/chrome/browser/net/
|
||||
#endif
|
||||
|
||||
#if defined(OS_CHROMEOS)
|
||||
@@ -193,16 +195,89 @@ void ChromeNetworkDelegate::set_cookie_settings(
|
||||
@@ -193,10 +195,91 @@ void ChromeNetworkDelegate::set_cookie_settings(
|
||||
cookie_settings_ = cookie_settings;
|
||||
}
|
||||
|
||||
@@ -221,13 +325,7 @@ diff --git a/chrome/browser/net/chrome_network_delegate.cc b/chrome/browser/net/
|
||||
+#define EMPTYJS "data:text/javascript;base64,Cg=="
|
||||
+#define EMPTYCSS "data:text/css;base64,Cg=="
|
||||
+
|
||||
int ChromeNetworkDelegate::OnBeforeURLRequest(
|
||||
net::URLRequest* request,
|
||||
net::CompletionOnceCallback callback,
|
||||
GURL* new_url) {
|
||||
+
|
||||
+#if defined(OS_ANDROID)
|
||||
+ if (request) {
|
||||
+static bool requestIntercepted(net::URLRequest* request, GURL* new_url) {
|
||||
+ bool block = false, isValidUrl;
|
||||
+
|
||||
+ isValidUrl = request->url().is_valid();
|
||||
@@ -261,16 +359,18 @@ diff --git a/chrome/browser/net/chrome_network_delegate.cc b/chrome/browser/net/
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ auto resource_type = info->GetResourceType();
|
||||
+
|
||||
+ if (adblock_enabled
|
||||
+ && content::RESOURCE_TYPE_MAIN_FRAME != info->GetResourceType()
|
||||
+ && content::RESOURCE_TYPE_MAIN_FRAME != resource_type
|
||||
+ && net::adblock_intercept(request->url(),
|
||||
+ request->initiator()->host(),
|
||||
+ info->GetResourceType())) {
|
||||
+ resource_type)) {
|
||||
+ block = true;
|
||||
+ }
|
||||
+
|
||||
+ if (block) {
|
||||
+ switch (info->GetResourceType()) {
|
||||
+ switch (resource_type) {
|
||||
+ case content::RESOURCE_TYPE_IMAGE:
|
||||
+ case content::RESOURCE_TYPE_FAVICON:
|
||||
+ *new_url = GURL(TRANSPARENT1PXGIF);
|
||||
@@ -283,26 +383,32 @@ diff --git a/chrome/browser/net/chrome_network_delegate.cc b/chrome/browser/net/
|
||||
+ break;
|
||||
+ default:
|
||||
+ *new_url = GURL("");
|
||||
+ return net::ERR_BLOCKED_BY_ADMINISTRATOR;
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ } // valid URL and info
|
||||
+ return false;
|
||||
+}
|
||||
+#undef TRANSPARENT1PXGIF
|
||||
+#undef EMPTYJS
|
||||
+#undef EMPTYCSS
|
||||
+
|
||||
int ChromeNetworkDelegate::OnBeforeURLRequest(
|
||||
net::URLRequest* request,
|
||||
net::CompletionOnceCallback callback,
|
||||
GURL* new_url) {
|
||||
+
|
||||
+#if defined(OS_ANDROID)
|
||||
+ if (request) {
|
||||
+ // most requests will be modified rather than intercepted
|
||||
+ if (requestIntercepted(request, new_url))
|
||||
+ return net::ERR_BLOCKED_BY_ADMINISTRATOR;
|
||||
+ } // request
|
||||
+#endif // OS_ANDROID
|
||||
+
|
||||
extensions_delegate_->ForwardStartRequestStatus(request);
|
||||
|
||||
return extensions_delegate_->NotifyBeforeURLRequest(
|
||||
request, std::move(callback), new_url);
|
||||
}
|
||||
|
||||
+#undef TRANSPARENT1PXGIF
|
||||
+#undef EMPTYJS
|
||||
+#undef EMPTYCSS
|
||||
+
|
||||
int ChromeNetworkDelegate::OnBeforeStartTransaction(
|
||||
net::URLRequest* request,
|
||||
net::CompletionOnceCallback callback,
|
||||
diff --git a/chrome/browser/subresource_filter/subresource_filter_content_settings_manager.cc b/chrome/browser/subresource_filter/subresource_filter_content_settings_manager.cc
|
||||
--- a/chrome/browser/subresource_filter/subresource_filter_content_settings_manager.cc
|
||||
+++ b/chrome/browser/subresource_filter/subresource_filter_content_settings_manager.cc
|
||||
@@ -335,7 +441,7 @@ diff --git a/net/url_request/adblock_intercept.cc b/net/url_request/adblock_inte
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/net/url_request/adblock_intercept.cc
|
||||
@@ -0,0 +1,341 @@
|
||||
@@ -0,0 +1,389 @@
|
||||
+/*
|
||||
+ This file is part of Bromite.
|
||||
+
|
||||
@@ -352,7 +458,7 @@ new file mode 100644
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with Bromite. If not, see <https://www.gnu.org/licenses/>.
|
||||
+*/
|
||||
+#include "url/gurl.h"
|
||||
+#include "adblock_intercept.h"
|
||||
+
|
||||
+#ifdef ADB_TESTER
|
||||
+#include <cstddef>
|
||||
@@ -364,7 +470,6 @@ new file mode 100644
|
||||
+
|
||||
+#else
|
||||
+
|
||||
+#include "content/public/common/resource_type.h"
|
||||
+#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
|
||||
+#include <android/log.h>
|
||||
+
|
||||
@@ -384,7 +489,8 @@ new file mode 100644
|
||||
+// with a valid TLD. If |subdomain_permission| is ALLOW_SUBDOMAIN, we check
|
||||
+// against host "*.<domain_in_lower_case>.<TLD>" instead. Will return the TLD
|
||||
+// string in |tld|, if specified and the |host| can be parsed.
|
||||
+static bool is_first_party(char *l_host, char *l_url_host) {
|
||||
+static bool is_first_party(const char *l_host, int len, const char *l_url_host,
|
||||
+ int b_len) {
|
||||
+ size_t tld_length;
|
||||
+
|
||||
+#ifdef ADB_TESTER
|
||||
@@ -403,15 +509,14 @@ new file mode 100644
|
||||
+ return false;
|
||||
+#endif
|
||||
+
|
||||
+ int len = strlen(l_host);
|
||||
+ char *tld = l_host + len - tld_length;
|
||||
+ const char *tld = l_host + len - tld_length;
|
||||
+
|
||||
+ // Removes any subdomain from origin host.
|
||||
+ int i = len - tld_length - 2, top_i = i;
|
||||
+ if (i < 0) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ char *domain = l_host;
|
||||
+ const char *domain = l_host;
|
||||
+ for (; i >= 0; i--) {
|
||||
+ if (l_host[i] == '.') {
|
||||
+ int p_len = top_i - i;
|
||||
@@ -435,7 +540,6 @@ new file mode 100644
|
||||
+#endif
|
||||
+
|
||||
+ // Check if supplied URL host matches, including the dot.
|
||||
+ int b_len = strlen(l_url_host);
|
||||
+ if (b_len < len) {
|
||||
+ return false;
|
||||
+ }
|
||||
@@ -448,26 +552,38 @@ new file mode 100644
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+static char *strtolower(const char *str) {
|
||||
+ int len = strlen(str);
|
||||
+ char *ret = (char *)malloc(len + 1);
|
||||
+ ret[len] = '\0';
|
||||
+static char *strtolower(const char *str, int len, bool &should_free) {
|
||||
+ char *ret = NULL;
|
||||
+ for (int i = 0; i < len; i++) {
|
||||
+ if ((65 <= str[i]) && (str[i] <= 90)) {
|
||||
+ // first time a difference is found, allocate buffer and copy previous
|
||||
+ // characters (if any)
|
||||
+ if (ret == NULL) {
|
||||
+ ret = (char *)malloc(len + 1);
|
||||
+ if (i != 0)
|
||||
+ memcpy(ret, str, i);
|
||||
+ }
|
||||
+ // convert character to lower case
|
||||
+ ret[i] = str[i] + 32;
|
||||
+ } else {
|
||||
+ ret[i] = str[i];
|
||||
+ if (ret != NULL)
|
||||
+ ret[i] = str[i];
|
||||
+ }
|
||||
+ }
|
||||
+ return ret;
|
||||
+
|
||||
+ if (ret != NULL) {
|
||||
+ ret[len] = '\0';
|
||||
+ should_free = true;
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ // return source, unchanged
|
||||
+ return (char *)str;
|
||||
+}
|
||||
+
|
||||
+static char *strtosep(const char *str) {
|
||||
+ int len = strlen(str);
|
||||
+static char *strtosep(const char *str, int len) {
|
||||
+ char *ret = (char *)malloc(len + 3);
|
||||
+ ret[0] = '^';
|
||||
+ ret[len + 1] = '^';
|
||||
+ ret[len + 2] = '\0';
|
||||
+ for (int i = 0; i < len; i++) {
|
||||
+ if ((str[i] == ':') || (str[i] == '/') || (str[i] == '?') ||
|
||||
+ (str[i] == '&') || (str[i] == '=')) {
|
||||
@@ -476,6 +592,9 @@ new file mode 100644
|
||||
+ ret[i + 1] = str[i];
|
||||
+ }
|
||||
+ }
|
||||
+ // the index 'len' character is set by the previous loop
|
||||
+ ret[len + 1] = '^';
|
||||
+ ret[len + 2] = '\0';
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
@@ -562,9 +681,9 @@ new file mode 100644
|
||||
+ return match_domain;
|
||||
+}
|
||||
+
|
||||
+static bool url_match_party(adblock_entry *entry, const GURL &url,
|
||||
+ const std::string &origin_host, bool &checked_fp,
|
||||
+ bool &fp) {
|
||||
+static bool url_match_party(adblock_entry *entry, const char *l_origin_host,
|
||||
+ int origin_host_len, const char *l_url_host,
|
||||
+ int url_host_len, bool &checked_fp, bool &fp) {
|
||||
+ bool wanted_fp;
|
||||
+ if ((entry->flags & ADBLOCK_FLAG_THIRD_PARTY) != 0) {
|
||||
+ wanted_fp = false;
|
||||
@@ -575,104 +694,139 @@ new file mode 100644
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ if (origin_host.empty()) {
|
||||
+ if (origin_host_len == 0) {
|
||||
+ // cannot match this rule, no origin host to determine first/third party
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+#ifdef ADB_TESTER
|
||||
+//__android_log_print(ANDROID_LOG_INFO, LOG_TAG, "matchFirst=%d matchThird=%d",
|
||||
+// matchFirstParty, matchThirdParty);
|
||||
+#endif
|
||||
+ if (!checked_fp) {
|
||||
+ // lower-case version
|
||||
+ char *l_host = strtolower(origin_host.c_str()),
|
||||
+ *l_url_host = strtolower(url.host().c_str());
|
||||
+
|
||||
+ // is the URL a first-party to the current page's host?
|
||||
+ fp = is_first_party(l_host, l_url_host);
|
||||
+ fp = is_first_party(l_origin_host, origin_host_len, l_url_host,
|
||||
+ url_host_len);
|
||||
+
|
||||
+ checked_fp = true;
|
||||
+#ifdef ADB_TESTER
|
||||
+ __android_log_print(ANDROID_LOG_INFO, LOG_TAG,
|
||||
+ "is_first_party(\"%s\", \"%s\") = %s", l_host,
|
||||
+ "is_first_party(\"%s\", \"%s\") = %s", l_origin_host,
|
||||
+ l_url_host, fp ? "true" : "false");
|
||||
+#endif
|
||||
+ free(l_host);
|
||||
+ free(l_url_host);
|
||||
+ }
|
||||
+
|
||||
+ return fp == wanted_fp;
|
||||
+}
|
||||
+
|
||||
+int adblock_intercept(const GURL &url, const std::string &origin_host
|
||||
+#ifndef ADB_TESTER
|
||||
+, content::ResourceType resource_type
|
||||
+static bool resource_type_match(adblock_entry *entry,
|
||||
+ content::ResourceType resource_type) {
|
||||
+ bool exclude;
|
||||
+ if ((entry->flags & ADBLOCK_FLAG_RESOURCE_TYPE_IN) != 0) {
|
||||
+ exclude = false;
|
||||
+ } else if ((entry->flags & ADBLOCK_FLAG_RESOURCE_TYPE_NOT_IN) != 0) {
|
||||
+ exclude = true;
|
||||
+ } else {
|
||||
+ // no resource type matching
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ // use a bitwise trick to test for the current resource type
|
||||
+ bool found = (entry->flags & (resource_type << 16));
|
||||
+ if (!exclude)
|
||||
+ return found;
|
||||
+ return !found;
|
||||
+}
|
||||
+
|
||||
+int adblock_intercept(const GURL &url, const std::string &origin_host,
|
||||
+ content::ResourceType resource_type) {
|
||||
+ // these are verified on caller when not testing
|
||||
+#ifdef ADB_TESTER
|
||||
+ if (!url.is_valid() || !url.SchemeIsHTTPOrHTTPS()) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+#endif
|
||||
+) {
|
||||
+ if (url.is_valid() && url.SchemeIsHTTPOrHTTPS()) {
|
||||
+ const char *c_url = url.spec().c_str();
|
||||
+ char *c_url_lower = strtolower(c_url);
|
||||
+ char *c_url_sep = strtosep(c_url);
|
||||
+ char *c_url_lower_sep = strtosep(c_url_lower);
|
||||
+
|
||||
+ bool free1 = false, free2 = false, free3 = false, free4 = false;
|
||||
+ int url_len = url.spec().size();
|
||||
+ const char *c_url = url.spec().c_str();
|
||||
+ char *c_url_lower = strtolower(c_url, url_len, free1);
|
||||
+ char *c_url_sep = strtosep(c_url, url_len);
|
||||
+ char *c_url_lower_sep = strtolower(c_url_sep, url_len + 2, free4);
|
||||
+
|
||||
+ // might be empty in case of no host
|
||||
+ const char *origin_host_cstr = origin_host.c_str();
|
||||
+ int origin_host_len = origin_host.size(), url_host_len = url.host().size();
|
||||
+
|
||||
+ // lower-case version of origin and url hosts
|
||||
+ const char *c_origin_host_lower =
|
||||
+ strtolower(origin_host_cstr, origin_host_len, free2),
|
||||
+ *c_url_host_lower =
|
||||
+ strtolower(url.host().c_str(), url_host_len, free3);
|
||||
+
|
||||
+#ifdef ADBLOCK_LOG
|
||||
+ __android_log_print(ANDROID_LOG_INFO, LOG_TAG, "[%s with host '%s'] [%s]",
|
||||
+ c_url, url.host().c_str(), origin_host.c_str());
|
||||
+ __android_log_print(ANDROID_LOG_INFO, LOG_TAG, "[%s with host '%s'] [%s]",
|
||||
+ c_url, url.host().c_str(), origin_host_cstr);
|
||||
+#endif
|
||||
+
|
||||
+ bool checked_fp = false, fp = false;
|
||||
+ bool checked_fp = false, fp = false;
|
||||
+
|
||||
+ bool intercept = false;
|
||||
+ for (int i = 0; i < ADBLOCK_ENTRY_COUNT; i++) {
|
||||
+ adblock_entry *entry = &ADBLOCK_ENTRIES[i];
|
||||
+ bool intercept = false;
|
||||
+ for (int i = 0; i < ADBLOCK_ENTRY_COUNT; i++) {
|
||||
+ adblock_entry *entry = &ADBLOCK_ENTRIES[i];
|
||||
+
|
||||
+ // no use checking rules when we're intercepting, or exceptions when not
|
||||
+ bool check =
|
||||
+ (!intercept && ((entry->flags & ADBLOCK_FLAG_EXCEPTION) == 0)) ||
|
||||
+ (intercept && ((entry->flags & ADBLOCK_FLAG_EXCEPTION) != 0));
|
||||
+ if (!check)
|
||||
+ continue;
|
||||
+ // no use checking rules when we're intercepting, or exceptions when not
|
||||
+ bool check =
|
||||
+ (!intercept && ((entry->flags & ADBLOCK_FLAG_EXCEPTION) == 0)) ||
|
||||
+ (intercept && ((entry->flags & ADBLOCK_FLAG_EXCEPTION) != 0));
|
||||
+ if (!check)
|
||||
+ continue;
|
||||
+
|
||||
+ // first check for domain matches, a quick branch out if matching
|
||||
+ if (!url_match_domain(entry, origin_host))
|
||||
+ continue;
|
||||
+ // check for resource type
|
||||
+ if (!resource_type_match(entry, resource_type))
|
||||
+ continue;
|
||||
+
|
||||
+ // check on the URL matcher
|
||||
+ if (!url_matches(c_url, c_url_sep, c_url_lower, c_url_lower_sep, entry))
|
||||
+ continue;
|
||||
+ // check for domain matches, a quick branch out if not matching
|
||||
+ if (!url_match_domain(entry, origin_host))
|
||||
+ continue;
|
||||
+
|
||||
+ // finally check first/third-party
|
||||
+ if (!url_match_party(entry, url, origin_host, checked_fp, fp))
|
||||
+ continue;
|
||||
+ // check on the URL matcher
|
||||
+ if (!url_matches(c_url, c_url_sep, c_url_lower, c_url_lower_sep, entry))
|
||||
+ continue;
|
||||
+
|
||||
+ // finally check first/third-party
|
||||
+ if (!url_match_party(entry, c_origin_host_lower, origin_host_len,
|
||||
+ c_url_host_lower, url_host_len, checked_fp, fp))
|
||||
+ continue;
|
||||
+
|
||||
+#ifdef ADBLOCK_LOG
|
||||
+ if (!intercept) {
|
||||
+ __android_log_print(ANDROID_LOG_INFO, LOG_TAG,
|
||||
+ "--> intercept (#%d: \"%s\") (%x)", i,
|
||||
+ entry->matches[0], entry->flags);
|
||||
+ } else {
|
||||
+ __android_log_print(ANDROID_LOG_INFO, LOG_TAG, "--> pass (%d) (#%d)", i,
|
||||
+ entry->flags);
|
||||
+ }
|
||||
+ if (!intercept) {
|
||||
+ __android_log_print(ANDROID_LOG_INFO, LOG_TAG,
|
||||
+ "--> intercept (#%d: \"%s\") (%x)", i,
|
||||
+ entry->matches[0], entry->flags);
|
||||
+ } else {
|
||||
+ __android_log_print(ANDROID_LOG_INFO, LOG_TAG, "--> pass (%d) (#%d)", i,
|
||||
+ entry->flags);
|
||||
+ }
|
||||
+#endif
|
||||
+ intercept = !intercept;
|
||||
+ } // for each entry
|
||||
+ intercept = !intercept;
|
||||
+ } // for each entry
|
||||
+
|
||||
+ free(c_url_sep);
|
||||
+ if (free3)
|
||||
+ free((void *)c_url_host_lower);
|
||||
+ if (free2)
|
||||
+ free((void *)c_origin_host_lower);
|
||||
+ free(c_url_sep);
|
||||
+ if (free1)
|
||||
+ free(c_url_lower);
|
||||
+ if (free4)
|
||||
+ free(c_url_lower_sep);
|
||||
+
|
||||
+ if (intercept) {
|
||||
+ if (intercept) {
|
||||
+#ifdef ADBLOCK_LOG
|
||||
+ __android_log_print(ANDROID_LOG_INFO, LOG_TAG, "blocked");
|
||||
+#endif
|
||||
+ return 1;
|
||||
+ }
|
||||
+#ifdef ADBLOCK_LOG
|
||||
+ __android_log_print(ANDROID_LOG_INFO, LOG_TAG, "pass");
|
||||
+ __android_log_print(ANDROID_LOG_INFO, LOG_TAG, "blocked");
|
||||
+#endif
|
||||
+ return 1;
|
||||
+ }
|
||||
+#ifdef ADBLOCK_LOG
|
||||
+ __android_log_print(ANDROID_LOG_INFO, LOG_TAG, "pass");
|
||||
+#endif
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
@@ -681,7 +835,7 @@ diff --git a/net/url_request/adblock_intercept.h b/net/url_request/adblock_inter
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/net/url_request/adblock_intercept.h
|
||||
@@ -0,0 +1,41 @@
|
||||
@@ -0,0 +1,35 @@
|
||||
+/*
|
||||
+ This file is part of Bromite.
|
||||
+
|
||||
@@ -702,11 +856,8 @@ new file mode 100644
|
||||
+#ifndef NET_URL_REQUEST_ADBLOCK_INTERCEPT_H_
|
||||
+#define NET_URL_REQUEST_ADBLOCK_INTERCEPT_H_
|
||||
+
|
||||
+#include "url/gurl.h"
|
||||
+
|
||||
+#ifndef ADB_TESTER
|
||||
+#include "content/public/common/resource_type.h"
|
||||
+#endif
|
||||
+#include "url/gurl.h"
|
||||
+
|
||||
+namespace net {
|
||||
+
|
||||
@@ -714,11 +865,8 @@ new file mode 100644
|
||||
+int adblock_rules_count();
|
||||
+#endif
|
||||
+
|
||||
+int adblock_intercept(const GURL &url, const std::string &origin_host
|
||||
+#ifndef ADB_TESTER
|
||||
+, content::ResourceType resource_type
|
||||
+#endif
|
||||
+);
|
||||
+int adblock_intercept(const GURL &url, const std::string &origin_host,
|
||||
+ content::ResourceType resource_type);
|
||||
+
|
||||
+} // namespace net
|
||||
+
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
From: csagan5 <32685696+csagan5@users.noreply.github.com>
|
||||
Date: Wed, 20 Feb 2019 21:41:26 +0100
|
||||
Subject: Disable metrics collection for NTP tiles
|
||||
|
||||
---
|
||||
.../android/ntp/most_visited_sites_bridge.cc | 21 ---------------------
|
||||
components/ntp_tiles/BUILD.gn | 3 ---
|
||||
2 files changed, 24 deletions(-)
|
||||
|
||||
diff --git a/chrome/browser/android/ntp/most_visited_sites_bridge.cc b/chrome/browser/android/ntp/most_visited_sites_bridge.cc
|
||||
--- a/chrome/browser/android/ntp/most_visited_sites_bridge.cc
|
||||
+++ b/chrome/browser/android/ntp/most_visited_sites_bridge.cc
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "chrome/browser/thumbnails/thumbnail_list_source.h"
|
||||
#include "components/favicon_base/favicon_types.h"
|
||||
#include "components/history/core/browser/history_service.h"
|
||||
-#include "components/ntp_tiles/metrics.h"
|
||||
#include "components/ntp_tiles/most_visited_sites.h"
|
||||
#include "components/ntp_tiles/section_type.h"
|
||||
#include "components/rappor/rappor_service_impl.h"
|
||||
@@ -47,7 +46,6 @@ using ntp_tiles::NTPTilesVector;
|
||||
using ntp_tiles::SectionType;
|
||||
using ntp_tiles::TileTitleSource;
|
||||
using ntp_tiles::TileSource;
|
||||
-using ntp_tiles::TileVisualType;
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -252,7 +250,6 @@ void MostVisitedSitesBridge::RecordPageImpression(
|
||||
JNIEnv* env,
|
||||
const JavaParamRef<jobject>& obj,
|
||||
jint jtiles_count) {
|
||||
- ntp_tiles::metrics::RecordPageImpression(jtiles_count);
|
||||
}
|
||||
|
||||
void MostVisitedSitesBridge::RecordTileImpression(
|
||||
@@ -265,18 +262,6 @@ void MostVisitedSitesBridge::RecordTileImpression(
|
||||
jint jsource,
|
||||
jlong jdata_generation_time_ms,
|
||||
const JavaParamRef<jstring>& jurl) {
|
||||
- GURL url(ConvertJavaStringToUTF8(env, jurl));
|
||||
- TileTitleSource title_source = static_cast<TileTitleSource>(jtitle_source);
|
||||
- TileSource source = static_cast<TileSource>(jsource);
|
||||
- TileVisualType visual_type = static_cast<TileVisualType>(jvisual_type);
|
||||
- favicon_base::IconType icon_type =
|
||||
- static_cast<favicon_base::IconType>(jicon_type);
|
||||
-
|
||||
- ntp_tiles::metrics::RecordTileImpression(
|
||||
- ntp_tiles::NTPTileImpression(
|
||||
- jindex, source, title_source, visual_type, icon_type,
|
||||
- base::Time::FromJavaTime(jdata_generation_time_ms), url),
|
||||
- g_browser_process->rappor_service());
|
||||
}
|
||||
|
||||
void MostVisitedSitesBridge::RecordOpenedMostVisitedItem(
|
||||
@@ -287,12 +272,6 @@ void MostVisitedSitesBridge::RecordOpenedMostVisitedItem(
|
||||
jint title_source,
|
||||
jint source,
|
||||
jlong jdata_generation_time_ms) {
|
||||
- ntp_tiles::metrics::RecordTileClick(ntp_tiles::NTPTileImpression(
|
||||
- index, static_cast<TileSource>(source),
|
||||
- static_cast<TileTitleSource>(title_source),
|
||||
- static_cast<TileVisualType>(tile_type), favicon_base::IconType::kInvalid,
|
||||
- base::Time::FromJavaTime(jdata_generation_time_ms),
|
||||
- /*url_for_rappor=*/GURL()));
|
||||
}
|
||||
|
||||
static jlong JNI_MostVisitedSitesBridge_Init(
|
||||
diff --git a/components/ntp_tiles/BUILD.gn b/components/ntp_tiles/BUILD.gn
|
||||
--- a/components/ntp_tiles/BUILD.gn
|
||||
+++ b/components/ntp_tiles/BUILD.gn
|
||||
@@ -20,8 +20,6 @@ static_library("ntp_tiles") {
|
||||
"icon_cacher.h",
|
||||
"icon_cacher_impl.cc",
|
||||
"icon_cacher_impl.h",
|
||||
- "metrics.cc",
|
||||
- "metrics.h",
|
||||
"most_visited_sites.cc",
|
||||
"most_visited_sites.h",
|
||||
"ntp_tile.cc",
|
||||
@@ -91,7 +89,6 @@ source_set("unit_tests") {
|
||||
"custom_links_manager_impl_unittest.cc",
|
||||
"custom_links_store_unittest.cc",
|
||||
"icon_cacher_impl_unittest.cc",
|
||||
- "metrics_unittest.cc",
|
||||
"most_visited_sites_unittest.cc",
|
||||
"popular_sites_impl_unittest.cc",
|
||||
]
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@@ -2,10 +2,55 @@ 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)
|
||||
---
|
||||
chrome/common/chrome_features.cc | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
.../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
|
||||
@@ -343,11 +343,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.
|
||||
@@ -380,10 +376,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.
|
||||
@@ -409,11 +403,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
|
||||
|
||||
@@ -36,7 +36,7 @@ diff --git a/chrome/browser/background/background_mode_manager.cc b/chrome/brows
|
||||
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
|
||||
--- a/chrome/browser/chrome_content_browser_client.cc
|
||||
+++ b/chrome/browser/chrome_content_browser_client.cc
|
||||
@@ -1055,7 +1055,7 @@ void ChromeContentBrowserClient::RegisterLocalStatePrefs(
|
||||
@@ -1058,7 +1058,7 @@ void ChromeContentBrowserClient::RegisterLocalStatePrefs(
|
||||
void ChromeContentBrowserClient::RegisterProfilePrefs(
|
||||
user_prefs::PrefRegistrySyncable* registry) {
|
||||
registry->RegisterBooleanPref(prefs::kDisable3DAPIs, false);
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
From: csagan5 <32685696+csagan5@users.noreply.github.com>
|
||||
Date: Wed, 21 Feb 2018 00:32:09 +0100
|
||||
Subject: Use 4 tile rows, never show logo
|
||||
|
||||
---
|
||||
.../java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java | 6 +++---
|
||||
.../chromium/chrome/browser/suggestions/MostVisitedSitesBridge.java | 2 +-
|
||||
.../src/org/chromium/chrome/browser/suggestions/SiteSection.java | 2 +-
|
||||
components/history/core/browser/top_sites_impl.cc | 2 +-
|
||||
components/history/core/browser/top_sites_impl.h | 4 ++--
|
||||
components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc | 2 +-
|
||||
6 files changed, 9 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java
|
||||
@@ -117,7 +117,7 @@ public class NewTabPageLayout extends LinearLayout implements TileGroup.Observer
|
||||
/** Observer for overview mode. */
|
||||
private EmptyOverviewModeObserver mOverviewObserver;
|
||||
|
||||
- private boolean mSearchProviderHasLogo = true;
|
||||
+ private boolean mSearchProviderHasLogo = false;
|
||||
private boolean mSearchProviderIsGoogle;
|
||||
|
||||
private boolean mInitialized;
|
||||
@@ -548,7 +548,7 @@ public class NewTabPageLayout extends LinearLayout implements TileGroup.Observer
|
||||
&& mInitialized) {
|
||||
return;
|
||||
}
|
||||
- mSearchProviderHasLogo = hasLogo;
|
||||
+ mSearchProviderHasLogo = false;
|
||||
mSearchProviderIsGoogle = isGoogle;
|
||||
|
||||
updateTileGridPadding();
|
||||
@@ -831,7 +831,7 @@ public class NewTabPageLayout extends LinearLayout implements TileGroup.Observer
|
||||
}
|
||||
|
||||
private static int getMaxTileRows() {
|
||||
- return 2;
|
||||
+ return 4;
|
||||
}
|
||||
|
||||
/**
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/suggestions/MostVisitedSitesBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/suggestions/MostVisitedSitesBridge.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/suggestions/MostVisitedSitesBridge.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/suggestions/MostVisitedSitesBridge.java
|
||||
@@ -27,7 +27,7 @@ public class MostVisitedSitesBridge
|
||||
* Maximum number of tiles that is explicitly supported. UMA relies on this value, so even if
|
||||
* the UI supports it, getting more can raise unexpected issues.
|
||||
*/
|
||||
- public static final int MAX_TILE_COUNT = 12;
|
||||
+ public static final int MAX_TILE_COUNT = 12 * 2;
|
||||
|
||||
private long mNativeMostVisitedSitesBridge;
|
||||
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/suggestions/SiteSection.java b/chrome/android/java/src/org/chromium/chrome/browser/suggestions/SiteSection.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/suggestions/SiteSection.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/suggestions/SiteSection.java
|
||||
@@ -110,7 +110,7 @@ public class SiteSection extends OptionalLeaf implements TileGroup.Observer {
|
||||
if (ChromeFeatureList.isEnabled(ChromeFeatureList.EXPLORE_SITES)) {
|
||||
return 1;
|
||||
}
|
||||
- return 2;
|
||||
+ return 4;
|
||||
}
|
||||
|
||||
@LayoutRes
|
||||
diff --git a/components/history/core/browser/top_sites_impl.cc b/components/history/core/browser/top_sites_impl.cc
|
||||
--- a/components/history/core/browser/top_sites_impl.cc
|
||||
+++ b/components/history/core/browser/top_sites_impl.cc
|
||||
@@ -83,7 +83,7 @@ bool DoTitlesDiffer(const MostVisitedURLList& old_list,
|
||||
|
||||
// Max number of temporary images we'll cache. See comment above
|
||||
// temp_images_ for details.
|
||||
-const size_t kMaxTempTopImages = 8;
|
||||
+const size_t kMaxTempTopImages = 8 * 2;
|
||||
|
||||
// The delay for the first HistoryService query at startup.
|
||||
constexpr base::TimeDelta kFirstDelayAtStartup =
|
||||
diff --git a/components/history/core/browser/top_sites_impl.h b/components/history/core/browser/top_sites_impl.h
|
||||
--- a/components/history/core/browser/top_sites_impl.h
|
||||
+++ b/components/history/core/browser/top_sites_impl.h
|
||||
@@ -60,10 +60,10 @@ class TopSitesImpl : public TopSites, public HistoryServiceObserver {
|
||||
using CanAddURLToHistoryFn = base::Callback<bool(const GURL&)>;
|
||||
|
||||
// How many non-forced top sites to store in the cache.
|
||||
- static constexpr size_t kNonForcedTopSitesNumber = 10;
|
||||
+ static constexpr size_t kNonForcedTopSitesNumber = 4 * 4 + 2;
|
||||
|
||||
// How many forced top sites to store in the cache.
|
||||
- static constexpr size_t kForcedTopSitesNumber = 10;
|
||||
+ static constexpr size_t kForcedTopSitesNumber = 4 * 4 + 2;
|
||||
|
||||
TopSitesImpl(PrefService* pref_service,
|
||||
HistoryService* history_service,
|
||||
diff --git a/components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc b/components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc
|
||||
--- a/components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc
|
||||
+++ b/components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc
|
||||
@@ -30,7 +30,7 @@ namespace ntp_snippets {
|
||||
|
||||
namespace {
|
||||
|
||||
-const int kMaxBookmarks = 10;
|
||||
+const int kMaxBookmarks = 4 * 4 + 2;
|
||||
const int kMaxBookmarkAgeInDays = 7;
|
||||
|
||||
const char* kMaxBookmarksParamName = "bookmarks_max_count";
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@@ -215,7 +215,7 @@ diff --git a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.
|
||||
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
|
||||
--- a/chrome/browser/chrome_content_browser_client.cc
|
||||
+++ b/chrome/browser/chrome_content_browser_client.cc
|
||||
@@ -830,30 +830,6 @@ void SetApplicationLocaleOnIOThread(const std::string& locale) {
|
||||
@@ -833,30 +833,6 @@ void SetApplicationLocaleOnIOThread(const std::string& locale) {
|
||||
GetIOThreadApplicationLocale() = locale;
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/ch
|
||||
#if defined(OS_ANDROID)
|
||||
float GetDeviceScaleAdjustment() {
|
||||
static const float kMinFSM = 1.05f;
|
||||
@@ -2004,7 +1980,7 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
|
||||
@@ -2007,7 +1983,7 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
|
||||
// Disable client-side phishing detection in the renderer if it is
|
||||
// disabled in the Profile preferences or the browser process.
|
||||
if (!prefs->GetBoolean(prefs::kSafeBrowsingEnabled) ||
|
||||
@@ -255,7 +255,7 @@ diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/ch
|
||||
command_line->AppendSwitch(
|
||||
switches::kDisableClientSidePhishingDetection);
|
||||
}
|
||||
@@ -2694,7 +2670,7 @@ void ChromeContentBrowserClient::AllowCertificateError(
|
||||
@@ -2697,7 +2673,7 @@ void ChromeContentBrowserClient::AllowCertificateError(
|
||||
SSLErrorHandler::HandleSSLError(
|
||||
web_contents, cert_error, ssl_info, request_url,
|
||||
expired_previous_decision,
|
||||
@@ -264,7 +264,7 @@ diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/ch
|
||||
callback, SSLErrorHandler::BlockingPageReadyCallback());
|
||||
}
|
||||
|
||||
@@ -2974,8 +2950,6 @@ bool ChromeContentBrowserClient::CanCreateWindow(
|
||||
@@ -2977,8 +2953,6 @@ bool ChromeContentBrowserClient::CanCreateWindow(
|
||||
void ChromeContentBrowserClient::ResourceDispatcherHostCreated() {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||
|
||||
@@ -273,7 +273,7 @@ diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/ch
|
||||
for (size_t i = 0; i < extra_parts_.size(); ++i)
|
||||
extra_parts_[i]->ResourceDispatcherHostCreated();
|
||||
|
||||
@@ -4181,7 +4155,7 @@ ChromeContentBrowserClient::CreateThrottlesForNavigation(
|
||||
@@ -4201,7 +4175,7 @@ ChromeContentBrowserClient::CreateThrottlesForNavigation(
|
||||
if (base::FeatureList::IsEnabled(features::kSSLCommittedInterstitials)) {
|
||||
throttles.push_back(std::make_unique<SSLErrorNavigationThrottle>(
|
||||
handle,
|
||||
|
||||
@@ -108,3 +108,6 @@ Add-a-proxy-configuration-page.patch
|
||||
Do-not-ignore-download-location-prompt-setting.patch
|
||||
Disable-previews-by-default.patch
|
||||
Rollback-android-minSdkVersion-from-19-KitKat-to-16-JellyBean.patch
|
||||
Add-flag-to-show-hide-NTP-tiles.patch
|
||||
Use-4-tile-rows-never-show-logo.patch
|
||||
Disable-metrics-collection-for-NTP-tiles.patch
|
||||
|
||||
Reference in New Issue
Block a user