Compare commits

...
Author SHA1 Message Date
csagan5 34b616ba9f Release 71.0.3578.104 2018-12-21 11:01:16 +01:00
csagan5 2e6d2a5c75 Mention GN_ARGS in README 2018-12-21 10:31:38 +01:00
csagan5 f963a09239 Release 71.0.3578.101 2018-12-18 23:53:07 +01:00
csagan5 fcbca7eb8c Release 71.0.3578.98 2018-12-16 07:30:03 +01:00
csagan5 65c50e3ec9 Release 71.0.3578.88 2018-12-13 07:22:42 +01:00
csagan5 6cf627f9d4 Release 71.0.3578.85 2018-12-06 11:31:38 +01:00
44 changed files with 2916 additions and 347 deletions
+16
View File
@@ -1,3 +1,19 @@
# 71.0.3578.104
* fix AMP links sanitisation; have it working for news as well (fixes https://github.com/bromite/bromite/issues/202)
* revert upstream patch responsible for the broken save dialog prompt (upstream: https://bugs.chromium.org/p/chromium/issues/detail?id=916606)
# 71.0.3578.101
# 71.0.3578.98
* do not ask permissions for camera when importing bookmarks (fixes https://github.com/bromite/bromite/issues/200)
# 71.0.3578.88
* add proxy configuration page (see https://github.com/bromite/bromite/wiki/ProxyConfiguration)
* use more recent versions in User-Agent (fixes https://github.com/bromite/bromite/issues/156)
# 71.0.3578.85
* fix blurry adaptive icon (fixes https://github.com/bromite/bromite/issues/197)
# 71.0.3578.76
# 71.0.3578.72
+30
View File
@@ -0,0 +1,30 @@
android_channel="stable"
blink_symbol_level=1
dcheck_always_on=false
debuggable_apks=false
enable_ac3_eac3_audio_demuxing=true enable_hevc_demuxing=true enable_iterator_debugging=false
enable_av1_decoder=true
enable_hangout_services_extension=false
enable_mdns=false
enable_mse_mpeg2ts_stream_parser=true ffmpeg_branding="Chrome" proprietary_codecs=true
enable_nacl=false
enable_nacl_nonsfi=false
enable_remoting=false
enable_reporting=false
enable_resource_whitelist_generation=false
enable_vr=false
fieldtrial_testing_like_official_build=true
is_component_build=false
is_debug=false
is_official_build=true
jumbo_file_merge_limit=60
safe_browsing_mode=2
strip_absolute_paths_from_debug_symbols=true
strip_debug_info=false
symbol_level=1
target_os="android"
use_debug_fission=true
use_errorprone_java_compiler=false
use_official_google_api_keys=false
use_openh264=true chrome_pgo_phase=0 full_wpo_on_official=true
use_sysroot=false
+3
View File
@@ -76,6 +76,7 @@ Yes, since version 69. While the desktop version of Chromium has an option to di
* baked-in adblock engine with filters from EasyList, EasyPrivacy and others
* remove click-tracking and AMP from search results
* DNS-over-HTTPS support via Google, Cloudflare and Quad9 servers
* [proxy configuration page](https://github.com/bromite/bromite/wiki/ProxyConfiguration) with PAC and custom proxy lists support
* [StartPage](https://startpage.com/), [DuckDuckGo](https://duckduckgo.com/) and [Qwant](https://www.qwant.com/) search engines
* chrome flags to disable custom intents and clear session on exit
* always-incognito mode
@@ -133,6 +134,8 @@ The [Bromite main repository](https://github.com/bromite/bromite) contains tags
Please refer to [official Chromium build documentation](https://www.chromium.org/developers/how-tos/get-the-code) to get started on how to build Chromium; if you can build Chromium for Android, you can build Bromite.
The GN args used to build Bromite are available here: [GN_ARGS](./GN_ARGS).
# Credits
* [Chromium project](https://www.chromium.org/Home) and developers
+1436 -243
View File
File diff suppressed because one or more lines are too long
@@ -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(
@@ -1053,7 +1053,7 @@ void ChromeContentBrowserClient::RegisterLocalStatePrefs(
void ChromeContentBrowserClient::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) {
registry->RegisterBooleanPref(prefs::kDisable3DAPIs, false);
@@ -12,7 +12,7 @@ Added some Bromite-specific further improvements
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -1268,8 +1268,6 @@ jumbo_split_static_library("browser") {
@@ -1270,8 +1270,6 @@ jumbo_split_static_library("browser") {
"profiles/profile_attributes_entry.h",
"profiles/profile_attributes_storage.cc",
"profiles/profile_attributes_storage.h",
@@ -2,16 +2,16 @@ From: csagan5 <32685696+csagan5@users.noreply.github.com>
Date: Sat, 28 Oct 2017 10:09:41 +0200
Subject: Inject scripts for AMP, tracking, ads and video functionality
Remove AMP, tracking and ads from search results
Remove AMP, tracking and ads from search/news results
Break Page Visibility API and Fullscreen API for youtube.com and vimeo.com to
allow playing videos in background (original Javascript code by timdream)
Send a random key press to circumvent idle status detection
---
third_party/blink/renderer/core/dom/BUILD.gn | 2 ++
third_party/blink/renderer/core/dom/document.cc | 28 +++++++++++++++++++++-
.../renderer/core/dom/extensions/anti_amp_cure.h | 6 +++++
.../renderer/core/dom/extensions/video_bg_play.h | 6 +++++
4 files changed, 41 insertions(+), 1 deletion(-)
third_party/blink/renderer/core/dom/document.cc | 32 +++++++++++++++++++++-
.../renderer/core/dom/extensions/anti_amp_cure.h | 6 ++++
.../renderer/core/dom/extensions/video_bg_play.h | 6 ++++
4 files changed, 45 insertions(+), 1 deletion(-)
create mode 100644 third_party/blink/renderer/core/dom/extensions/anti_amp_cure.h
create mode 100644 third_party/blink/renderer/core/dom/extensions/video_bg_play.h
@@ -22,8 +22,8 @@ diff --git a/third_party/blink/renderer/core/dom/BUILD.gn b/third_party/blink/re
"global_event_handlers.h",
"icon_url.cc",
"icon_url.h",
+ "extensions/dont-track-me.h",
+ "extensions/video-bg-play.h",
+ "extensions/anti_amp_cure.h",
+ "extensions/video_bg_play.h",
"id_target_observer.cc",
"id_target_observer.h",
"id_target_observer_registry.cc",
@@ -47,7 +47,7 @@ diff --git a/third_party/blink/renderer/core/dom/document.cc b/third_party/blink
#ifndef NDEBUG
using WeakDocumentSet = blink::HeapHashSet<blink::WeakMember<blink::Document>>;
static WeakDocumentSet& liveDocumentSet();
@@ -6088,8 +6091,31 @@ void Document::FinishedParsing() {
@@ -6088,8 +6091,35 @@ void Document::FinishedParsing() {
fetcher_->ClearResourcesFromPreviousFetcher();
}
@@ -57,12 +57,16 @@ diff --git a/third_party/blink/renderer/core/dom/document.cc b/third_party/blink
+ return;
+ }
+
+ // determine whether this is a Google search results page
+ // determine whether this is a search results page
+ const WTF::String& host = url_.Host();
+ if ((host == nullptr) || host.IsEmpty())
+ return;
+
+ LOG(INFO) << "checking URL host for possible injections: " << host;
+ auto* bodyElement = body();
+ if (bodyElement) {
+ size_t pos = host.Find(".google.");
+ if ((pos != WTF::kNotFound) && (host.length() - pos - 8 < 4)) {
+ size_t pos1 = host.Find("www.google."), pos2 = host.Find("news.google.");
+ if ((pos1 == 0) || (pos2 == 0)) {
+ LOG(INFO) << "injecting anti-AMP-cure Javascript payload, URL: " << url_.GetString();
+ HTMLScriptElement* e = HTMLScriptElement::Create(*this, CreateElementFlags());
+ e->setText(ANTI_AMP_CURE_JS);
@@ -88,7 +92,7 @@ new file mode 100644
+#ifndef anti_amp_cure_h
+#define anti_amp_cure_h
+
+#define ANTI_AMP_CURE_JS "/* Bromite click-tracking and AMP removal v0.3.5 */\n\nfunction recreateHyperlink(a) {\n // skip already-sanitized hyperlinks\n if (a.sane) return false;\n\n // create new A element - old one has event listeners attached\n var newA = document.createElement('a');\n newA.referrerPolicy = 'origin';\n // property set when hyperlink has been created by this script\n newA.sane = 1;\n\n // remove AMP class, get actual page URL\n var ampCur = a.getAttribute('data-amp-cur');\n if (ampCur) {\n newA.href = ampCur;\n a.classList.remove('amp_r');\n } else {\n var realLink = getRealLinkFromGoogleUrl(a);\n if (realLink) {\n newA.href = realLink;\n } else {\n // might not be an actual hyperlink, ignore it\n if (!a.href) {\n return false;\n }\n // leave original href unchanged\n newA.href = a.href;\n }\n }\n // copy CSS classes\n newA.className = a.className;\n\n // copy nodes inside the hyperlink\n while (a.firstChild) {\n newA.appendChild(a.lastChild);\n }\n // replace hyperlink\n a.parentNode.replaceChild(newA, a);\n return true;\n}\n\nfunction isResult(a) {\n if (a.getAttribute('data-amp-cur'))\n return true;\n var inlineMousedown = a.getAttribute('onmousedown');\n if (!inlineMousedown)\n\treturn false;\n // return rwt(....); // E.g Google search results.\n // return google.rwt(...); // E.g. sponsored search results\n // return google.arwt(this); // E.g. sponsored search results (dec 2016).\n return /\\ba?rwt\\(/.test(inlineMousedown) || /\\bctpacw\\b/.test(inlineMousedown);\n}\n\n/**\n * @returns {String} the real URL if the given link is a Google redirect URL.\n */\nfunction getRealLinkFromGoogleUrl(a) {\n if ((a.hostname === location.hostname || a.hostname.indexOf('www.google.') == 0) &&\n /^\\/(local_)?url$/.test(a.pathname)) {\n // Google Maps / Dito (/local_url?q=<url>)\n // Mobile (/url?q=<url>)\n var url = /[?&](?:q|url)=((?:https?|ftp)[%:][^&]+)/.exec(a.search);\n if (url) {\n return decodeURIComponent(url[1]);\n }\n // Help pages, e.g. safe browsing (/url?...&q=%2Fsupport%2Fanswer...)\n url = /[?&](?:q|url)=((?:%2[Ff]|\\/)[^&]+)/.exec(a.search);\n if (url) {\n return a.origin + decodeURIComponent(url[1]);\n }\n }\n}\n\nfunction sanitizeAds() {\n // scan all divs\n var div = document.getElementById('tads');\n if (div) {\n div.style.display = 'none';\n\treturn true;\n }\n return false;\n}\n\nfunction sanitizeAll() {\n console.log(\"ads removed: \", sanitizeAds());\n console.log(\"hyperlinks sanitized: \", sanitizeAllHyperlinks(document));\n}\n\nfunction hookMoreResults() {\n var extrares = document.getElementById('extrares');\n if (!extrares) {\n console.log(\"could not hook more results\");\n return;\n }\n // mutation observers are great but they don't work\n extrares.addEventListener(\"DOMNodeInserted\", function(e) {\n var node = e.target;\n if (node.id && node.id.startsWith(\"arc-srp\"))\n console.log(\"hyperlinks sanitized on new result node: \", sanitizeAllHyperlinks(node));\n });\n}\n\nfunction setMlogoClick() {\n var mlogo = document.getElementById('qslc');\n if (mlogo && mlogo.children[0]) {\n mlogo = mlogo.children[0];\n mlogo.removeAttribute(\"href\");\n mlogo.setAttribute(\"onclick\", \"sanitizeAll()\");\n console.log(\"logo link replaced\");\n } else {\n console.log(\"could not replace logo link\");\n }\n}\n\nfunction sanitizeAllHyperlinks(rootNode) {\n var saned = 0, total = 0;\n rootNode.querySelectorAll('div[data-hveid]:not([data-hveid=\"\"]) a').forEach(function(a) {\n\ttotal++;\n\tvar res = recreateHyperlink(a);\n\tif (res) saned++;\n });\n console.log(\"sanitized \", saned, \"/\", total, \" hyperlinks\");\n\n return saned;\n}\n\n// avoid running cleanup on non-search pages\nif ((document.location.host.indexOf(\"images.google.\") == -1) && \n (document.location.host.indexOf(\"accounts.google.\") == -1) &&\n (document.location.host.indexOf(\"news.google.\") == -1)) {\n sanitizeAll();\n}\nsetMlogoClick();\n\nhookMoreResults();\n"
+#define ANTI_AMP_CURE_JS "/* Bromite click-tracking and AMP removal v0.3.6 */\n\nfunction recreateHyperlink(a) {\n // skip already-sanitized hyperlinks\n if (a.sane) return false;\n\n // create new A element - old one has event listeners attached\n var newA = document.createElement('a');\n newA.referrerPolicy = 'origin';\n // property set when hyperlink has been created by this script\n newA.sane = 1;\n\n // remove AMP class, get actual page URL\n var ampCur = a.getAttribute('data-amp-cur');\n if (ampCur) {\n newA.href = ampCur;\n a.classList.remove('amp_r');\n } else {\n var realLink = getRealLinkFromGoogleUrl(a);\n if (realLink) {\n newA.href = realLink;\n } else {\n // might not be an actual hyperlink, ignore it\n if (!a.href) {\n return false;\n }\n // leave original href unchanged\n newA.href = a.href;\n }\n }\n // copy CSS classes\n newA.className = a.className;\n\n // copy nodes inside the hyperlink\n while (a.firstChild) {\n newA.appendChild(a.lastChild);\n }\n // replace hyperlink\n a.parentNode.replaceChild(newA, a);\n return true;\n}\n\nfunction isResult(a) {\n if (a.getAttribute('data-amp-cur'))\n return true;\n var inlineMousedown = a.getAttribute('onmousedown');\n if (!inlineMousedown)\n\treturn false;\n // return rwt(....); // E.g Google search results.\n // return google.rwt(...); // E.g. sponsored search results\n // return google.arwt(this); // E.g. sponsored search results (dec 2016).\n return /\\ba?rwt\\(/.test(inlineMousedown) || /\\bctpacw\\b/.test(inlineMousedown);\n}\n\n/**\n * @returns {String} the real URL if the given link is a Google redirect URL.\n */\nfunction getRealLinkFromGoogleUrl(a) {\n if ((a.hostname === location.hostname || a.hostname.indexOf('www.google.') == 0) &&\n /^\\/(local_)?url$/.test(a.pathname)) {\n // Google Maps / Dito (/local_url?q=<url>)\n // Mobile (/url?q=<url>)\n var url = /[?&](?:q|url)=((?:https?|ftp)[%:][^&]+)/.exec(a.search);\n if (url) {\n return decodeURIComponent(url[1]);\n }\n // Help pages, e.g. safe browsing (/url?...&q=%2Fsupport%2Fanswer...)\n url = /[?&](?:q|url)=((?:%2[Ff]|\\/)[^&]+)/.exec(a.search);\n if (url) {\n return a.origin + decodeURIComponent(url[1]);\n }\n }\n}\n\nfunction sanitizeAds() {\n // scan all divs\n var div = document.getElementById('tads');\n if (div) {\n div.style.display = 'none';\n\treturn true;\n }\n return false;\n}\n\nfunction hookMoreResults() {\n var extrares = document.getElementById('extrares');\n if (!extrares) {\n console.log(\"could not hook more results\");\n return;\n }\n // mutation observers are great but they don't work\n extrares.addEventListener(\"DOMNodeInserted\", function(e) {\n var node = e.target;\n if (node.id && node.id.startsWith(\"arc-srp\"))\n console.log(\"hyperlinks sanitized on new result node: \", sanitizeAllHyperlinks(node));\n });\n}\n\nfunction setMlogoClick() {\n var mlogo = document.getElementById('qslc');\n if (mlogo && mlogo.children[0]) {\n mlogo = mlogo.children[0];\n } else {\n mlogo = document.getElementById('mlogo');\n }\n if (mlogo) {\n mlogo.removeAttribute(\"href\");\n mlogo.setAttribute(\"onclick\", \"sanitizeAll()\");\n console.log(\"logo link replaced\");\n } else {\n console.log(\"could not replace logo link\");\n }\n}\n\nfunction sanitizeAllHyperlinks(rootNode) {\n var saned = 0, total = 0;\n // selector for both results and news\n rootNode.querySelectorAll('div[data-hveid]:not([data-hveid=\"\"]) a, div[data-ved]:not([data-ved=\"\"]) a').forEach(function(a) {\n\ttotal++;\n\tvar res = recreateHyperlink(a);\n\tif (res) saned++;\n });\n console.log(\"sanitized \", saned, \"/\", total, \" hyperlinks\");\n\n return saned;\n}\n\nfunction sanitizeAll() {\n console.log(\"ads removed: \", sanitizeAds());\n console.log(\"hyperlinks sanitized: \", sanitizeAllHyperlinks(document));\n}\n\n// avoid running cleanup on non-search pages\nif ((document.location.host.indexOf(\"images.google.\") == -1) &&\n (document.location.host.indexOf(\"accounts.google.\") == -1)) {\n sanitizeAll();\n}\nsetMlogoClick();\n\nhookMoreResults();\n"
+
+#endif // anti_amp_cure_h
diff --git a/third_party/blink/renderer/core/dom/extensions/video_bg_play.h b/third_party/blink/renderer/core/dom/extensions/video_bg_play.h
+39 -6
View File
@@ -18,12 +18,12 @@ New mechanism for adblocking based on Brave's adblocking hook
.../browser/appmenu/AppMenuPropertiesDelegate.java | 38 +++
.../CustomTabAppMenuPropertiesDelegate.java | 2 +
.../java/strings/android_chrome_strings.grd | 11 +
chrome/browser/net/chrome_network_delegate.cc | 83 ++++--
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 | 325 +++++++++++++++++++++
net/url_request/adblock_intercept.h | 24 ++
12 files changed, 510 insertions(+), 20 deletions(-)
net/url_request/adblock_intercept.cc | 341 +++++++++++++++++++++
net/url_request/adblock_intercept.h | 41 +++
12 files changed, 543 insertions(+), 20 deletions(-)
create mode 100644 net/url_request/adblock_intercept.cc
create mode 100644 net/url_request/adblock_intercept.h
@@ -341,7 +341,23 @@ 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,325 @@
@@ -0,0 +1,341 @@
+/*
+ This file is part of Bromite.
+
+ Bromite is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Bromite is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ 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"
+
+#ifdef ADB_TESTER
@@ -671,7 +687,24 @@ 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,24 @@
@@ -0,0 +1,41 @@
+/*
+ This file is part of Bromite.
+
+ Bromite is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Bromite is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Bromite. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+#ifndef NET_URL_REQUEST_ADBLOCK_INTERCEPT_H_
+#define NET_URL_REQUEST_ADBLOCK_INTERCEPT_H_
+
+24 -28
View File
@@ -2,16 +2,17 @@ From: csagan5 <32685696+csagan5@users.noreply.github.com>
Date: Wed, 21 Mar 2018 14:15:28 +0100
Subject: User Agent: anonymize
Use a fixed device name and Chrome product version.
Use a fixed device name and Chrome product version with the goal of not
disclosing the specific build of Bromite.
---
components/version_info/version_info.cc | 17 +++++++-
content/common/user_agent.cc | 73 +++++++++++++++++++++------------
2 files changed, 62 insertions(+), 28 deletions(-)
components/version_info/version_info.cc | 13 +++++-
content/common/user_agent.cc | 72 ++++++++++++++++++++-------------
2 files changed, 57 insertions(+), 28 deletions(-)
diff --git a/components/version_info/version_info.cc b/components/version_info/version_info.cc
--- a/components/version_info/version_info.cc
+++ b/components/version_info/version_info.cc
@@ -7,13 +7,28 @@
@@ -7,13 +7,24 @@
#include "base/logging.h"
#include "base/no_destructor.h"
#include "base/version.h"
@@ -28,16 +29,12 @@ diff --git a/components/version_info/version_info.cc b/components/version_info/v
+ &minor,
+ &bugfix);
+ switch (major) {
+ case 7:
+ return "Chrome/63.0.3239.111";
+ case 6:
+ return "Chrome/63.0.3239.83";
+ case 5:
+ case 4:
+ return "Chrome/62.0.3202.84";
+ return "Chrome/69.0.3497.100";
+ }
+ // version 8 and above
+ return "Chrome/67.0.3396.87";
+
+ // version 5 and above
+ return "Chrome/70.0.3538.80";
}
std::string GetProductName() {
@@ -56,7 +53,7 @@ diff --git a/content/common/user_agent.cc b/content/common/user_agent.cc
std::string GetWebKitVersion() {
return base::StringPrintf("%d.%d (%s)",
WEBKIT_VERSION_MAJOR,
@@ -66,7 +61,33 @@ std::string BuildOSCpuInfo(bool include_android_build_number) {
@@ -66,7 +61,32 @@ std::string BuildOSCpuInfo(bool include_android_build_number) {
}
#elif defined(OS_ANDROID)
std::string android_version_str = base::SysInfo::OperatingSystemVersion();
@@ -66,24 +63,23 @@ diff --git a/content/common/user_agent.cc b/content/common/user_agent.cc
+ // Send information about the device and build ID.
+ // Use a common device/build ID based on Android major version.
+ switch (os_major_version) {
+ default: // version 9 and above
+ android_info_str = "ONEPLUS A6000";
+ break;
+ case 8:
+ android_info_str = "FIG-LX3";
+ break;
+ case 7:
+ // Chrome/63.0.3239.111
+ android_info_str = "SM-J730GM Build/NRD90M";
+ android_info_str = "SM-G610M";
+ break;
+ case 6:
+ // Chrome/63.0.3239.83
+ android_info_str = "SM-G532G Build/MMB29T";
+ android_info_str = "SM-J700M";
+ break;
+ case 5:
+ // Chrome/62.0.3202.84
+ android_info_str = "A37fw Build/LMY47V";
+ android_info_str = "XT1033";
+ break;
+ case 4:
+ // Chrome/62.0.3202.84
+ android_info_str = "SM-G7102 Build/KOT49H";
+ break;
+ default: // version 8 and above
+ android_info_str = "SM-G950U Build/R16NW";
+ android_info_str = "ZTE Blade C370 Build/KOT49H";
+ break;
+ }
+
@@ -91,7 +87,7 @@ diff --git a/content/common/user_agent.cc b/content/common/user_agent.cc
#elif (defined(OS_POSIX) && !defined(OS_MACOSX)) || defined(OS_FUCHSIA)
// Should work on any Posix system.
struct utsname unixinfo;
@@ -102,7 +123,7 @@ std::string BuildOSCpuInfo(bool include_android_build_number) {
@@ -102,7 +122,7 @@ std::string BuildOSCpuInfo(bool include_android_build_number) {
os_minor_version,
os_bugfix_version
#elif defined(OS_ANDROID)
@@ -100,7 +96,7 @@ diff --git a/content/common/user_agent.cc b/content/common/user_agent.cc
android_version_str.c_str(),
android_info_str.c_str()
#elif defined(OS_POSIX) || defined(OS_FUCHSIA)
@@ -137,18 +158,6 @@ std::string BuildUserAgentFromProduct(const std::string& product) {
@@ -137,18 +157,6 @@ std::string BuildUserAgentFromProduct(const std::string& product) {
return BuildUserAgentFromOSAndProduct(os_info, product);
}
@@ -119,7 +115,7 @@ diff --git a/content/common/user_agent.cc b/content/common/user_agent.cc
std::string GetAndroidOSInfo(bool include_android_build_number) {
std::string android_info_str;
@@ -162,18 +171,28 @@ std::string GetAndroidOSInfo(bool include_android_build_number) {
@@ -162,18 +170,28 @@ std::string GetAndroidOSInfo(bool include_android_build_number) {
}
// Append the build ID.
@@ -358,7 +358,7 @@ diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
"bookmarks/bookmark_model_factory.cc",
"bookmarks/bookmark_model_factory.h",
"bookmarks/bookmark_stats.cc",
@@ -2586,8 +2590,6 @@ jumbo_split_static_library("browser") {
@@ -2588,8 +2592,6 @@ jumbo_split_static_library("browser") {
"banners/app_banner_infobar_delegate_desktop.h",
"banners/app_banner_manager_desktop.cc",
"banners/app_banner_manager_desktop.h",
@@ -367,7 +367,7 @@ diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
"certificate_viewer.h",
"chrome_browser_field_trials_desktop.cc",
"chrome_browser_field_trials_desktop.h",
@@ -2678,8 +2680,6 @@ jumbo_split_static_library("browser") {
@@ -2680,8 +2682,6 @@ jumbo_split_static_library("browser") {
"importer/importer_uma.h",
"importer/in_process_importer_bridge.cc",
"importer/in_process_importer_bridge.h",
@@ -0,0 +1,118 @@
From: csagan5 <32685696+csagan5@users.noreply.github.com>
Date: Sat, 10 Nov 2018 16:09:26 +0100
Subject: Reduce permissions needed for bookmarks import/export
Completely remove contacts picker permission from the file dialog
---
chrome/android/java/AndroidManifest.xml | 1 -
chrome/browser/android/bookmarks/bookmark_bridge.cc | 20 +++++++++++++++++---
.../src/org/chromium/ui/base/SelectFileDialog.java | 12 ++++++++----
3 files changed, 25 insertions(+), 8 deletions(-)
diff --git a/chrome/android/java/AndroidManifest.xml b/chrome/android/java/AndroidManifest.xml
--- a/chrome/android/java/AndroidManifest.xml
+++ b/chrome/android/java/AndroidManifest.xml
@@ -35,7 +35,6 @@ by a child template that "extends" this file.
{% endif %}
<uses-permission-sdk-23 android:name="android.permission.BLUETOOTH"/>
<uses-permission-sdk-23 android:name="android.permission.BLUETOOTH_ADMIN"/>
- <uses-permission-sdk-23 android:name="android.permission.READ_CONTACTS"/>
<uses-permission-sdk-23 android:name="android.permission.REORDER_TASKS"/>
<uses-permission-sdk-23 android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
diff --git a/chrome/browser/android/bookmarks/bookmark_bridge.cc b/chrome/browser/android/bookmarks/bookmark_bridge.cc
--- a/chrome/browser/android/bookmarks/bookmark_bridge.cc
+++ b/chrome/browser/android/bookmarks/bookmark_bridge.cc
@@ -552,14 +552,23 @@ void BookmarkBridge::ImportBookmarks(JNIEnv* env,
select_file_dialog_ = ui::SelectFileDialog::Create(
this, std::make_unique<ChromeSelectFilePolicy>(nullptr));
- //NOTE: extension and description are not used on Android
+ //NOTE: extension and description are not used on Android, thus not set
ui::SelectFileDialog::FileTypeInfo file_type_info;
+
+#if defined(OS_ANDROID)
+ static const std::vector<base::string16> v_accept_types = { base::UTF8ToUTF16("text/html") };
+
+ // Android needs the original MIME types and an additional capture value.
+ std::pair<std::vector<base::string16>, bool> accept_types =
+ std::make_pair(v_accept_types, /* use_media_capture */ false);
+#else
file_type_info.extensions.resize(1);
file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("html"));
file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("htm"));
file_type_info.extension_description_overrides.push_back(base::ASCIIToUTF16("Netscape Bookmark"));
file_type_info.allowed_paths =
- ui::SelectFileDialog::FileTypeInfo::NATIVE_OR_DRIVE_PATH;
+ ui::SelectFileDialog::FileTypeInfo::ANY_PATH;
+#endif
select_file_dialog_->SelectFile(
ui::SelectFileDialog::SELECT_OPEN_FILE,
@@ -569,7 +578,12 @@ void BookmarkBridge::ImportBookmarks(JNIEnv* env,
0,
base::FilePath::StringType(),
window,
- NULL);
+#if defined(OS_ANDROID)
+ &accept_types
+#else
+ NULL
+#endif
+);
//NOTE: this should be called after the actual import
Java_BookmarkBridge_bookmarksImported(env, obj);
diff --git a/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java b/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java
--- a/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java
+++ b/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java
@@ -52,6 +52,7 @@ public class SelectFileDialog
private static final String IMAGE_TYPE = "image/";
private static final String VIDEO_TYPE = "video/";
private static final String AUDIO_TYPE = "audio/";
+ private static final String HTML_TYPE = "text/html";
private static final String ALL_IMAGE_TYPES = IMAGE_TYPE + "*";
private static final String ALL_VIDEO_TYPES = VIDEO_TYPE + "*";
private static final String ALL_AUDIO_TYPES = AUDIO_TYPE + "*";
@@ -159,7 +160,7 @@ public class SelectFileDialog
if (!window.hasPermission(Manifest.permission.READ_CONTACTS)) {
missingPermissions.add(Manifest.permission.READ_CONTACTS);
}
- } else if (shouldUsePhotoPicker()) {
+ } else if (shouldUsePhotoPicker() || shouldShowHtmlTypes()) {
if (!window.hasPermission(Manifest.permission.READ_EXTERNAL_STORAGE)) {
missingPermissions.add(Manifest.permission.READ_EXTERNAL_STORAGE);
}
@@ -324,9 +325,7 @@ public class SelectFileDialog
* 3.) There is a valid Android Activity associated with the file request.
*/
private boolean shouldUseContactsPicker() {
- if (mFileTypes.size() != 1) return false;
- if (!mFileTypes.get(0).equals("text/json+contacts")) return false;
- return UiUtils.shouldShowContactsPicker() && mWindowAndroid.getActivity().get() != null;
+ return false;
}
/**
@@ -347,6 +346,7 @@ public class SelectFileDialog
}
if (!mimeTypes.contains(mimeType)) mimeTypes.add(mimeType);
}
+ if (mimeTypes.size() == 0) return null;
return mimeTypes;
}
@@ -649,6 +649,10 @@ public class SelectFileDialog
return countAcceptTypesFor(specificType) > 0;
}
+ private boolean shouldShowHtmlTypes() {
+ return countAcceptTypesFor(HTML_TYPE) > 0;
+ }
+
private boolean shouldShowImageTypes() {
return shouldShowTypes(ALL_IMAGE_TYPES, IMAGE_TYPE);
}
--
2.11.0
@@ -31,7 +31,7 @@ diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn
diff --git a/chrome/android/java/AndroidManifest.xml b/chrome/android/java/AndroidManifest.xml
--- a/chrome/android/java/AndroidManifest.xml
+++ b/chrome/android/java/AndroidManifest.xml
@@ -830,14 +830,14 @@ by a child template that "extends" this file.
@@ -829,14 +829,14 @@ by a child template that "extends" this file.
</provider>
<!-- Sync adapter for browser invalidation. -->
@@ -41,7 +41,7 @@ Subject: ungoogled-chromium: disable safe browsing
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -2619,8 +2619,6 @@ jumbo_split_static_library("browser") {
@@ -2621,8 +2621,6 @@ jumbo_split_static_library("browser") {
"download/download_commands.h",
"download/download_crx_util.cc",
"download/download_crx_util.h",
@@ -75,7 +75,7 @@ diff --git a/chrome/browser/browser_process.h b/chrome/browser/browser_process.h
// NOT THREAD SAFE, call only from the main thread.
// These functions shouldn't return NULL unless otherwise noted.
class BrowserProcess {
@@ -237,14 +229,6 @@ class BrowserProcess {
@@ -234,14 +226,6 @@ class BrowserProcess {
// on this platform (or this is a unit test).
virtual StatusTray* status_tray() = 0;
@@ -110,7 +110,7 @@ diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_pro
network_time_tracker_.reset();
#if BUILDFLAG(ENABLE_PLUGINS)
plugins_resource_service_.reset();
@@ -999,22 +996,6 @@ StatusTray* BrowserProcessImpl::status_tray() {
@@ -994,22 +991,6 @@ StatusTray* BrowserProcessImpl::status_tray() {
return status_tray_.get();
}
@@ -133,7 +133,7 @@ diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_pro
subresource_filter::ContentRulesetService*
BrowserProcessImpl::subresource_filter_ruleset_service() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
@@ -1299,16 +1280,6 @@ void BrowserProcessImpl::CreateBackgroundPrintingManager() {
@@ -1300,16 +1281,6 @@ void BrowserProcessImpl::CreateBackgroundPrintingManager() {
#endif
}
@@ -153,7 +153,7 @@ diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_pro
diff --git a/chrome/browser/browser_process_impl.h b/chrome/browser/browser_process_impl.h
--- a/chrome/browser/browser_process_impl.h
+++ b/chrome/browser/browser_process_impl.h
@@ -176,9 +176,6 @@ class BrowserProcessImpl : public BrowserProcess,
@@ -175,9 +175,6 @@ class BrowserProcessImpl : public BrowserProcess,
void set_background_mode_manager_for_test(
std::unique_ptr<BackgroundModeManager> manager) override;
StatusTray* status_tray() override;
@@ -163,7 +163,7 @@ diff --git a/chrome/browser/browser_process_impl.h b/chrome/browser/browser_proc
subresource_filter::ContentRulesetService*
subresource_filter_ruleset_service() override;
optimization_guide::OptimizationGuideService* optimization_guide_service()
@@ -322,9 +319,6 @@ class BrowserProcessImpl : public BrowserProcess,
@@ -324,9 +321,6 @@ class BrowserProcessImpl : public BrowserProcess,
std::unique_ptr<BackgroundModeManager> background_mode_manager_;
#endif
@@ -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;
@@ -1997,7 +1973,7 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
@@ -1988,7 +1964,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);
}
@@ -2675,7 +2651,7 @@ void ChromeContentBrowserClient::AllowCertificateError(
@@ -2666,7 +2642,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());
}
@@ -2945,8 +2921,6 @@ bool ChromeContentBrowserClient::CanCreateWindow(
@@ -2936,8 +2912,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();
@@ -4112,7 +4086,7 @@ ChromeContentBrowserClient::CreateThrottlesForNavigation(
@@ -4103,7 +4077,7 @@ ChromeContentBrowserClient::CreateThrottlesForNavigation(
if (base::FeatureList::IsEnabled(features::kSSLCommittedInterstitials)) {
throttles.push_back(std::make_unique<SSLErrorNavigationThrottle>(
handle,
@@ -165,7 +165,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
@@ -4862,19 +4862,7 @@ ChromeContentBrowserClient::GetSafeBrowsingUrlCheckerDelegate(
@@ -4853,19 +4853,7 @@ ChromeContentBrowserClient::GetSafeBrowsingUrlCheckerDelegate(
content::ResourceContext* resource_context) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
@@ -51,7 +51,7 @@ diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn
diff --git a/chrome/android/java/AndroidManifest.xml b/chrome/android/java/AndroidManifest.xml
--- a/chrome/android/java/AndroidManifest.xml
+++ b/chrome/android/java/AndroidManifest.xml
@@ -78,22 +78,17 @@ by a child template that "extends" this file.
@@ -77,22 +77,17 @@ by a child template that "extends" this file.
<permission android:name="{{ manifest_package }}.permission.CHILD_SERVICE" android:protectionLevel="signature" />
<permission android:name="{{ manifest_package }}.permission.READ_WRITE_BOOKMARK_FOLDERS" android:protectionLevel="signatureOrSystem" />
<permission android:name="{{ manifest_package }}.TOS_ACKED" android:protectionLevel="signatureOrSystem" />
@@ -74,7 +74,7 @@ diff --git a/chrome/android/java/AndroidManifest.xml b/chrome/android/java/Andro
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
<uses-permission android:name="com.google.android.apps.now.CURRENT_ACCOUNT_ACCESS" />
@@ -912,43 +907,6 @@ by a child template that "extends" this file.
@@ -911,43 +906,6 @@ by a child template that "extends" this file.
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|mcc|mnc|screenLayout|smallestScreenSize"
android:hardwareAccelerated="false" />
@@ -118,7 +118,7 @@ diff --git a/chrome/android/java/AndroidManifest.xml b/chrome/android/java/Andro
<!-- Notification service for sync. -->
<meta-data android:name="ipc.invalidation.ticl.listener_service_class"
android:value="org.chromium.chrome.browser.invalidation.ChromeInvalidationClientService"/>
@@ -960,8 +918,6 @@ by a child template that "extends" this file.
@@ -959,8 +917,6 @@ by a child template that "extends" this file.
</service>
<service android:name="com.google.ipc.invalidation.ticl.android2.TiclService"
android:exported="false"/>
@@ -127,7 +127,7 @@ diff --git a/chrome/android/java/AndroidManifest.xml b/chrome/android/java/Andro
<receiver android:name="com.google.ipc.invalidation.ticl.android2.AndroidInternalScheduler$AlarmReceiver"
android:exported="false"/>
<receiver android:name="com.google.ipc.invalidation.external.client.contrib.AndroidListener$AlarmReceiver"
@@ -988,24 +944,6 @@ by a child template that "extends" this file.
@@ -987,24 +943,6 @@ by a child template that "extends" this file.
android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE"/>
@@ -477,7 +477,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",
@@ -1345,7 +1344,6 @@ chrome_java_sources = [
@@ -1344,7 +1343,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",
@@ -1,37 +0,0 @@
From: csagan5 <32685696+csagan5@users.noreply.github.com>
Date: Sat, 10 Nov 2018 16:09:26 +0100
Subject: Remove contacts picker permission
---
chrome/android/java/AndroidManifest.xml | 1 -
ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java | 4 +---
2 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/chrome/android/java/AndroidManifest.xml b/chrome/android/java/AndroidManifest.xml
--- a/chrome/android/java/AndroidManifest.xml
+++ b/chrome/android/java/AndroidManifest.xml
@@ -35,7 +35,6 @@ by a child template that "extends" this file.
{% endif %}
<uses-permission-sdk-23 android:name="android.permission.BLUETOOTH"/>
<uses-permission-sdk-23 android:name="android.permission.BLUETOOTH_ADMIN"/>
- <uses-permission-sdk-23 android:name="android.permission.READ_CONTACTS"/>
<uses-permission-sdk-23 android:name="android.permission.REORDER_TASKS"/>
<uses-permission-sdk-23 android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
diff --git a/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java b/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java
--- a/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java
+++ b/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java
@@ -324,9 +324,7 @@ public class SelectFileDialog
* 3.) There is a valid Android Activity associated with the file request.
*/
private boolean shouldUseContactsPicker() {
- if (mFileTypes.size() != 1) return false;
- if (!mFileTypes.get(0).equals("text/json+contacts")) return false;
- return UiUtils.shouldShowContactsPicker() && mWindowAndroid.getActivity().get() != null;
+ return false;
}
/**
--
2.11.0
File diff suppressed because it is too large Load Diff