Release 68.0.3440.121
This commit is contained in:
parent
3624b67e98
commit
f21bb8a1d4
48 changed files with 1479 additions and 492 deletions
|
@ -1,3 +1,11 @@
|
|||
# 68.0.3440.121
|
||||
* add option to not persist tabs across sessions (fixes https://github.com/bromite/bromite/issues/106)
|
||||
* always incognito mode (fixes https://github.com/bromite/bromite/issues/18)
|
||||
* disable domain reliability (ungoogled-chromium)
|
||||
* more efficient adblock interception by using proper handler
|
||||
* fix log message about default maximum connections
|
||||
* improvement for exit menu patch
|
||||
|
||||
# 68.0.3440.110
|
||||
* add import action to Bookmarks activity page
|
||||
* use different user-agent version based on Android OS version
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -152,7 +152,7 @@ diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums
|
|||
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
|
||||
--- a/tools/metrics/histograms/histograms.xml
|
||||
+++ b/tools/metrics/histograms/histograms.xml
|
||||
@@ -111339,6 +111339,7 @@ uploading your change for review.
|
||||
@@ -111352,6 +111352,7 @@ uploading your change for review.
|
||||
<suffix name="Overestimate"
|
||||
label="Tracks when the compositor's estimates were too high and by how
|
||||
much."/>
|
||||
|
|
|
@ -0,0 +1,676 @@
|
|||
From: csagan5 <32685696+csagan5@users.noreply.github.com>
|
||||
Date: Sat, 25 Aug 2018 22:58:52 +0200
|
||||
Subject: ungoogled-chromium: Disable domain reliability
|
||||
|
||||
---
|
||||
components/domain_reliability/BUILD.gn | 42 +-
|
||||
components/domain_reliability/bake_in_configs.py | 2 +-
|
||||
components/domain_reliability/google_configs.cc | 565 -----------------------
|
||||
components/domain_reliability/uploader.cc | 2 +-
|
||||
4 files changed, 17 insertions(+), 594 deletions(-)
|
||||
|
||||
diff --git a/components/domain_reliability/BUILD.gn b/components/domain_reliability/BUILD.gn
|
||||
--- a/components/domain_reliability/BUILD.gn
|
||||
+++ b/components/domain_reliability/BUILD.gn
|
||||
@@ -7,26 +7,6 @@ action("bake_in_configs") {
|
||||
script = "bake_in_configs.py"
|
||||
|
||||
inputs = [
|
||||
- "baked_in_configs/c_android_clients_google_com.json",
|
||||
- "baked_in_configs/c_bigcache_googleapis_com.json",
|
||||
- "baked_in_configs/c_doc-0-0-sj_sj_googleusercontent_com.json",
|
||||
- "baked_in_configs/c_docs_google_com.json",
|
||||
- "baked_in_configs/c_drive_google_com.json",
|
||||
- "baked_in_configs/c_googlesyndication_com.json",
|
||||
- "baked_in_configs/c_pack_google_com.json",
|
||||
- "baked_in_configs/c_play_google_com.json",
|
||||
- "baked_in_configs/c_youtube_com.json",
|
||||
- "baked_in_configs/clients2_google_com.json",
|
||||
- "baked_in_configs/docs_google_com.json",
|
||||
- "baked_in_configs/gcp_gvt2_com.json",
|
||||
- "baked_in_configs/gcp_gvt6_com.json",
|
||||
- "baked_in_configs/google-analytics_com.json",
|
||||
- "baked_in_configs/googlevideo_com.json",
|
||||
- "baked_in_configs/gvt1_com.json",
|
||||
- "baked_in_configs/gvt2_com.json",
|
||||
- "baked_in_configs/gvt6_com.json",
|
||||
- "baked_in_configs/ssl_gstatic_com.json",
|
||||
- "baked_in_configs/www_google_com.json",
|
||||
]
|
||||
|
||||
output_file = "$target_gen_dir/baked_in_configs.cc"
|
||||
@@ -36,13 +16,21 @@ action("bake_in_configs") {
|
||||
|
||||
# The JSON file list is too long for the command line on Windows, so put
|
||||
# them in a response file.
|
||||
- response_file_contents = rebase_path(inputs, root_build_dir)
|
||||
- args = [
|
||||
- "--file-list",
|
||||
- "{{response_file_name}}",
|
||||
- "--output",
|
||||
- rebase_path(output_file, root_build_dir),
|
||||
- ]
|
||||
+ if (is_win) {
|
||||
+ args = [
|
||||
+ "--file-list",
|
||||
+ "nul",
|
||||
+ "--output",
|
||||
+ rebase_path(output_file, root_build_dir),
|
||||
+ ]
|
||||
+ } else {
|
||||
+ args = [
|
||||
+ "--file-list",
|
||||
+ "/dev/null",
|
||||
+ "--output",
|
||||
+ rebase_path(output_file, root_build_dir),
|
||||
+ ]
|
||||
+ }
|
||||
}
|
||||
|
||||
component("domain_reliability") {
|
||||
diff --git a/components/domain_reliability/bake_in_configs.py b/components/domain_reliability/bake_in_configs.py
|
||||
--- a/components/domain_reliability/bake_in_configs.py
|
||||
+++ b/components/domain_reliability/bake_in_configs.py
|
||||
@@ -489,7 +489,7 @@ def origin_is_whitelisted(origin):
|
||||
domain = origin[8:-1]
|
||||
else:
|
||||
return False
|
||||
- return any(domain == e or domain.endswith('.' + e) for e in DOMAIN_WHITELIST)
|
||||
+ return False
|
||||
|
||||
|
||||
def quote_and_wrap_text(text, width=79, prefix=' "', suffix='"'):
|
||||
diff --git a/components/domain_reliability/google_configs.cc b/components/domain_reliability/google_configs.cc
|
||||
--- a/components/domain_reliability/google_configs.cc
|
||||
+++ b/components/domain_reliability/google_configs.cc
|
||||
@@ -13,575 +13,10 @@
|
||||
|
||||
namespace domain_reliability {
|
||||
|
||||
-namespace {
|
||||
-
|
||||
-struct GoogleConfigParams {
|
||||
- const char* hostname;
|
||||
- bool include_subdomains;
|
||||
-
|
||||
- // If true, prepend a collector URL within https://|hostname|/.
|
||||
- bool include_origin_specific_collector;
|
||||
-
|
||||
- // If true, also add a config for www.|hostname|.
|
||||
- //
|
||||
- // |include_subdomains| will be false in the extra config, but
|
||||
- // |include_origin_specific_collector| will be respected, and will use the
|
||||
- // www subdomain as the origin for the collector so it matches the config.
|
||||
- bool duplicate_for_www;
|
||||
-};
|
||||
-
|
||||
-const GoogleConfigParams kGoogleConfigs[] = {
|
||||
- // Origins with subdomains and same-origin collectors. Currently, all
|
||||
- // origins with same-origin collectors also run collectors on their www
|
||||
- // subdomain. (e.g., both foo.com and www.foo.com.)
|
||||
- {"google.ac", true, true, true},
|
||||
- {"google.ad", true, true, true},
|
||||
- {"google.ae", true, true, true},
|
||||
- {"google.af", true, true, true},
|
||||
- {"google.ag", true, true, true},
|
||||
- {"google.al", true, true, true},
|
||||
- {"google.am", true, true, true},
|
||||
- {"google.as", true, true, true},
|
||||
- {"google.at", true, true, true},
|
||||
- {"google.az", true, true, true},
|
||||
- {"google.ba", true, true, true},
|
||||
- {"google.be", true, true, true},
|
||||
- {"google.bf", true, true, true},
|
||||
- {"google.bg", true, true, true},
|
||||
- {"google.bi", true, true, true},
|
||||
- {"google.bj", true, true, true},
|
||||
- {"google.bs", true, true, true},
|
||||
- {"google.bt", true, true, true},
|
||||
- {"google.by", true, true, true},
|
||||
- {"google.ca", true, true, true},
|
||||
- {"google.cc", true, true, true},
|
||||
- {"google.cd", true, true, true},
|
||||
- {"google.cf", true, true, true},
|
||||
- {"google.cg", true, true, true},
|
||||
- {"google.ch", true, true, true},
|
||||
- {"google.ci", true, true, true},
|
||||
- {"google.cl", true, true, true},
|
||||
- {"google.cm", true, true, true},
|
||||
- {"google.cn", true, true, true},
|
||||
- {"google.co.ao", true, true, true},
|
||||
- {"google.co.bw", true, true, true},
|
||||
- {"google.co.ck", true, true, true},
|
||||
- {"google.co.cr", true, true, true},
|
||||
- {"google.co.hu", true, true, true},
|
||||
- {"google.co.id", true, true, true},
|
||||
- {"google.co.il", true, true, true},
|
||||
- {"google.co.im", true, true, true},
|
||||
- {"google.co.in", true, true, true},
|
||||
- {"google.co.je", true, true, true},
|
||||
- {"google.co.jp", true, true, true},
|
||||
- {"google.co.ke", true, true, true},
|
||||
- {"google.co.kr", true, true, true},
|
||||
- {"google.co.ls", true, true, true},
|
||||
- {"google.co.ma", true, true, true},
|
||||
- {"google.co.mz", true, true, true},
|
||||
- {"google.co.nz", true, true, true},
|
||||
- {"google.co.th", true, true, true},
|
||||
- {"google.co.tz", true, true, true},
|
||||
- {"google.co.ug", true, true, true},
|
||||
- {"google.co.uk", true, true, true},
|
||||
- {"google.co.uz", true, true, true},
|
||||
- {"google.co.ve", true, true, true},
|
||||
- {"google.co.vi", true, true, true},
|
||||
- {"google.co.za", true, true, true},
|
||||
- {"google.co.zm", true, true, true},
|
||||
- {"google.co.zw", true, true, true},
|
||||
- {"google.com.af", true, true, true},
|
||||
- {"google.com.ag", true, true, true},
|
||||
- {"google.com.ai", true, true, true},
|
||||
- {"google.com.ar", true, true, true},
|
||||
- {"google.com.au", true, true, true},
|
||||
- {"google.com.bd", true, true, true},
|
||||
- {"google.com.bh", true, true, true},
|
||||
- {"google.com.bn", true, true, true},
|
||||
- {"google.com.bo", true, true, true},
|
||||
- {"google.com.br", true, true, true},
|
||||
- {"google.com.by", true, true, true},
|
||||
- {"google.com.bz", true, true, true},
|
||||
- {"google.com.cn", true, true, true},
|
||||
- {"google.com.co", true, true, true},
|
||||
- {"google.com.cu", true, true, true},
|
||||
- {"google.com.cy", true, true, true},
|
||||
- {"google.com.do", true, true, true},
|
||||
- {"google.com.ec", true, true, true},
|
||||
- {"google.com.eg", true, true, true},
|
||||
- {"google.com.et", true, true, true},
|
||||
- {"google.com.fj", true, true, true},
|
||||
- {"google.com.ge", true, true, true},
|
||||
- {"google.com.gh", true, true, true},
|
||||
- {"google.com.gi", true, true, true},
|
||||
- {"google.com.gr", true, true, true},
|
||||
- {"google.com.gt", true, true, true},
|
||||
- {"google.com.hk", true, true, true},
|
||||
- {"google.com.iq", true, true, true},
|
||||
- {"google.com.jm", true, true, true},
|
||||
- {"google.com.jo", true, true, true},
|
||||
- {"google.com.kh", true, true, true},
|
||||
- {"google.com.kw", true, true, true},
|
||||
- {"google.com.lb", true, true, true},
|
||||
- {"google.com.ly", true, true, true},
|
||||
- {"google.com.mm", true, true, true},
|
||||
- {"google.com.mt", true, true, true},
|
||||
- {"google.com.mx", true, true, true},
|
||||
- {"google.com.my", true, true, true},
|
||||
- {"google.com.na", true, true, true},
|
||||
- {"google.com.nf", true, true, true},
|
||||
- {"google.com.ng", true, true, true},
|
||||
- {"google.com.ni", true, true, true},
|
||||
- {"google.com.np", true, true, true},
|
||||
- {"google.com.nr", true, true, true},
|
||||
- {"google.com.om", true, true, true},
|
||||
- {"google.com.pa", true, true, true},
|
||||
- {"google.com.pe", true, true, true},
|
||||
- {"google.com.pg", true, true, true},
|
||||
- {"google.com.ph", true, true, true},
|
||||
- {"google.com.pk", true, true, true},
|
||||
- {"google.com.pl", true, true, true},
|
||||
- {"google.com.pr", true, true, true},
|
||||
- {"google.com.py", true, true, true},
|
||||
- {"google.com.qa", true, true, true},
|
||||
- {"google.com.ru", true, true, true},
|
||||
- {"google.com.sa", true, true, true},
|
||||
- {"google.com.sb", true, true, true},
|
||||
- {"google.com.sg", true, true, true},
|
||||
- {"google.com.sl", true, true, true},
|
||||
- {"google.com.sv", true, true, true},
|
||||
- {"google.com.tj", true, true, true},
|
||||
- {"google.com.tn", true, true, true},
|
||||
- {"google.com.tr", true, true, true},
|
||||
- {"google.com.tw", true, true, true},
|
||||
- {"google.com.ua", true, true, true},
|
||||
- {"google.com.uy", true, true, true},
|
||||
- {"google.com.vc", true, true, true},
|
||||
- {"google.com.ve", true, true, true},
|
||||
- {"google.com.vn", true, true, true},
|
||||
- {"google.cv", true, true, true},
|
||||
- {"google.cz", true, true, true},
|
||||
- {"google.de", true, true, true},
|
||||
- {"google.dj", true, true, true},
|
||||
- {"google.dk", true, true, true},
|
||||
- {"google.dm", true, true, true},
|
||||
- {"google.dz", true, true, true},
|
||||
- {"google.ee", true, true, true},
|
||||
- {"google.es", true, true, true},
|
||||
- {"google.fi", true, true, true},
|
||||
- {"google.fm", true, true, true},
|
||||
- {"google.fr", true, true, true},
|
||||
- {"google.ga", true, true, true},
|
||||
- {"google.ge", true, true, true},
|
||||
- {"google.gg", true, true, true},
|
||||
- {"google.gl", true, true, true},
|
||||
- {"google.gm", true, true, true},
|
||||
- {"google.gp", true, true, true},
|
||||
- {"google.gr", true, true, true},
|
||||
- {"google.gy", true, true, true},
|
||||
- {"google.hk", true, true, true},
|
||||
- {"google.hn", true, true, true},
|
||||
- {"google.hr", true, true, true},
|
||||
- {"google.ht", true, true, true},
|
||||
- {"google.hu", true, true, true},
|
||||
- {"google.ie", true, true, true},
|
||||
- {"google.im", true, true, true},
|
||||
- {"google.iq", true, true, true},
|
||||
- {"google.ir", true, true, true},
|
||||
- {"google.is", true, true, true},
|
||||
- {"google.it", true, true, true},
|
||||
- {"google.it.ao", true, true, true},
|
||||
- {"google.je", true, true, true},
|
||||
- {"google.jo", true, true, true},
|
||||
- {"google.jp", true, true, true},
|
||||
- {"google.kg", true, true, true},
|
||||
- {"google.ki", true, true, true},
|
||||
- {"google.kz", true, true, true},
|
||||
- {"google.la", true, true, true},
|
||||
- {"google.li", true, true, true},
|
||||
- {"google.lk", true, true, true},
|
||||
- {"google.lt", true, true, true},
|
||||
- {"google.lu", true, true, true},
|
||||
- {"google.lv", true, true, true},
|
||||
- {"google.md", true, true, true},
|
||||
- {"google.me", true, true, true},
|
||||
- {"google.mg", true, true, true},
|
||||
- {"google.mk", true, true, true},
|
||||
- {"google.ml", true, true, true},
|
||||
- {"google.mn", true, true, true},
|
||||
- {"google.ms", true, true, true},
|
||||
- {"google.mu", true, true, true},
|
||||
- {"google.mv", true, true, true},
|
||||
- {"google.mw", true, true, true},
|
||||
- {"google.ne", true, true, true},
|
||||
- {"google.ne.jp", true, true, true},
|
||||
- {"google.ng", true, true, true},
|
||||
- {"google.nl", true, true, true},
|
||||
- {"google.no", true, true, true},
|
||||
- {"google.nr", true, true, true},
|
||||
- {"google.nu", true, true, true},
|
||||
- {"google.off.ai", true, true, true},
|
||||
- {"google.pk", true, true, true},
|
||||
- {"google.pl", true, true, true},
|
||||
- {"google.pn", true, true, true},
|
||||
- {"google.ps", true, true, true},
|
||||
- {"google.pt", true, true, true},
|
||||
- {"google.ro", true, true, true},
|
||||
- {"google.rs", true, true, true},
|
||||
- {"google.ru", true, true, true},
|
||||
- {"google.rw", true, true, true},
|
||||
- {"google.sc", true, true, true},
|
||||
- {"google.se", true, true, true},
|
||||
- {"google.sh", true, true, true},
|
||||
- {"google.si", true, true, true},
|
||||
- {"google.sk", true, true, true},
|
||||
- {"google.sm", true, true, true},
|
||||
- {"google.sn", true, true, true},
|
||||
- {"google.so", true, true, true},
|
||||
- {"google.sr", true, true, true},
|
||||
- {"google.st", true, true, true},
|
||||
- {"google.td", true, true, true},
|
||||
- {"google.tg", true, true, true},
|
||||
- {"google.tk", true, true, true},
|
||||
- {"google.tl", true, true, true},
|
||||
- {"google.tm", true, true, true},
|
||||
- {"google.tn", true, true, true},
|
||||
- {"google.to", true, true, true},
|
||||
- {"google.tt", true, true, true},
|
||||
- {"google.us", true, true, true},
|
||||
- {"google.uz", true, true, true},
|
||||
- {"google.vg", true, true, true},
|
||||
- {"google.vu", true, true, true},
|
||||
- {"google.ws", true, true, true},
|
||||
- {"l.google.com", true, true, true},
|
||||
-
|
||||
- // google.com is a special case. We have a custom config for www.google.com,
|
||||
- // so set generate_config_for_www_subdomain = false.
|
||||
- {"google.com", true, true, false},
|
||||
-
|
||||
- // Origins with subdomains and without same-origin collectors.
|
||||
- {"2mdn.net", true, false, false},
|
||||
- {"adgoogle.net", true, false, false},
|
||||
- {"admeld.com", true, false, false},
|
||||
- {"admob.biz", true, false, false},
|
||||
- {"admob.co.in", true, false, false},
|
||||
- {"admob.co.kr", true, false, false},
|
||||
- {"admob.co.nz", true, false, false},
|
||||
- {"admob.co.uk", true, false, false},
|
||||
- {"admob.co.za", true, false, false},
|
||||
- {"admob.com", true, false, false},
|
||||
- {"admob.com.br", true, false, false},
|
||||
- {"admob.com.es", true, false, false},
|
||||
- {"admob.com.fr", true, false, false},
|
||||
- {"admob.com.mx", true, false, false},
|
||||
- {"admob.com.pt", true, false, false},
|
||||
- {"admob.de", true, false, false},
|
||||
- {"admob.dk", true, false, false},
|
||||
- {"admob.es", true, false, false},
|
||||
- {"admob.fi", true, false, false},
|
||||
- {"admob.fr", true, false, false},
|
||||
- {"admob.gr", true, false, false},
|
||||
- {"admob.hk", true, false, false},
|
||||
- {"admob.ie", true, false, false},
|
||||
- {"admob.in", true, false, false},
|
||||
- {"admob.it", true, false, false},
|
||||
- {"admob.jp", true, false, false},
|
||||
- {"admob.kr", true, false, false},
|
||||
- {"admob.mobi", true, false, false},
|
||||
- {"admob.no", true, false, false},
|
||||
- {"admob.ph", true, false, false},
|
||||
- {"admob.pt", true, false, false},
|
||||
- {"admob.sg", true, false, false},
|
||||
- {"admob.tw", true, false, false},
|
||||
- {"admob.us", true, false, false},
|
||||
- {"admob.vn", true, false, false},
|
||||
- {"adwhirl.com", true, false, false},
|
||||
- {"ampproject.com", true, false, false},
|
||||
- {"ampproject.net", true, false, false},
|
||||
- {"ampproject.org", true, false, false},
|
||||
- {"android.com", true, false, false},
|
||||
- {"anycast-edge.metric.gstatic.com", true, false, false},
|
||||
- {"anycast-stb.metric.gstatic.com", true, false, false},
|
||||
- {"anycast.metric.gstatic.com", true, false, false},
|
||||
- {"cdn.ampproject.org", true, false, false},
|
||||
- {"chromecast.com", true, false, false},
|
||||
- {"chromeexperiments.com", true, false, false},
|
||||
- {"chromestatus.com", true, false, false},
|
||||
- {"chromium.org", true, false, false},
|
||||
- {"clients6.google.com", true, false, false},
|
||||
- {"cloudendpointsapis.com", true, false, false},
|
||||
- {"dartmotif.com", true, false, false},
|
||||
- {"dartsearch.net", true, false, false},
|
||||
- {"doubleclick.com", true, false, false},
|
||||
- {"doubleclick.ne.jp", true, false, false},
|
||||
- {"doubleclick.net", true, false, false},
|
||||
- {"doubleclickusercontent.com", true, false, false},
|
||||
- {"fls.doubleclick.net", true, false, false},
|
||||
- {"g.co", true, false, false},
|
||||
- {"g.doubleclick.net", true, false, false},
|
||||
- {"ggpht.com", true, false, false},
|
||||
- {"gmodules.com", true, false, false},
|
||||
- {"goo.gl", true, false, false},
|
||||
- {"google-syndication.com", true, false, false},
|
||||
- {"google.cat", true, false, false},
|
||||
- {"google.info", true, false, false},
|
||||
- {"google.jobs", true, false, false},
|
||||
- {"google.net", true, false, false},
|
||||
- {"google.org", true, false, false},
|
||||
- {"google.stackdriver.com", true, false, false},
|
||||
- {"googleadapis.com", true, false, false},
|
||||
- {"googleadservices.com", true, false, false},
|
||||
- {"googleadsserving.cn", true, false, false},
|
||||
- {"googlealumni.com", true, false, false},
|
||||
- {"googleapis.cn", true, false, false},
|
||||
- {"googleapis.com", true, false, false},
|
||||
- {"googleapps.com", true, false, false},
|
||||
- {"googlecbs.com", true, false, false},
|
||||
- {"googlecode.com", true, false, false},
|
||||
- {"googlecommerce.com", true, false, false},
|
||||
- {"googledrive.com", true, false, false},
|
||||
- {"googleenterprise.com", true, false, false},
|
||||
- {"googlefiber.com", true, false, false},
|
||||
- {"googlefiber.net", true, false, false},
|
||||
- {"googlegoro.com", true, false, false},
|
||||
- {"googlehosted.com", true, false, false},
|
||||
- {"googlepayments.com", true, false, false},
|
||||
- {"googlesource.com", true, false, false},
|
||||
- {"googlesyndication.com", true, false, false},
|
||||
- {"googletagmanager.com", true, false, false},
|
||||
- {"googletagservices.com", true, false, false},
|
||||
- {"googleusercontent.com", true, false, false},
|
||||
- {"googlezip.net", true, false, false},
|
||||
- {"gstatic.cn", true, false, false},
|
||||
- {"gstatic.com", true, false, false},
|
||||
- {"gvt3.com", true, false, false},
|
||||
- {"gvt9.com", true, false, false},
|
||||
- {"picasa.com", true, false, false},
|
||||
- {"recaptcha.net", true, false, false},
|
||||
- {"stackdriver.com", true, false, false},
|
||||
- {"stbcast-stb.metric.gstatic.com", true, false, false},
|
||||
- {"stbcast.metric.gstatic.com", true, false, false},
|
||||
- {"stbcast2-stb.metric.gstatic.com", true, false, false},
|
||||
- {"stbcast2.metric.gstatic.com", true, false, false},
|
||||
- {"stbcast3-stb.metric.gstatic.com", true, false, false},
|
||||
- {"stbcast3.metric.gstatic.com", true, false, false},
|
||||
- {"stbcast4-stb.metric.gstatic.com", true, false, false},
|
||||
- {"stbcast4.metric.gstatic.com", true, false, false},
|
||||
- {"unicast-edge.metric.gstatic.com", true, false, false},
|
||||
- {"unicast-stb.metric.gstatic.com", true, false, false},
|
||||
- {"unicast.metric.gstatic.com", true, false, false},
|
||||
- {"unicast2-stb.metric.gstatic.com", true, false, false},
|
||||
- {"unicast2.metric.gstatic.com", true, false, false},
|
||||
- {"waze.com", true, false, false},
|
||||
- {"withgoogle.com", true, false, false},
|
||||
- {"youtu.be", true, false, false},
|
||||
- {"youtube-3rd-party.com", true, false, false},
|
||||
- {"youtube-nocookie.com", true, false, false},
|
||||
- {"youtube.ae", true, false, false},
|
||||
- {"youtube.al", true, false, false},
|
||||
- {"youtube.am", true, false, false},
|
||||
- {"youtube.at", true, false, false},
|
||||
- {"youtube.az", true, false, false},
|
||||
- {"youtube.ba", true, false, false},
|
||||
- {"youtube.be", true, false, false},
|
||||
- {"youtube.bg", true, false, false},
|
||||
- {"youtube.bh", true, false, false},
|
||||
- {"youtube.bo", true, false, false},
|
||||
- {"youtube.ca", true, false, false},
|
||||
- {"youtube.cat", true, false, false},
|
||||
- {"youtube.ch", true, false, false},
|
||||
- {"youtube.cl", true, false, false},
|
||||
- {"youtube.co", true, false, false},
|
||||
- {"youtube.co.ae", true, false, false},
|
||||
- {"youtube.co.at", true, false, false},
|
||||
- {"youtube.co.hu", true, false, false},
|
||||
- {"youtube.co.id", true, false, false},
|
||||
- {"youtube.co.il", true, false, false},
|
||||
- {"youtube.co.in", true, false, false},
|
||||
- {"youtube.co.jp", true, false, false},
|
||||
- {"youtube.co.ke", true, false, false},
|
||||
- {"youtube.co.kr", true, false, false},
|
||||
- {"youtube.co.ma", true, false, false},
|
||||
- {"youtube.co.nz", true, false, false},
|
||||
- {"youtube.co.th", true, false, false},
|
||||
- {"youtube.co.ug", true, false, false},
|
||||
- {"youtube.co.uk", true, false, false},
|
||||
- {"youtube.co.ve", true, false, false},
|
||||
- {"youtube.co.za", true, false, false},
|
||||
- {"youtube.com", true, false, false},
|
||||
- {"youtube.com.ar", true, false, false},
|
||||
- {"youtube.com.au", true, false, false},
|
||||
- {"youtube.com.az", true, false, false},
|
||||
- {"youtube.com.bh", true, false, false},
|
||||
- {"youtube.com.bo", true, false, false},
|
||||
- {"youtube.com.br", true, false, false},
|
||||
- {"youtube.com.by", true, false, false},
|
||||
- {"youtube.com.co", true, false, false},
|
||||
- {"youtube.com.do", true, false, false},
|
||||
- {"youtube.com.ee", true, false, false},
|
||||
- {"youtube.com.eg", true, false, false},
|
||||
- {"youtube.com.es", true, false, false},
|
||||
- {"youtube.com.gh", true, false, false},
|
||||
- {"youtube.com.gr", true, false, false},
|
||||
- {"youtube.com.gt", true, false, false},
|
||||
- {"youtube.com.hk", true, false, false},
|
||||
- {"youtube.com.hr", true, false, false},
|
||||
- {"youtube.com.jm", true, false, false},
|
||||
- {"youtube.com.jo", true, false, false},
|
||||
- {"youtube.com.kw", true, false, false},
|
||||
- {"youtube.com.lb", true, false, false},
|
||||
- {"youtube.com.lv", true, false, false},
|
||||
- {"youtube.com.mk", true, false, false},
|
||||
- {"youtube.com.mt", true, false, false},
|
||||
- {"youtube.com.mx", true, false, false},
|
||||
- {"youtube.com.my", true, false, false},
|
||||
- {"youtube.com.ng", true, false, false},
|
||||
- {"youtube.com.om", true, false, false},
|
||||
- {"youtube.com.pe", true, false, false},
|
||||
- {"youtube.com.ph", true, false, false},
|
||||
- {"youtube.com.pk", true, false, false},
|
||||
- {"youtube.com.pt", true, false, false},
|
||||
- {"youtube.com.qa", true, false, false},
|
||||
- {"youtube.com.ro", true, false, false},
|
||||
- {"youtube.com.sa", true, false, false},
|
||||
- {"youtube.com.sg", true, false, false},
|
||||
- {"youtube.com.tn", true, false, false},
|
||||
- {"youtube.com.tr", true, false, false},
|
||||
- {"youtube.com.tw", true, false, false},
|
||||
- {"youtube.com.ua", true, false, false},
|
||||
- {"youtube.com.uy", true, false, false},
|
||||
- {"youtube.com.ve", true, false, false},
|
||||
- {"youtube.cz", true, false, false},
|
||||
- {"youtube.de", true, false, false},
|
||||
- {"youtube.dk", true, false, false},
|
||||
- {"youtube.ee", true, false, false},
|
||||
- {"youtube.es", true, false, false},
|
||||
- {"youtube.fi", true, false, false},
|
||||
- {"youtube.fr", true, false, false},
|
||||
- {"youtube.ge", true, false, false},
|
||||
- {"youtube.gr", true, false, false},
|
||||
- {"youtube.gt", true, false, false},
|
||||
- {"youtube.hk", true, false, false},
|
||||
- {"youtube.hr", true, false, false},
|
||||
- {"youtube.hu", true, false, false},
|
||||
- {"youtube.ie", true, false, false},
|
||||
- {"youtube.in", true, false, false},
|
||||
- {"youtube.is", true, false, false},
|
||||
- {"youtube.it", true, false, false},
|
||||
- {"youtube.jo", true, false, false},
|
||||
- {"youtube.jp", true, false, false},
|
||||
- {"youtube.kr", true, false, false},
|
||||
- {"youtube.lk", true, false, false},
|
||||
- {"youtube.lt", true, false, false},
|
||||
- {"youtube.lv", true, false, false},
|
||||
- {"youtube.ma", true, false, false},
|
||||
- {"youtube.md", true, false, false},
|
||||
- {"youtube.me", true, false, false},
|
||||
- {"youtube.mk", true, false, false},
|
||||
- {"youtube.mx", true, false, false},
|
||||
- {"youtube.my", true, false, false},
|
||||
- {"youtube.ng", true, false, false},
|
||||
- {"youtube.nl", true, false, false},
|
||||
- {"youtube.no", true, false, false},
|
||||
- {"youtube.pe", true, false, false},
|
||||
- {"youtube.ph", true, false, false},
|
||||
- {"youtube.pk", true, false, false},
|
||||
- {"youtube.pl", true, false, false},
|
||||
- {"youtube.pr", true, false, false},
|
||||
- {"youtube.pt", true, false, false},
|
||||
- {"youtube.qa", true, false, false},
|
||||
- {"youtube.ro", true, false, false},
|
||||
- {"youtube.rs", true, false, false},
|
||||
- {"youtube.ru", true, false, false},
|
||||
- {"youtube.sa", true, false, false},
|
||||
- {"youtube.se", true, false, false},
|
||||
- {"youtube.sg", true, false, false},
|
||||
- {"youtube.si", true, false, false},
|
||||
- {"youtube.sk", true, false, false},
|
||||
- {"youtube.sn", true, false, false},
|
||||
- {"youtube.tn", true, false, false},
|
||||
- {"youtube.ua", true, false, false},
|
||||
- {"youtube.ug", true, false, false},
|
||||
- {"youtube.uy", true, false, false},
|
||||
- {"youtube.vn", true, false, false},
|
||||
- {"youtubeeducation.com", true, false, false},
|
||||
- {"youtubemobilesupport.com", true, false, false},
|
||||
- {"ytimg.com", true, false, false},
|
||||
-
|
||||
- // Origins without subdomains and with same-origin collectors.
|
||||
- {"accounts.google.com", false, true, false},
|
||||
- {"apis.google.com", false, true, false},
|
||||
- {"app.google.stackdriver.com", false, true, false},
|
||||
- {"b.mail.google.com", false, true, false},
|
||||
- {"chatenabled.mail.google.com", false, true, false},
|
||||
- {"ddm.google.com", false, true, false},
|
||||
- {"gmail.com", false, true, false},
|
||||
- {"gmail.google.com", false, true, false},
|
||||
- {"mail-attachment.googleusercontent.com", false, true, false},
|
||||
- {"mail.google.com", false, true, false},
|
||||
- {"www.gmail.com", false, true, false},
|
||||
-
|
||||
- // Origins without subdomains or same-origin collectors.
|
||||
- {"ad.doubleclick.net", false, false, false},
|
||||
- {"drive.google.com", false, false, false},
|
||||
- {"redirector.googlevideo.com", false, false, false},
|
||||
-};
|
||||
-
|
||||
-const char* const kGoogleStandardCollectors[] = {
|
||||
- "https://beacons.gcp.gvt2.com/domainreliability/upload",
|
||||
- "https://beacons.gvt2.com/domainreliability/upload",
|
||||
- "https://beacons2.gvt2.com/domainreliability/upload",
|
||||
- "https://beacons3.gvt2.com/domainreliability/upload",
|
||||
- "https://beacons4.gvt2.com/domainreliability/upload",
|
||||
- "https://beacons5.gvt2.com/domainreliability/upload",
|
||||
- "https://beacons5.gvt3.com/domainreliability/upload",
|
||||
- "https://clients2.google.com/domainreliability/upload",
|
||||
-};
|
||||
-
|
||||
-const char* const kGoogleOriginSpecificCollectorPathString =
|
||||
- "/domainreliability/upload";
|
||||
-
|
||||
-static std::unique_ptr<DomainReliabilityConfig> CreateGoogleConfig(
|
||||
- const GoogleConfigParams& params,
|
||||
- bool is_www) {
|
||||
- if (is_www)
|
||||
- DCHECK(params.duplicate_for_www);
|
||||
-
|
||||
- std::string hostname = (is_www ? "www." : "") + std::string(params.hostname);
|
||||
- bool include_subdomains = params.include_subdomains && !is_www;
|
||||
-
|
||||
- std::unique_ptr<DomainReliabilityConfig> config(
|
||||
- new DomainReliabilityConfig());
|
||||
- config->origin = GURL("https://" + hostname + "/");
|
||||
- config->include_subdomains = include_subdomains;
|
||||
- config->collectors.clear();
|
||||
- if (params.include_origin_specific_collector) {
|
||||
- GURL::Replacements replacements;
|
||||
- replacements.SetPathStr(kGoogleOriginSpecificCollectorPathString);
|
||||
- config->collectors.push_back(
|
||||
- std::make_unique<GURL>(config->origin.ReplaceComponents(replacements)));
|
||||
- }
|
||||
- for (size_t i = 0; i < arraysize(kGoogleStandardCollectors); i++)
|
||||
- config->collectors.push_back(
|
||||
- std::make_unique<GURL>(kGoogleStandardCollectors[i]));
|
||||
- config->success_sample_rate = 0.05;
|
||||
- config->failure_sample_rate = 1.00;
|
||||
- config->path_prefixes.clear();
|
||||
- return config;
|
||||
-}
|
||||
-
|
||||
-} // namespace
|
||||
-
|
||||
// static
|
||||
void GetAllGoogleConfigs(
|
||||
std::vector<std::unique_ptr<DomainReliabilityConfig>>* configs_out) {
|
||||
configs_out->clear();
|
||||
-
|
||||
- for (auto& params : kGoogleConfigs) {
|
||||
- configs_out->push_back(CreateGoogleConfig(params, false));
|
||||
- if (params.duplicate_for_www)
|
||||
- configs_out->push_back(CreateGoogleConfig(params, true));
|
||||
- }
|
||||
}
|
||||
|
||||
} // namespace domain_reliability
|
||||
diff --git a/components/domain_reliability/uploader.cc b/components/domain_reliability/uploader.cc
|
||||
--- a/components/domain_reliability/uploader.cc
|
||||
+++ b/components/domain_reliability/uploader.cc
|
||||
@@ -82,7 +82,7 @@ class DomainReliabilityUploaderImpl
|
||||
if (discard_uploads_)
|
||||
discarded_upload_count_++;
|
||||
|
||||
- if (discard_uploads_ || shutdown_) {
|
||||
+ if (true) {
|
||||
VLOG(1) << "Discarding report instead of uploading.";
|
||||
UploadResult result;
|
||||
result.status = UploadResult::SUCCESS;
|
||||
--
|
||||
2.7.4
|
||||
|
|
@ -2,11 +2,13 @@ From: Serg <serg.zhukovsky@gmail.com>
|
|||
Date: Tue, 31 Jan 2017 22:12:27 -0500
|
||||
Subject: Add exit menu item
|
||||
|
||||
Corrected Exit functionality
|
||||
---
|
||||
chrome/android/java/res/menu/main_menu.xml | 2 ++
|
||||
.../android/java/src/org/chromium/chrome/browser/ChromeActivity.java | 2 ++
|
||||
chrome/android/java/strings/android_chrome_strings.grd | 3 +++
|
||||
3 files changed, 7 insertions(+)
|
||||
chrome/android/java/res/menu/main_menu.xml | 2 ++
|
||||
.../java/src/org/chromium/chrome/browser/ChromeActivity.java | 2 ++
|
||||
.../org/chromium/chrome/browser/init/ChromeLifetimeController.java | 6 +++++-
|
||||
chrome/android/java/strings/android_chrome_strings.grd | 3 +++
|
||||
4 files changed, 12 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/chrome/android/java/res/menu/main_menu.xml b/chrome/android/java/res/menu/main_menu.xml
|
||||
--- a/chrome/android/java/res/menu/main_menu.xml
|
||||
|
@ -32,6 +34,22 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.
|
|||
} else if (id == R.id.find_in_page_id) {
|
||||
if (mFindToolbarManager == null) return false;
|
||||
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeLifetimeController.java b/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeLifetimeController.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeLifetimeController.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeLifetimeController.java
|
||||
@@ -87,7 +87,11 @@ class ChromeLifetimeController implements ApplicationLifetime.Observer,
|
||||
|
||||
// Kick off a timer to kill the process after a delay, which fires only if the Activities
|
||||
// take too long to be finished.
|
||||
- mHandler.postDelayed(mRestartRunnable, WATCHDOG_DELAY_MS);
|
||||
+ if (restart) {
|
||||
+ mHandler.postDelayed(mRestartRunnable, WATCHDOG_DELAY_MS);
|
||||
+ } else {
|
||||
+ fireBrowserRestartActivityIntent();
|
||||
+ }
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/chrome/android/java/strings/android_chrome_strings.grd b/chrome/android/java/strings/android_chrome_strings.grd
|
||||
--- a/chrome/android/java/strings/android_chrome_strings.grd
|
||||
+++ b/chrome/android/java/strings/android_chrome_strings.grd
|
|
@ -1,189 +0,0 @@
|
|||
From: NoChromo <nochromo@nochromo.com>
|
||||
Date: Sun, 3 Apr 2016 12:44:50 +0800
|
||||
Subject: url_request: hooks and ad url data
|
||||
|
||||
---
|
||||
net/BUILD.gn | 2 +
|
||||
net/url_request/nochromo_intercept.cc | 116 ++++++++++++++++++++++++++++++++++
|
||||
net/url_request/nochromo_intercept.h | 13 ++++
|
||||
net/url_request/url_request.cc | 4 ++
|
||||
4 files changed, 135 insertions(+)
|
||||
create mode 100644 net/url_request/nochromo_intercept.cc
|
||||
create mode 100644 net/url_request/nochromo_intercept.h
|
||||
|
||||
diff --git a/net/BUILD.gn b/net/BUILD.gn
|
||||
--- a/net/BUILD.gn
|
||||
+++ b/net/BUILD.gn
|
||||
@@ -1734,6 +1734,8 @@ component("net") {
|
||||
"url_request/url_fetcher_response_writer.h",
|
||||
"url_request/url_range_request_job.cc",
|
||||
"url_request/url_range_request_job.h",
|
||||
+ "url_request/nochromo_intercept.cc",
|
||||
+ "url_request/nochromo_intercept.h",
|
||||
"url_request/url_request.cc",
|
||||
"url_request/url_request.h",
|
||||
"url_request/url_request_context.cc",
|
||||
diff --git a/net/url_request/nochromo_intercept.cc b/net/url_request/nochromo_intercept.cc
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/net/url_request/nochromo_intercept.cc
|
||||
@@ -0,0 +1,116 @@
|
||||
+#include "url/gurl.h"
|
||||
+#include "net/url_request/nochromo_entries.h"
|
||||
+
|
||||
+#include <android/log.h>
|
||||
+
|
||||
+namespace net {
|
||||
+
|
||||
+#define NOCHROMO_LOG 0
|
||||
+#define NOCHROMO_LOG_MORE 0
|
||||
+
|
||||
+static char* strtolower(const char* str) {
|
||||
+ int len = strlen(str);
|
||||
+ char* ret = (char*)malloc(len + 1);
|
||||
+ ret[len] = '\0';
|
||||
+ for (int i = 0; i < len; i++) {
|
||||
+ if ((65 <= str[i]) && (str[i] <= 90)) {
|
||||
+ ret[i] = str[i] + 32;
|
||||
+ } else {
|
||||
+ ret[i] = str[i];
|
||||
+ }
|
||||
+ }
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static char* strtosep(const char* str) {
|
||||
+ int len = strlen(str);
|
||||
+ 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] == '=')) {
|
||||
+ ret[i + 1] = '^';
|
||||
+ } else {
|
||||
+ ret[i + 1] = str[i];
|
||||
+ }
|
||||
+ }
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+int nochromo_intercept(const GURL& url) {
|
||||
+ 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);
|
||||
+
|
||||
+ if (NOCHROMO_LOG) __android_log_print(ANDROID_LOG_INFO, "NoChromo", "[%s]", c_url);
|
||||
+
|
||||
+ bool intercept = false;
|
||||
+ for (int i = 0; i < NOCHROMO_ENTRY_COUNT; i++) {
|
||||
+ nochromo_entry* entry = &NOCHROMO_ENTRIES[i];
|
||||
+
|
||||
+ // no use checking rules when we're intercepting, or exceptions when not
|
||||
+ bool check =
|
||||
+ (!intercept && ((entry->flags & NOCHROMO_FLAG_EXCEPTION) == 0)) ||
|
||||
+ (intercept && ((entry->flags & NOCHROMO_FLAG_EXCEPTION) != 0));
|
||||
+
|
||||
+ if (check) {
|
||||
+ bool match = false;
|
||||
+
|
||||
+ // select comparison string based on case and separator presence (separator takes some shortcuts)
|
||||
+ bool match_case = ((entry->flags & NOCHROMO_FLAG_MATCH_CASE) != 0);
|
||||
+ bool match_separator = ((entry->flags & NOCHROMO_FLAG_HAS_SEPARATOR) != 0);
|
||||
+ const char* match_url = match_case ? (match_separator ? c_url_sep : c_url) : (match_separator ? c_url_lower_sep : c_url_lower);
|
||||
+
|
||||
+ if (NOCHROMO_LOG || NOCHROMO_LOG_MORE) __android_log_print(ANDROID_LOG_INFO, "NoChromo", "[case:%d][sep:%d][%s]", match_case, match_separator, match_url);
|
||||
+
|
||||
+ // check for all match parts at >= position of last match
|
||||
+ const char* last = match_url;
|
||||
+ for (int m = 0; m < entry->matchcount; m++) {
|
||||
+ const char* pos = strstr(last, entry->matches[m]);
|
||||
+ match = (pos != NULL);
|
||||
+
|
||||
+ if (NOCHROMO_LOG || NOCHROMO_LOG_MORE) __android_log_print(ANDROID_LOG_INFO, "NoChromo", "[%s][found:%d][match:%d]", entry->matches[m], pos == NULL ? 0 : 1, match ? 1 : 0);
|
||||
+
|
||||
+ // check if the url starts with the first match part
|
||||
+ if (match && (m == 0) && ((entry->flags & NOCHROMO_FLAG_MATCH_BEGIN) != 0) && (pos != match_url)) match = false;
|
||||
+
|
||||
+ // check if the url ends with the last match part
|
||||
+ if (match && (m == entry->matchcount - 1) && ((entry->flags & NOCHROMO_FLAG_MATCH_END) != 0) && (pos != &match_url[strlen(match_url) - strlen(entry->matches[m])])) match = false;
|
||||
+
|
||||
+ // check domain match
|
||||
+ if (match && (m == 0) && ((entry->flags & NOCHROMO_FLAG_MATCH_DOMAIN) != 0) && (pos != match_url) && (pos[-1] != '^') && (pos[-1] != '.') && (pos[-1] != '/')) match = false;
|
||||
+
|
||||
+ // short circuit
|
||||
+ if (!match) break;
|
||||
+ }
|
||||
+
|
||||
+ if (match) {
|
||||
+ if (NOCHROMO_LOG) {
|
||||
+ if (!intercept) {
|
||||
+ __android_log_print(ANDROID_LOG_INFO, "NoChromo", "--> intercept (%d) (%d)", i, entry->flags);
|
||||
+ } else {
|
||||
+ __android_log_print(ANDROID_LOG_INFO, "NoChromo", "--> pass (%d) (%d)", i, entry->flags);
|
||||
+ }
|
||||
+ }
|
||||
+ intercept = !intercept;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ free(c_url_sep);
|
||||
+ free(c_url_lower);
|
||||
+ free(c_url_lower_sep);
|
||||
+
|
||||
+ if (intercept) {
|
||||
+ if (NOCHROMO_LOG) __android_log_print(ANDROID_LOG_INFO, "NoChromo", "intercepted!");
|
||||
+ return 1;
|
||||
+ }
|
||||
+ if (NOCHROMO_LOG) __android_log_print(ANDROID_LOG_INFO, "NoChromo", "pass!");
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+} // namespace net
|
||||
\ No newline at end of file
|
||||
diff --git a/net/url_request/nochromo_intercept.h b/net/url_request/nochromo_intercept.h
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/net/url_request/nochromo_intercept.h
|
||||
@@ -0,0 +1,13 @@
|
||||
+#ifndef NET_URL_REQUEST_NOCHROMO_INTERCEPT_H_
|
||||
+#define NET_URL_REQUEST_NOCHROMO_INTERCEPT_H_
|
||||
+
|
||||
+#include "url/gurl.h"
|
||||
+
|
||||
+namespace net {
|
||||
+
|
||||
+GURL nochromo_intercepted = GURL("http://127.0.0.1/");
|
||||
+int nochromo_intercept(const GURL& url);
|
||||
+
|
||||
+} // namespace net
|
||||
+
|
||||
+#endif // NET_URL_REQUEST_NOCHROMO_INTERCEPT_H_
|
||||
diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc
|
||||
--- a/net/url_request/url_request.cc
|
||||
+++ b/net/url_request/url_request.cc
|
||||
@@ -44,6 +44,8 @@
|
||||
#include "url/gurl.h"
|
||||
#include "url/origin.h"
|
||||
|
||||
+#include "net/url_request/nochromo_intercept.h"
|
||||
+
|
||||
#if BUILDFLAG(ENABLE_REPORTING)
|
||||
#include "net/network_error_logging/network_error_logging_service.h"
|
||||
#include "net/reporting/reporting_service.h"
|
||||
@@ -583,6 +585,8 @@ URLRequest::URLRequest(const GURL& url,
|
||||
// Sanity check out environment.
|
||||
DCHECK(base::ThreadTaskRunnerHandle::IsSet());
|
||||
|
||||
+ if (nochromo_intercept(url)) url_chain_.push_back(nochromo_intercepted);
|
||||
+
|
||||
context->url_requests()->insert(this);
|
||||
net_log_.BeginEvent(
|
||||
NetLogEventType::REQUEST_ALIVE,
|
||||
--
|
||||
2.7.4
|
||||
|
|
@ -1,17 +1,15 @@
|
|||
From: csagan5 <32685696+csagan5@users.noreply.github.com>
|
||||
Date: Wed, 28 Mar 2018 15:55:11 +0200
|
||||
Date: Thu, 23 Aug 2018 19:30:15 +0200
|
||||
Subject: Bromite adblock engine
|
||||
|
||||
Ported from NoChromo patch
|
||||
Original adblock engine ported from NoChromo patch
|
||||
Make interception testable
|
||||
Add domain support
|
||||
Re-land: third-party filters support
|
||||
|
||||
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
|
||||
---
|
||||
chrome/android/java/res/menu/custom_tabs_menu.xml | 12 +
|
||||
chrome/android/java/res/menu/main_menu.xml | 11 +
|
||||
|
@ -20,18 +18,14 @@ Perform adblock interception in StartJob to address lagging issues
|
|||
.../browser/appmenu/AppMenuPropertiesDelegate.java | 38 +++
|
||||
.../CustomTabAppMenuPropertiesDelegate.java | 2 +
|
||||
.../java/strings/android_chrome_strings.grd | 11 +
|
||||
chrome/browser/net/chrome_network_delegate.cc | 55 ++++
|
||||
.../subresource_filter_content_settings_manager.cc | 3 +
|
||||
net/BUILD.gn | 9 +-
|
||||
net/url_request/adblock_intercept.cc | 326 +++++++++++++++++++++
|
||||
net/url_request/adblock_intercept.h | 18 ++
|
||||
net/url_request/nochromo_intercept.cc | 116 --------
|
||||
net/url_request/nochromo_intercept.h | 13 -
|
||||
net/url_request/url_request.cc | 36 ++-
|
||||
14 files changed, 477 insertions(+), 134 deletions(-)
|
||||
net/BUILD.gn | 7 +
|
||||
net/url_request/adblock_intercept.cc | 323 +++++++++++++++++++++
|
||||
net/url_request/adblock_intercept.h | 19 ++
|
||||
12 files changed, 497 insertions(+)
|
||||
create mode 100644 net/url_request/adblock_intercept.cc
|
||||
create mode 100644 net/url_request/adblock_intercept.h
|
||||
delete mode 100644 net/url_request/nochromo_intercept.cc
|
||||
delete mode 100644 net/url_request/nochromo_intercept.h
|
||||
|
||||
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
|
||||
|
@ -198,6 +192,90 @@ diff --git a/chrome/android/java/strings/android_chrome_strings.grd b/chrome/and
|
|||
<message name="IDS_MENU_READER_MODE_PREFS" desc="Menu item to show reader mode preferences pane, which allows users to change the appearance (font size, theme, etc.) of the page. [CHAR-LIMIT=27]">
|
||||
Appearance
|
||||
</message>
|
||||
diff --git a/chrome/browser/net/chrome_network_delegate.cc b/chrome/browser/net/chrome_network_delegate.cc
|
||||
--- a/chrome/browser/net/chrome_network_delegate.cc
|
||||
+++ b/chrome/browser/net/chrome_network_delegate.cc
|
||||
@@ -62,6 +62,7 @@
|
||||
#if defined(OS_ANDROID)
|
||||
#include "base/android/path_utils.h"
|
||||
#include "chrome/browser/io_thread.h"
|
||||
+#include "net/url_request/adblock_intercept.h"
|
||||
#endif
|
||||
|
||||
#if defined(OS_CHROMEOS)
|
||||
@@ -269,11 +270,63 @@ void ChromeNetworkDelegate::InitializePrefsOnUIThread(
|
||||
}
|
||||
}
|
||||
|
||||
+#define TRANSPARENT1PXGIF "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"
|
||||
+
|
||||
int ChromeNetworkDelegate::OnBeforeURLRequest(
|
||||
net::URLRequest* request,
|
||||
const net::CompletionCallback& callback,
|
||||
GURL* new_url) {
|
||||
|
||||
+#if defined(OS_ANDROID)
|
||||
+ if (request) {
|
||||
+ bool block = false, isValidUrl;
|
||||
+
|
||||
+ //LOG(INFO) << "OnBeforeURLRequest " << request->url();
|
||||
+ 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);
|
||||
+
|
||||
+ if (isValidUrl && info) {
|
||||
+#if 0
|
||||
+ // not working
|
||||
+ const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter = info->GetWebContentsGetterForRequest();
|
||||
+ content::WebContents* web_contents = web_contents_getter.Run();
|
||||
+ if (web_contents) {
|
||||
+ TabSpecificContentSettings* content_settings =
|
||||
+ TabSpecificContentSettings::FromWebContents(web_contents);
|
||||
+ if (content_settings) {
|
||||
+ bool adblock_enabled = content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_ADS);
|
||||
+ LOG(INFO) << "adblock_enabled from tab: " << adblock_enabled;
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
+ if (net::adblock_enabled
|
||||
+ && content::RESOURCE_TYPE_MAIN_FRAME != info->GetResourceType()
|
||||
+ && net::adblock_intercept(request->url(),
|
||||
+ request->site_for_cookies().host(),
|
||||
+ info->GetResourceType())) {
|
||||
+ block = true;
|
||||
+ }
|
||||
+
|
||||
+ if (block) {
|
||||
+ if (content::RESOURCE_TYPE_IMAGE == info->GetResourceType()) {
|
||||
+ *new_url = GURL(TRANSPARENT1PXGIF);
|
||||
+ } else {
|
||||
+ *new_url = GURL("");
|
||||
+ }
|
||||
+ return net::ERR_BLOCKED_BY_ADMINISTRATOR;
|
||||
+ }
|
||||
+ } // valid URL and info
|
||||
+ } // request
|
||||
+#endif // OS_ANDROID
|
||||
+
|
||||
extensions_delegate_->ForwardStartRequestStatus(request);
|
||||
|
||||
if (!enable_referrers_->GetValue())
|
||||
@@ -307,6 +360,8 @@ int ChromeNetworkDelegate::OnBeforeURLRequest(
|
||||
return rv;
|
||||
}
|
||||
|
||||
+#undef TRANSPARENT1PXGIF
|
||||
+
|
||||
int ChromeNetworkDelegate::OnBeforeStartTransaction(
|
||||
net::URLRequest* request,
|
||||
const net::CompletionCallback& 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
|
||||
|
@ -224,16 +302,7 @@ diff --git a/chrome/browser/subresource_filter/subresource_filter_content_settin
|
|||
diff --git a/net/BUILD.gn b/net/BUILD.gn
|
||||
--- a/net/BUILD.gn
|
||||
+++ b/net/BUILD.gn
|
||||
@@ -1734,8 +1734,6 @@ component("net") {
|
||||
"url_request/url_fetcher_response_writer.h",
|
||||
"url_request/url_range_request_job.cc",
|
||||
"url_request/url_range_request_job.h",
|
||||
- "url_request/nochromo_intercept.cc",
|
||||
- "url_request/nochromo_intercept.h",
|
||||
"url_request/url_request.cc",
|
||||
"url_request/url_request.h",
|
||||
"url_request/url_request_context.cc",
|
||||
@@ -1793,6 +1791,13 @@ component("net") {
|
||||
@@ -1791,6 +1791,13 @@ component("net") {
|
||||
"//third_party/zlib",
|
||||
]
|
||||
|
||||
|
@ -251,8 +320,9 @@ 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,326 @@
|
||||
@@ -0,0 +1,323 @@
|
||||
+#include "url/gurl.h"
|
||||
+#include "content/public/common/resource_type.h"
|
||||
+
|
||||
+#ifdef ADB_TESTER
|
||||
+#include <cstddef>
|
||||
|
@ -506,11 +576,7 @@ new file mode 100644
|
|||
+ return fp == wanted_fp;
|
||||
+}
|
||||
+
|
||||
+int adblock_intercept(const GURL &url, const std::string &origin_host) {
|
||||
+ // if (!url.is_valid() || !url.SchemeIsHTTPOrHTTPS()) {
|
||||
+ // return 0;
|
||||
+ // }
|
||||
+
|
||||
+int adblock_intercept(const GURL &url, const std::string &origin_host, content::ResourceType resource_type) {
|
||||
+ if (url.is_valid() && url.SchemeIsHTTPOrHTTPS()) {
|
||||
+ const char *c_url = url.spec().c_str();
|
||||
+ char *c_url_lower = strtolower(c_url);
|
||||
|
@ -582,11 +648,12 @@ 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,18 @@
|
||||
@@ -0,0 +1,19 @@
|
||||
+#ifndef NET_URL_REQUEST_ADBLOCK_INTERCEPT_H_
|
||||
+#define NET_URL_REQUEST_ADBLOCK_INTERCEPT_H_
|
||||
+
|
||||
+#include "url/gurl.h"
|
||||
+#include "content/public/common/resource_type.h"
|
||||
+
|
||||
+namespace net {
|
||||
+
|
||||
|
@ -594,213 +661,13 @@ new file mode 100644
|
|||
+int adblock_rules_count();
|
||||
+#endif
|
||||
+
|
||||
+int adblock_intercept(const GURL &url, const std::string &origin_host);
|
||||
+int adblock_intercept(const GURL &url, const std::string &origin_host, content::ResourceType resource_type);
|
||||
+
|
||||
+extern bool adblock_enabled;
|
||||
+
|
||||
+} // namespace net
|
||||
+
|
||||
+#endif // NET_URL_REQUEST_ADBLOCK_INTERCEPT_H_
|
||||
diff --git a/net/url_request/nochromo_intercept.cc b/net/url_request/nochromo_intercept.cc
|
||||
deleted file mode 100644
|
||||
--- a/net/url_request/nochromo_intercept.cc
|
||||
+++ /dev/null
|
||||
@@ -1,116 +0,0 @@
|
||||
-#include "url/gurl.h"
|
||||
-#include "net/url_request/nochromo_entries.h"
|
||||
-
|
||||
-#include <android/log.h>
|
||||
-
|
||||
-namespace net {
|
||||
-
|
||||
-#define NOCHROMO_LOG 0
|
||||
-#define NOCHROMO_LOG_MORE 0
|
||||
-
|
||||
-static char* strtolower(const char* str) {
|
||||
- int len = strlen(str);
|
||||
- char* ret = (char*)malloc(len + 1);
|
||||
- ret[len] = '\0';
|
||||
- for (int i = 0; i < len; i++) {
|
||||
- if ((65 <= str[i]) && (str[i] <= 90)) {
|
||||
- ret[i] = str[i] + 32;
|
||||
- } else {
|
||||
- ret[i] = str[i];
|
||||
- }
|
||||
- }
|
||||
- return ret;
|
||||
-}
|
||||
-
|
||||
-static char* strtosep(const char* str) {
|
||||
- int len = strlen(str);
|
||||
- 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] == '=')) {
|
||||
- ret[i + 1] = '^';
|
||||
- } else {
|
||||
- ret[i + 1] = str[i];
|
||||
- }
|
||||
- }
|
||||
- return ret;
|
||||
-}
|
||||
-
|
||||
-int nochromo_intercept(const GURL& url) {
|
||||
- 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);
|
||||
-
|
||||
- if (NOCHROMO_LOG) __android_log_print(ANDROID_LOG_INFO, "NoChromo", "[%s]", c_url);
|
||||
-
|
||||
- bool intercept = false;
|
||||
- for (int i = 0; i < NOCHROMO_ENTRY_COUNT; i++) {
|
||||
- nochromo_entry* entry = &NOCHROMO_ENTRIES[i];
|
||||
-
|
||||
- // no use checking rules when we're intercepting, or exceptions when not
|
||||
- bool check =
|
||||
- (!intercept && ((entry->flags & NOCHROMO_FLAG_EXCEPTION) == 0)) ||
|
||||
- (intercept && ((entry->flags & NOCHROMO_FLAG_EXCEPTION) != 0));
|
||||
-
|
||||
- if (check) {
|
||||
- bool match = false;
|
||||
-
|
||||
- // select comparison string based on case and separator presence (separator takes some shortcuts)
|
||||
- bool match_case = ((entry->flags & NOCHROMO_FLAG_MATCH_CASE) != 0);
|
||||
- bool match_separator = ((entry->flags & NOCHROMO_FLAG_HAS_SEPARATOR) != 0);
|
||||
- const char* match_url = match_case ? (match_separator ? c_url_sep : c_url) : (match_separator ? c_url_lower_sep : c_url_lower);
|
||||
-
|
||||
- if (NOCHROMO_LOG || NOCHROMO_LOG_MORE) __android_log_print(ANDROID_LOG_INFO, "NoChromo", "[case:%d][sep:%d][%s]", match_case, match_separator, match_url);
|
||||
-
|
||||
- // check for all match parts at >= position of last match
|
||||
- const char* last = match_url;
|
||||
- for (int m = 0; m < entry->matchcount; m++) {
|
||||
- const char* pos = strstr(last, entry->matches[m]);
|
||||
- match = (pos != NULL);
|
||||
-
|
||||
- if (NOCHROMO_LOG || NOCHROMO_LOG_MORE) __android_log_print(ANDROID_LOG_INFO, "NoChromo", "[%s][found:%d][match:%d]", entry->matches[m], pos == NULL ? 0 : 1, match ? 1 : 0);
|
||||
-
|
||||
- // check if the url starts with the first match part
|
||||
- if (match && (m == 0) && ((entry->flags & NOCHROMO_FLAG_MATCH_BEGIN) != 0) && (pos != match_url)) match = false;
|
||||
-
|
||||
- // check if the url ends with the last match part
|
||||
- if (match && (m == entry->matchcount - 1) && ((entry->flags & NOCHROMO_FLAG_MATCH_END) != 0) && (pos != &match_url[strlen(match_url) - strlen(entry->matches[m])])) match = false;
|
||||
-
|
||||
- // check domain match
|
||||
- if (match && (m == 0) && ((entry->flags & NOCHROMO_FLAG_MATCH_DOMAIN) != 0) && (pos != match_url) && (pos[-1] != '^') && (pos[-1] != '.') && (pos[-1] != '/')) match = false;
|
||||
-
|
||||
- // short circuit
|
||||
- if (!match) break;
|
||||
- }
|
||||
-
|
||||
- if (match) {
|
||||
- if (NOCHROMO_LOG) {
|
||||
- if (!intercept) {
|
||||
- __android_log_print(ANDROID_LOG_INFO, "NoChromo", "--> intercept (%d) (%d)", i, entry->flags);
|
||||
- } else {
|
||||
- __android_log_print(ANDROID_LOG_INFO, "NoChromo", "--> pass (%d) (%d)", i, entry->flags);
|
||||
- }
|
||||
- }
|
||||
- intercept = !intercept;
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- free(c_url_sep);
|
||||
- free(c_url_lower);
|
||||
- free(c_url_lower_sep);
|
||||
-
|
||||
- if (intercept) {
|
||||
- if (NOCHROMO_LOG) __android_log_print(ANDROID_LOG_INFO, "NoChromo", "intercepted!");
|
||||
- return 1;
|
||||
- }
|
||||
- if (NOCHROMO_LOG) __android_log_print(ANDROID_LOG_INFO, "NoChromo", "pass!");
|
||||
- }
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-} // namespace net
|
||||
\ No newline at end of file
|
||||
diff --git a/net/url_request/nochromo_intercept.h b/net/url_request/nochromo_intercept.h
|
||||
deleted file mode 100644
|
||||
--- a/net/url_request/nochromo_intercept.h
|
||||
+++ /dev/null
|
||||
@@ -1,13 +0,0 @@
|
||||
-#ifndef NET_URL_REQUEST_NOCHROMO_INTERCEPT_H_
|
||||
-#define NET_URL_REQUEST_NOCHROMO_INTERCEPT_H_
|
||||
-
|
||||
-#include "url/gurl.h"
|
||||
-
|
||||
-namespace net {
|
||||
-
|
||||
-GURL nochromo_intercepted = GURL("http://127.0.0.1/");
|
||||
-int nochromo_intercept(const GURL& url);
|
||||
-
|
||||
-} // namespace net
|
||||
-
|
||||
-#endif // NET_URL_REQUEST_NOCHROMO_INTERCEPT_H_
|
||||
diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc
|
||||
--- a/net/url_request/url_request.cc
|
||||
+++ b/net/url_request/url_request.cc
|
||||
@@ -44,7 +44,9 @@
|
||||
#include "url/gurl.h"
|
||||
#include "url/origin.h"
|
||||
|
||||
-#include "net/url_request/nochromo_intercept.h"
|
||||
+#if defined(OS_ANDROID)
|
||||
+#include "net/url_request/adblock_intercept.h"
|
||||
+#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_REPORTING)
|
||||
#include "net/network_error_logging/network_error_logging_service.h"
|
||||
@@ -585,8 +587,6 @@ URLRequest::URLRequest(const GURL& url,
|
||||
// Sanity check out environment.
|
||||
DCHECK(base::ThreadTaskRunnerHandle::IsSet());
|
||||
|
||||
- if (nochromo_intercept(url)) url_chain_.push_back(nochromo_intercepted);
|
||||
-
|
||||
context->url_requests()->insert(this);
|
||||
net_log_.BeginEvent(
|
||||
NetLogEventType::REQUEST_ALIVE,
|
||||
@@ -665,6 +665,36 @@ void URLRequest::StartJob(URLRequestJob* job) {
|
||||
}
|
||||
}
|
||||
|
||||
+#if defined(OS_ANDROID)
|
||||
+ if (net::adblock_enabled) {
|
||||
+ std::string initiatorHost;
|
||||
+ if (initiator_.has_value()) {
|
||||
+ initiatorHost = initiator_.value().host();
|
||||
+ }
|
||||
+
|
||||
+ if (adblock_intercept(url(), initiatorHost)) {
|
||||
+ std::string source("delegate");
|
||||
+ net_log_.AddEvent(NetLogEventType::CANCELLED,
|
||||
+ NetLog::StringCallback("source", &source));
|
||||
+
|
||||
+ job_.reset(new URLRequestErrorJob(
|
||||
+ this, network_delegate_, ERR_BLOCKED_BY_CLIENT));
|
||||
+
|
||||
+ job_->SetExtraRequestHeaders(extra_request_headers_);
|
||||
+ job_->SetPriority(priority_);
|
||||
+ job_->SetRequestHeadersCallback(request_headers_callback_);
|
||||
+ job_->SetResponseHeadersCallback(response_headers_callback_);
|
||||
+
|
||||
+ if (upload_data_stream_.get())
|
||||
+ job_->SetUpload(upload_data_stream_.get());
|
||||
+
|
||||
+ // on fallthrough the initial status will be ERR_IO_PENDING,
|
||||
+ // but the URLRequestErrorJob will then call NotifyResponseStarted
|
||||
+ // with the correct ERR_BLOCKED_BYCLIENT status
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
// Start() always completes asynchronously.
|
||||
//
|
||||
// Status is generally set by URLRequestJob itself, but Start() calls
|
||||
--
|
||||
2.7.4
|
||||
|
||||
|
|
|
@ -6,32 +6,31 @@ With the introduction of this flag it is possible to increase the maximum
|
|||
allowed connections per host; this can however be detrimental to devices
|
||||
with limited CPU/memory resources and it is disabled by default.
|
||||
---
|
||||
chrome/browser/about_flags.cc | 9 +++++++++
|
||||
chrome/browser/flag_descriptions.cc | 4 ++++
|
||||
chrome/browser/flag_descriptions.h | 3 +++
|
||||
.../common/network_features.cc | 4 ++++
|
||||
.../common/network_features.h | 4 ++++
|
||||
.../common/network_switch_list.h | 4 ++++
|
||||
net/socket/client_socket_pool_manager.cc | 17 +++++++++++++++++
|
||||
7 files changed, 45 insertions(+)
|
||||
chrome/browser/about_flags.cc | 8 ++++++++
|
||||
chrome/browser/flag_descriptions.cc | 4 ++++
|
||||
chrome/browser/flag_descriptions.h | 3 +++
|
||||
.../common/network_features.cc | 3 +++
|
||||
.../common/network_features.h | 4 ++++
|
||||
.../common/network_switch_list.h | 4 ++++
|
||||
net/socket/client_socket_pool_manager.cc | 16 ++++++++++++++++
|
||||
7 files changed, 42 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
|
||||
@@ -798,6 +798,12 @@ const FeatureEntry::Choice kForceEffectiveConnectionTypeChoices[] = {
|
||||
@@ -798,6 +798,11 @@ const FeatureEntry::Choice kForceEffectiveConnectionTypeChoices[] = {
|
||||
net::kEffectiveConnectionType4G},
|
||||
};
|
||||
|
||||
+const FeatureEntry::Choice kMaxConnectionsPerHostChoices[] = {
|
||||
+ {features::kMaxConnectionsPerHostChoiceDefault, "", "6"},
|
||||
+ {features::kMaxConnectionsPerHostChoice6, switches::kMaxConnectionsPerHost, "6"},
|
||||
+ {features::kMaxConnectionsPerHostChoiceDefault, "", ""},
|
||||
+ {features::kMaxConnectionsPerHostChoice15, switches::kMaxConnectionsPerHost, "15"},
|
||||
+};
|
||||
+
|
||||
// Ensure that all effective connection types returned by Network Quality
|
||||
// Estimator (NQE) are also exposed via flags.
|
||||
static_assert(net::EFFECTIVE_CONNECTION_TYPE_LAST + 2 ==
|
||||
@@ -2398,6 +2404,9 @@ const FeatureEntry kFeatureEntries[] = {
|
||||
@@ -2398,6 +2403,9 @@ const FeatureEntry kFeatureEntries[] = {
|
||||
flag_descriptions::kMaterialDesignIncognitoNTPName,
|
||||
flag_descriptions::kMaterialDesignIncognitoNTPDescription, kOsAndroid,
|
||||
FEATURE_VALUE_TYPE(features::kMaterialDesignIncognitoNTP)},
|
||||
|
@ -71,12 +70,11 @@ diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptio
|
|||
diff --git a/components/network_session_configurator/common/network_features.cc b/components/network_session_configurator/common/network_features.cc
|
||||
--- a/components/network_session_configurator/common/network_features.cc
|
||||
+++ b/components/network_session_configurator/common/network_features.cc
|
||||
@@ -8,6 +8,10 @@
|
||||
@@ -8,6 +8,9 @@
|
||||
|
||||
namespace features {
|
||||
|
||||
+const char kMaxConnectionsPerHostChoiceDefault[] = "Default",
|
||||
+ kMaxConnectionsPerHostChoice6[] = "6",
|
||||
+const char kMaxConnectionsPerHostChoiceDefault[] = "6",
|
||||
+ kMaxConnectionsPerHostChoice15[] = "15";
|
||||
+
|
||||
const base::Feature kTokenBinding{"token-binding",
|
||||
|
@ -132,17 +130,16 @@ diff --git a/net/socket/client_socket_pool_manager.cc b/net/socket/client_socket
|
|||
|
||||
namespace net {
|
||||
|
||||
@@ -316,6 +319,20 @@ void ClientSocketPoolManager::set_max_sockets_per_pool(
|
||||
@@ -316,6 +319,19 @@ void ClientSocketPoolManager::set_max_sockets_per_pool(
|
||||
int ClientSocketPoolManager::max_sockets_per_group(
|
||||
HttpNetworkSession::SocketPoolType pool_type) {
|
||||
DCHECK_LT(pool_type, HttpNetworkSession::NUM_SOCKET_POOL_TYPES);
|
||||
+
|
||||
+ if (pool_type == HttpNetworkSession::NORMAL_SOCKET_POOL) {
|
||||
+ int maxConnectionsPerHost;
|
||||
+ if (!base::StringToInt(base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switches::kMaxConnectionsPerHost),
|
||||
+ &maxConnectionsPerHost)) {
|
||||
+ LOG(DFATAL) << "--" << switches::kMaxConnectionsPerHost << " only accepts integers as arguments";
|
||||
+ maxConnectionsPerHost = 0;
|
||||
+ int maxConnectionsPerHost = 0;
|
||||
+ auto value = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switches::kMaxConnectionsPerHost);
|
||||
+ if (!value.empty() && !base::StringToInt(value, &maxConnectionsPerHost)) {
|
||||
+ LOG(DFATAL) << "--" << switches::kMaxConnectionsPerHost << " only accepts integers as arguments (\"" << value << "\" is invalid)";
|
||||
+ }
|
||||
+ if (maxConnectionsPerHost != 0) {
|
||||
+ return maxConnectionsPerHost;
|
||||
|
|
|
@ -14,7 +14,7 @@ Subject: Add flag to show/hide NTP tiles
|
|||
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
|
||||
@@ -1916,6 +1916,10 @@ const FeatureEntry kFeatureEntries[] = {
|
||||
@@ -1915,6 +1915,10 @@ const FeatureEntry kFeatureEntries[] = {
|
||||
flag_descriptions::kChromeModernAlternateCardLayoutName,
|
||||
flag_descriptions::kChromeModernAlternateCardLayoutDescription, kOsAndroid,
|
||||
FEATURE_VALUE_TYPE(chrome::android::kChromeModernAlternateCardLayout)},
|
||||
|
|
|
@ -50,7 +50,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/LaunchIntentDis
|
|||
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
|
||||
@@ -1298,6 +1298,10 @@ const FeatureEntry kFeatureEntries[] = {
|
||||
@@ -1297,6 +1297,10 @@ const FeatureEntry kFeatureEntries[] = {
|
||||
flag_descriptions::kMediaScreenCaptureName,
|
||||
flag_descriptions::kMediaScreenCaptureDescription, kOsAndroid,
|
||||
FEATURE_VALUE_TYPE(chrome::android::kUserMediaScreenCapturing)},
|
||||
|
|
|
@ -29,14 +29,14 @@ diff --git a/chrome/android/java/res/menu/bookmark_action_bar_menu.xml b/chrome/
|
|||
app:iconTint="@color/dark_mode_tint" />
|
||||
<item
|
||||
+ android:id="@+id/import_menu_id"
|
||||
+ android:icon="@drawable/folder_open"
|
||||
+ android:icon="@drawable/add_circle_blue"
|
||||
+ android:title="@string/import_bookmarks"
|
||||
+ android:visible="true"
|
||||
+ app:showAsAction="ifRoom"
|
||||
+ app:iconTint="@color/dark_mode_tint" />
|
||||
+ <item
|
||||
+ android:id="@+id/export_menu_id"
|
||||
+ android:icon="@drawable/save"
|
||||
+ android:icon="@drawable/ic_file_download_white_24dp"
|
||||
+ android:title="@string/export_bookmarks"
|
||||
+ android:visible="true"
|
||||
+ app:showAsAction="ifRoom"
|
||||
|
|
|
@ -0,0 +1,109 @@
|
|||
From: samartnik <artem@brave.com>
|
||||
Date: Tue, 17 Apr 2018 17:14:00 +0300
|
||||
Subject: Add option to not persist tabs across sessions
|
||||
|
||||
---
|
||||
chrome/android/java/res/values/values.xml | 3 +++
|
||||
chrome/android/java/res/xml/privacy_preferences.xml | 5 +++++
|
||||
.../src/org/chromium/chrome/browser/ChromeTabbedActivity.java | 4 +++-
|
||||
.../browser/preferences/privacy/PrivacyPreferences.java | 11 +++++++++++
|
||||
chrome/android/java/strings/android_chrome_strings.grd | 6 ++++++
|
||||
5 files changed, 28 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/chrome/android/java/res/values/values.xml b/chrome/android/java/res/values/values.xml
|
||||
--- a/chrome/android/java/res/values/values.xml
|
||||
+++ b/chrome/android/java/res/values/values.xml
|
||||
@@ -59,6 +59,9 @@
|
||||
<string name="help_context_change_sync_passphrase">change_sync_passphrase</string>
|
||||
<!-- TODO(peconn): Add help section. -->
|
||||
<!-- <string name="help_context_suggestions">mobile_content_suggestions</string> -->
|
||||
+
|
||||
+ <string name="close_tabs_on_exit_title">Close tabs on exit</string>
|
||||
+ <string name="close_tabs_on_exit_summary">Don\'t persist tabs between browsing sessions</string>
|
||||
|
||||
<!-- Our manage space activity. Default pre-KitKat to be nothing. -->
|
||||
<string name="manage_space_activity"></string>
|
||||
diff --git a/chrome/android/java/res/xml/privacy_preferences.xml b/chrome/android/java/res/xml/privacy_preferences.xml
|
||||
--- a/chrome/android/java/res/xml/privacy_preferences.xml
|
||||
+++ b/chrome/android/java/res/xml/privacy_preferences.xml
|
||||
@@ -15,6 +15,11 @@
|
||||
android:summary="@string/search_suggestions_summary"
|
||||
android:defaultValue="true" />
|
||||
<org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference
|
||||
+ android:key="close_tabs_on_exit"
|
||||
+ android:title="@string/close_tabs_on_exit_title"
|
||||
+ android:summary="@string/close_tabs_on_exit_summary"
|
||||
+ android:defaultValue="false" />
|
||||
+ <org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference
|
||||
android:key="safe_browsing_extended_reporting"
|
||||
android:title="@string/safe_browsing_extended_reporting_title"
|
||||
android:summary="@string/safe_browsing_extended_reporting_summary" />
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
|
||||
@@ -1004,8 +1004,10 @@ public class ChromeTabbedActivity
|
||||
boolean hadCipherData =
|
||||
CipherFactory.getInstance().restoreFromBundle(getSavedInstanceState());
|
||||
|
||||
+ String PREF_CLOSE_TABS_ON_EXIT = "close_tabs_on_exit";
|
||||
boolean noRestoreState =
|
||||
- CommandLine.getInstance().hasSwitch(ChromeSwitches.NO_RESTORE_STATE);
|
||||
+ CommandLine.getInstance().hasSwitch(ChromeSwitches.NO_RESTORE_STATE) ||
|
||||
+ ContextUtils.getAppSharedPreferences().getBoolean(PREF_CLOSE_TABS_ON_EXIT, false);
|
||||
if (noRestoreState) {
|
||||
// Clear the state files because they are inconsistent and useless from now on.
|
||||
mTabModelSelectorImpl.clearState();
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/PrivacyPreferences.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/PrivacyPreferences.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/PrivacyPreferences.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/PrivacyPreferences.java
|
||||
@@ -44,6 +44,7 @@ public class PrivacyPreferences extends PreferenceFragment
|
||||
private static final String PREF_DO_NOT_TRACK = "do_not_track";
|
||||
private static final String PREF_USAGE_AND_CRASH_REPORTING = "usage_and_crash_reports";
|
||||
private static final String PREF_CLEAR_BROWSING_DATA = "clear_browsing_data";
|
||||
+ private static final String PREF_CLOSE_TABS_ON_EXIT = "close_tabs_on_exit";
|
||||
|
||||
private ManagedPreferenceDelegate mManagedPreferenceDelegate;
|
||||
|
||||
@@ -109,6 +110,11 @@ public class PrivacyPreferences extends PreferenceFragment
|
||||
(ChromeBaseCheckBoxPreference) findPreference(PREF_CAN_MAKE_PAYMENT);
|
||||
canMakePaymentPref.setOnPreferenceChangeListener(this);
|
||||
|
||||
+ ChromeBaseCheckBoxPreference closeTabsOnExitPref =
|
||||
+ (ChromeBaseCheckBoxPreference) findPreference(PREF_CLOSE_TABS_ON_EXIT);
|
||||
+ closeTabsOnExitPref.setOnPreferenceChangeListener(this);
|
||||
+ closeTabsOnExitPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
|
||||
+
|
||||
updateSummaries();
|
||||
}
|
||||
|
||||
@@ -148,6 +154,11 @@ public class PrivacyPreferences extends PreferenceFragment
|
||||
}
|
||||
|
||||
/**
|
||||
+ else if (PREF_CLOSE_TABS_ON_EXIT.equals(key)) {
|
||||
+ SharedPreferences.Editor sharedPreferencesEditor = ContextUtils.getAppSharedPreferences().edit();
|
||||
+ sharedPreferencesEditor.putBoolean(PREF_CLOSE_TABS_ON_EXIT, (boolean)newValue);
|
||||
+ sharedPreferencesEditor.apply();
|
||||
+ }
|
||||
* Updates the summaries for several preferences.
|
||||
*/
|
||||
public void updateSummaries() {
|
||||
diff --git a/chrome/android/java/strings/android_chrome_strings.grd b/chrome/android/java/strings/android_chrome_strings.grd
|
||||
--- a/chrome/android/java/strings/android_chrome_strings.grd
|
||||
+++ b/chrome/android/java/strings/android_chrome_strings.grd
|
||||
@@ -3450,6 +3450,12 @@ However, you aren’t invisible. Going incognito doesn’t hide your browsing fr
|
||||
<message name="IDS_NEAR_OOM_INTERVENTION_DECLINE" desc="The text of the button letting the user decline the browser's intervention, so that the page can resume what it was doing.">
|
||||
Resume
|
||||
</message>
|
||||
+ <message name="IDS_CLOSE_TABS_ON_EXIT_TITLE" desc="Text for 'Close tabs on exit' settings-privacy option.">
|
||||
+ Close all open tabs on exit
|
||||
+ </message>
|
||||
+ <message name="IDS_CLOSE_TABS_ON_EXIT_SUMMARY" desc="Summary text for 'Close tabs on exit' settings-privacy option.">
|
||||
+ Don't persist tabs between browsing sessions
|
||||
+ </message>
|
||||
</messages>
|
||||
</release>
|
||||
</grit>
|
||||
--
|
||||
2.7.4
|
||||
|
313
patches/BRM065_Add-an-always-incognito-mode.patch
Normal file
313
patches/BRM065_Add-an-always-incognito-mode.patch
Normal file
|
@ -0,0 +1,313 @@
|
|||
From: Ryan Archer <ryan.bradley.archer@gmail.com>
|
||||
Date: Wed, 2 Aug 2017 01:41:28 -0400
|
||||
Subject: Add an always-incognito mode.
|
||||
|
||||
More specifically, add a preference that causes all new tabs and all
|
||||
clicked links to launch as incognito.
|
||||
---
|
||||
.../android/java/res/xml/privacy_preferences.xml | 5 ++
|
||||
.../browser/AlwaysIncognitoLinkInterceptor.java | 72 ++++++++++++++++++++++
|
||||
.../chromium/chrome/browser/ChromeActivity.java | 4 ++
|
||||
.../chrome/browser/appmenu/AppMenuHandler.java | 12 ++++
|
||||
.../contextmenu/ChromeContextMenuPopulator.java | 7 +++
|
||||
.../chrome/browser/tabmodel/ChromeTabCreator.java | 24 +++++++-
|
||||
.../java/strings/android_chrome_strings.grd | 6 ++
|
||||
chrome/android/java_sources.gni | 1 +
|
||||
8 files changed, 130 insertions(+), 1 deletion(-)
|
||||
create mode 100644 chrome/android/java/src/org/chromium/chrome/browser/AlwaysIncognitoLinkInterceptor.java
|
||||
|
||||
diff --git a/chrome/android/java/res/xml/privacy_preferences.xml b/chrome/android/java/res/xml/privacy_preferences.xml
|
||||
--- a/chrome/android/java/res/xml/privacy_preferences.xml
|
||||
+++ b/chrome/android/java/res/xml/privacy_preferences.xml
|
||||
@@ -20,6 +20,11 @@
|
||||
android:summary="@string/close_tabs_on_exit_summary"
|
||||
android:defaultValue="false" />
|
||||
<org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference
|
||||
+ android:key="always_incognito"
|
||||
+ android:title="@string/always_incognito_title"
|
||||
+ android:summary="@string/always_incognito_summary"
|
||||
+ android:defaultValue="false" />
|
||||
+ <org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference
|
||||
android:key="safe_browsing_extended_reporting"
|
||||
android:title="@string/safe_browsing_extended_reporting_title"
|
||||
android:summary="@string/safe_browsing_extended_reporting_summary" />
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/AlwaysIncognitoLinkInterceptor.java b/chrome/android/java/src/org/chromium/chrome/browser/AlwaysIncognitoLinkInterceptor.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/AlwaysIncognitoLinkInterceptor.java
|
||||
@@ -0,0 +1,72 @@
|
||||
+/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
+
|
||||
+package org.chromium.chrome.browser;
|
||||
+
|
||||
+import android.content.SharedPreferences;
|
||||
+
|
||||
+import org.chromium.chrome.browser.tab.EmptyTabObserver;
|
||||
+import org.chromium.chrome.browser.tab.Tab;
|
||||
+import org.chromium.chrome.browser.tabmodel.TabCreatorManager;
|
||||
+import org.chromium.chrome.browser.tabmodel.TabModel;
|
||||
+import org.chromium.content_public.browser.LoadUrlParams;
|
||||
+
|
||||
+import java.util.HashMap;
|
||||
+import java.util.HashSet;
|
||||
+import java.util.Map;
|
||||
+import java.util.Set;
|
||||
+/**
|
||||
+ * A {@link TabObserver} that implements the always-incognito preference behavior for links. When the preference is set
|
||||
+ * to true, it intercepts links opened within observed {@link Tab}s and opens them in new incognito <code>Tab</code>s instead.
|
||||
+ */
|
||||
+public class AlwaysIncognitoLinkInterceptor extends EmptyTabObserver {
|
||||
+
|
||||
+ private static final String PREF_ALWAYS_INCOGNITO = "always_incognito";
|
||||
+
|
||||
+ private final SharedPreferences alwaysIncognitoContainer;
|
||||
+ private final Map<Tab, String> lastUrls;
|
||||
+ private final Set<Tab> revertingTabs;
|
||||
+
|
||||
+ public AlwaysIncognitoLinkInterceptor(final SharedPreferences alwaysIncognitoContainer) {
|
||||
+
|
||||
+ assert alwaysIncognitoContainer != null;
|
||||
+
|
||||
+ this.alwaysIncognitoContainer = alwaysIncognitoContainer;
|
||||
+ lastUrls = new HashMap<Tab, String>();
|
||||
+ revertingTabs = new HashSet<Tab>();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void onDestroyed(final Tab tab)
|
||||
+ {
|
||||
+ lastUrls.remove(tab);
|
||||
+ revertingTabs.remove(tab);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void onUpdateUrl(final Tab tab, final String url) {
|
||||
+
|
||||
+ if (tab == null) return;
|
||||
+ if (url == null) return;
|
||||
+ if (tab.isIncognito()) return;
|
||||
+ if (alwaysIncognitoContainer == null) return;
|
||||
+
|
||||
+ final String lastUrl = lastUrls.put(tab, url);
|
||||
+
|
||||
+ if (!alwaysIncognitoContainer.getBoolean(PREF_ALWAYS_INCOGNITO, false)) return;
|
||||
+ if (revertingTabs.contains(tab)) {
|
||||
+ revertingTabs.remove(tab);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ tab.getActivity().getTabCreator(true).createNewTab(new LoadUrlParams(url), TabModel.TabLaunchType.FROM_LINK, tab);
|
||||
+
|
||||
+ if ((url.equals(lastUrl)) || (!tab.canGoBack())) {
|
||||
+ // this call was triggered by a reload
|
||||
+ } else {
|
||||
+ revertingTabs.add(tab);
|
||||
+ tab.goBack();
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java
|
||||
@@ -243,6 +243,7 @@ public abstract class ChromeActivity extends AsyncInitializationActivity
|
||||
private TouchExplorationStateChangeListener mTouchExplorationStateChangeListener;
|
||||
|
||||
// Observes when sync becomes ready to create the mContextReporter.
|
||||
+ private static final String PREF_ALWAYS_INCOGNITO = "always_incognito";
|
||||
private ProfileSyncService.SyncStateChangedListener mSyncStateChangedListener;
|
||||
|
||||
private ChromeFullscreenManager mFullscreenManager;
|
||||
@@ -1593,6 +1594,9 @@ public abstract class ChromeActivity extends AsyncInitializationActivity
|
||||
throw new IllegalStateException(
|
||||
"Attempting to access TabCreator before initialization");
|
||||
}
|
||||
+ if (ContextUtils.getAppSharedPreferences().getBoolean(PREF_ALWAYS_INCOGNITO, false)) {
|
||||
+ return mIncognitoTabCreator;
|
||||
+ }
|
||||
return incognito ? mIncognitoTabCreator : mRegularTabCreator;
|
||||
}
|
||||
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuHandler.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuHandler.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuHandler.java
|
||||
@@ -17,6 +17,7 @@ import android.view.View;
|
||||
import android.widget.PopupMenu;
|
||||
|
||||
import org.chromium.base.metrics.RecordUserAction;
|
||||
+import org.chromium.base.ContextUtils;
|
||||
import org.chromium.chrome.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -26,6 +27,9 @@ import java.util.ArrayList;
|
||||
* AppMenuObservers about these actions.
|
||||
*/
|
||||
public class AppMenuHandler {
|
||||
+
|
||||
+ private static final String PREF_ALWAYS_INCOGNITO = "always_incognito";
|
||||
+
|
||||
private AppMenu mAppMenu;
|
||||
private AppMenuDragHelper mAppMenuDragHelper;
|
||||
private Menu mMenu;
|
||||
@@ -166,6 +170,14 @@ public class AppMenuHandler {
|
||||
if (mDelegate.shouldShowHeader(appRect.height())) {
|
||||
headerView = mDelegate.getHeaderView();
|
||||
}
|
||||
+
|
||||
+ if (ContextUtils.getAppSharedPreferences().getBoolean(PREF_ALWAYS_INCOGNITO, false)) {
|
||||
+ final MenuItem newTabOption = mAppMenu.getMenu().findItem(R.id.new_tab_menu_id);
|
||||
+ if (newTabOption != null) {
|
||||
+ newTabOption.setVisible(false);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
mAppMenu.show(wrapper, anchorView, isByPermanentButton, rotation, appRect, pt.y,
|
||||
footerResourceId, headerView, mHighlightMenuId);
|
||||
mAppMenuDragHelper.onShow(startDragging);
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java b/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java
|
||||
@@ -14,6 +14,7 @@ import android.view.ContextMenu;
|
||||
import android.webkit.MimeTypeMap;
|
||||
|
||||
import org.chromium.base.CollectionUtil;
|
||||
+import org.chromium.base.ContextUtils;
|
||||
import org.chromium.base.library_loader.LibraryProcessType;
|
||||
import org.chromium.base.metrics.RecordHistogram;
|
||||
import org.chromium.chrome.R;
|
||||
@@ -45,6 +46,7 @@ import java.util.Set;
|
||||
*/
|
||||
public class ChromeContextMenuPopulator implements ContextMenuPopulator {
|
||||
private static final String TAG = "CCMenuPopulator";
|
||||
+ private static final String PREF_ALWAYS_INCOGNITO = "always_incognito";
|
||||
private static final ShareContextMenuItem SHARE_IMAGE =
|
||||
new ShareContextMenuItem(R.drawable.ic_share_white_24dp,
|
||||
R.string.contextmenu_share_image, R.id.contextmenu_share_image, false);
|
||||
@@ -463,6 +465,11 @@ public class ChromeContextMenuPopulator implements ContextMenuPopulator {
|
||||
disabledOptions.add(ChromeContextMenuItem.OPEN_IN_INCOGNITO_TAB);
|
||||
}
|
||||
|
||||
+ if (ContextUtils.getAppSharedPreferences().getBoolean(PREF_ALWAYS_INCOGNITO, false)
|
||||
+ && !mDelegate.isIncognito()) {
|
||||
+ disabledOptions.add(ChromeContextMenuItem.OPEN_IN_NEW_TAB);
|
||||
+ }
|
||||
+
|
||||
if (params.getLinkText().trim().isEmpty() || params.isImage()) {
|
||||
disabledOptions.add(ChromeContextMenuItem.COPY_LINK_TEXT);
|
||||
}
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/ChromeTabCreator.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/ChromeTabCreator.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/ChromeTabCreator.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/ChromeTabCreator.java
|
||||
@@ -7,8 +7,10 @@ package org.chromium.chrome.browser.tabmodel;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
|
||||
+import org.chromium.base.ContextUtils;
|
||||
import org.chromium.base.SysUtils;
|
||||
import org.chromium.base.TraceEvent;
|
||||
+import org.chromium.chrome.browser.AlwaysIncognitoLinkInterceptor;
|
||||
import org.chromium.chrome.browser.ChromeActivity;
|
||||
import org.chromium.chrome.browser.ChromeFeatureList;
|
||||
import org.chromium.chrome.browser.IntentHandler;
|
||||
@@ -19,6 +21,7 @@ import org.chromium.chrome.browser.compositor.layouts.content.TabContentManager;
|
||||
import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings;
|
||||
import org.chromium.chrome.browser.tab.Tab;
|
||||
import org.chromium.chrome.browser.tab.TabDelegateFactory;
|
||||
+import org.chromium.chrome.browser.tab.TabObserver;
|
||||
import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType;
|
||||
import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType;
|
||||
import org.chromium.chrome.browser.util.IntentUtils;
|
||||
@@ -36,6 +39,7 @@ public class ChromeTabCreator extends TabCreatorManager.TabCreator {
|
||||
|
||||
private final ChromeActivity mActivity;
|
||||
private final boolean mIncognito;
|
||||
+ private final TabObserver mExtraLogic;
|
||||
|
||||
private WindowAndroid mNativeWindow;
|
||||
private TabModel mTabModel;
|
||||
@@ -47,6 +51,11 @@ public class ChromeTabCreator extends TabCreatorManager.TabCreator {
|
||||
mActivity = activity;
|
||||
mNativeWindow = nativeWindow;
|
||||
mIncognito = incognito;
|
||||
+ if (!mIncognito) {
|
||||
+ mExtraLogic = new AlwaysIncognitoLinkInterceptor(ContextUtils.getAppSharedPreferences());
|
||||
+ } else {
|
||||
+ mExtraLogic = null;
|
||||
+ }
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -159,6 +168,10 @@ public class ChromeTabCreator extends TabCreatorManager.TabCreator {
|
||||
tab.getWebContents());
|
||||
}
|
||||
|
||||
+ if (mExtraLogic != null) {
|
||||
+ tab.addObserver(mExtraLogic);
|
||||
+ }
|
||||
+
|
||||
mTabModel.addTab(tab, position, type);
|
||||
return tab;
|
||||
} finally {
|
||||
@@ -199,6 +212,11 @@ public class ChromeTabCreator extends TabCreatorManager.TabCreator {
|
||||
Tab tab = Tab.createLiveTab(
|
||||
Tab.INVALID_TAB_ID, mIncognito, mNativeWindow, type, parentId, !openInForeground);
|
||||
tab.initialize(webContents, mTabContentManager, delegateFactory, !openInForeground, false);
|
||||
+
|
||||
+ if (mExtraLogic != null) {
|
||||
+ tab.addObserver(mExtraLogic);
|
||||
+ }
|
||||
+
|
||||
mTabModel.addTab(tab, position, type);
|
||||
return true;
|
||||
}
|
||||
@@ -242,7 +260,6 @@ public class ChromeTabCreator extends TabCreatorManager.TabCreator {
|
||||
*/
|
||||
public Tab launchUrlFromExternalApp(String url, String referer, String headers,
|
||||
String appId, boolean forceNewTab, Intent intent, long intentTimestamp) {
|
||||
- assert !mIncognito;
|
||||
boolean isLaunchedFromChrome = TextUtils.equals(appId, mActivity.getPackageName());
|
||||
|
||||
// If an external app sends an intent for a Weblite URL and the Data Reduction Proxy is
|
||||
@@ -302,6 +319,11 @@ public class ChromeTabCreator extends TabCreatorManager.TabCreator {
|
||||
tab.initialize(
|
||||
null, mTabContentManager, createDefaultTabDelegateFactory(), !selectTab, false);
|
||||
assert state.isIncognito() == mIncognito;
|
||||
+
|
||||
+ if (mExtraLogic != null) {
|
||||
+ tab.addObserver(mExtraLogic);
|
||||
+ }
|
||||
+
|
||||
mTabModel.addTab(tab, index, TabLaunchType.FROM_RESTORE);
|
||||
return tab;
|
||||
}
|
||||
diff --git a/chrome/android/java/strings/android_chrome_strings.grd b/chrome/android/java/strings/android_chrome_strings.grd
|
||||
--- a/chrome/android/java/strings/android_chrome_strings.grd
|
||||
+++ b/chrome/android/java/strings/android_chrome_strings.grd
|
||||
@@ -615,6 +615,12 @@ CHAR-LIMIT guidelines:
|
||||
<message name="IDS_SAFE_BROWSING_SCOUT_REPORTING_SUMMARY" desc="Summary for reporting data to detect bad apps/sites.">
|
||||
Automatically send some system information and page content to Google to help detect dangerous apps and sites
|
||||
</message>
|
||||
+ <message name="IDS_ALWAYS_INCOGNITO_TITLE" desc="Title for always incognito mode">
|
||||
+ Open links in incognito tabs always
|
||||
+ </message>
|
||||
+ <message name="IDS_ALWAYS_INCOGNITO_SUMMARY" desc="Summary for always incognito mode">
|
||||
+ Opens links in incognito tabs when you click on new tab or on a link
|
||||
+ </message>
|
||||
<message name="IDS_SAFE_BROWSING_TITLE" desc="Title for safe browsing.">
|
||||
Safe Browsing
|
||||
</message>
|
||||
diff --git a/chrome/android/java_sources.gni b/chrome/android/java_sources.gni
|
||||
--- a/chrome/android/java_sources.gni
|
||||
+++ b/chrome/android/java_sources.gni
|
||||
@@ -7,6 +7,7 @@ import("//components/offline_pages/buildflags/features.gni")
|
||||
import("//device/vr/buildflags/buildflags.gni")
|
||||
|
||||
chrome_java_sources = [
|
||||
+ "java/src/org/chromium/chrome/browser/AlwaysIncognitoLinkInterceptor.java",
|
||||
"java/src/com/google/android/apps/chrome/appwidget/bookmarks/BookmarkThumbnailWidgetProvider.java",
|
||||
"java/src/org/chromium/chrome/browser/ActivityTabTaskDescriptionHelper.java",
|
||||
"java/src/org/chromium/chrome/browser/ActivityTaskDescriptionIconGenerator.java",
|
||||
--
|
||||
2.7.4
|
||||
|
|
@ -413,7 +413,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/services/gcm/In
|
|||
diff --git a/chrome/android/java_sources.gni b/chrome/android/java_sources.gni
|
||||
--- a/chrome/android/java_sources.gni
|
||||
+++ b/chrome/android/java_sources.gni
|
||||
@@ -24,7 +24,6 @@ chrome_java_sources = [
|
||||
@@ -25,7 +25,6 @@ chrome_java_sources = [
|
||||
"java/src/org/chromium/chrome/browser/ChromeActivity.java",
|
||||
"java/src/org/chromium/chrome/browser/ChromeActivitySessionTracker.java",
|
||||
"java/src/org/chromium/chrome/browser/ChromeApplication.java",
|
||||
|
@ -421,7 +421,7 @@ diff --git a/chrome/android/java_sources.gni b/chrome/android/java_sources.gni
|
|||
"java/src/org/chromium/chrome/browser/ChromeBackupAgent.java",
|
||||
"java/src/org/chromium/chrome/browser/ChromeBackupWatcher.java",
|
||||
"java/src/org/chromium/chrome/browser/ChromeFeatureList.java",
|
||||
@@ -1159,7 +1158,6 @@ chrome_java_sources = [
|
||||
@@ -1160,7 +1159,6 @@ chrome_java_sources = [
|
||||
"java/src/org/chromium/chrome/browser/services/AndroidEduAndChildAccountHelper.java",
|
||||
"java/src/org/chromium/chrome/browser/services/AndroidEduOwnerCheckCallback.java",
|
||||
"java/src/org/chromium/chrome/browser/services/GoogleServicesManager.java",
|
|
@ -198,7 +198,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omaha/UpdateMen
|
|||
diff --git a/chrome/android/java_sources.gni b/chrome/android/java_sources.gni
|
||||
--- a/chrome/android/java_sources.gni
|
||||
+++ b/chrome/android/java_sources.gni
|
||||
@@ -540,10 +540,7 @@ chrome_java_sources = [
|
||||
@@ -541,10 +541,7 @@ chrome_java_sources = [
|
||||
"java/src/org/chromium/chrome/browser/fullscreen/FullscreenManager.java",
|
||||
"java/src/org/chromium/chrome/browser/fullscreen/FullscreenOptions.java",
|
||||
"java/src/org/chromium/chrome/browser/gcore/ChromeGoogleApiClient.java",
|
Loading…
Add table
Reference in a new issue