Add NetworkTrafficAnnotationTag
This commit is contained in:
@@ -35,7 +35,7 @@ Subject: Eyeo Adblock Remove
|
||||
.../adblock/core/sitekey_storage_impl.cc | 6 +
|
||||
...filtering_configuration_maintainer_impl.cc | 10 -
|
||||
.../filtering_configuration_maintainer_impl.h | 1 -
|
||||
.../ongoing_subscription_request_impl.cc | 15 +-
|
||||
.../ongoing_subscription_request_impl.cc | 27 +-
|
||||
.../preloaded_subscription_provider_impl.cc | 4 +-
|
||||
.../core/subscription/subscription_config.cc | 8 +-
|
||||
.../subscription_downloader_impl.cc | 15 +-
|
||||
@@ -53,7 +53,7 @@ Subject: Eyeo Adblock Remove
|
||||
.../blink/renderer/core/css/style_engine.cc | 8 +
|
||||
.../blink/renderer/core/css/style_engine.h | 1 +
|
||||
.../renderer/core/exported/web_document.cc | 13 +-
|
||||
50 files changed, 3278 insertions(+), 1158 deletions(-)
|
||||
50 files changed, 3290 insertions(+), 1158 deletions(-)
|
||||
delete mode 100644 chrome/browser/adblock/adblock_telemetry_service_factory.cc
|
||||
delete mode 100644 chrome/browser/adblock/adblock_telemetry_service_factory.h
|
||||
rename components/adblock/android/java/res/xml/{adblock_preferences.xml => eyeo_adblock_preferences.xml} (100%)
|
||||
@@ -1564,7 +1564,23 @@ diff --git a/components/adblock/core/subscription/ongoing_subscription_request_i
|
||||
#include "net/http/http_request_headers.h"
|
||||
#include "services/network/public/cpp/resource_request.h"
|
||||
#include "services/network/public/mojom/url_response_head.mojom.h"
|
||||
@@ -48,7 +49,7 @@ const net::NetworkTrafficAnnotationTag kTrafficAnnotation =
|
||||
@@ -44,11 +45,23 @@ const net::NetworkTrafficAnnotationTag kTrafficAnnotation =
|
||||
"Application name (ex. Chromium) "
|
||||
"Application version (93.0.4572.0) "
|
||||
destination: WEBSITE
|
||||
+ internal {
|
||||
+ contacts {
|
||||
+ email: "uazo@users.noreply.github.com"
|
||||
+ }
|
||||
+ contacts {
|
||||
+ email: "uazo@users.noreply.github.com"
|
||||
+ }
|
||||
+ }
|
||||
+ user_data {
|
||||
+ type: NONE
|
||||
+ }
|
||||
+ last_reviewed: "2023-01-01"
|
||||
}
|
||||
policy {
|
||||
cookies_allowed: NO
|
||||
setting:
|
||||
@@ -1573,7 +1589,7 @@ diff --git a/components/adblock/core/subscription/ongoing_subscription_request_i
|
||||
policy_exception_justification: "Not implemented."
|
||||
})");
|
||||
|
||||
@@ -64,7 +65,7 @@ OngoingSubscriptionRequestImpl::OngoingSubscriptionRequestImpl(
|
||||
@@ -64,7 +77,7 @@ OngoingSubscriptionRequestImpl::OngoingSubscriptionRequestImpl(
|
||||
|
||||
OngoingSubscriptionRequestImpl::~OngoingSubscriptionRequestImpl() {
|
||||
if (!url_.is_empty())
|
||||
@@ -1582,7 +1598,7 @@ diff --git a/components/adblock/core/subscription/ongoing_subscription_request_i
|
||||
}
|
||||
|
||||
void OngoingSubscriptionRequestImpl::Start(GURL url,
|
||||
@@ -86,7 +87,7 @@ void OngoingSubscriptionRequestImpl::Retry() {
|
||||
@@ -86,7 +99,7 @@ void OngoingSubscriptionRequestImpl::Retry() {
|
||||
return;
|
||||
}
|
||||
backoff_entry_->InformOfRequest(false);
|
||||
@@ -1591,7 +1607,7 @@ diff --git a/components/adblock/core/subscription/ongoing_subscription_request_i
|
||||
<< backoff_entry_->GetTimeUntilRelease();
|
||||
retry_timer_->Start(
|
||||
FROM_HERE, backoff_entry_->GetTimeUntilRelease(),
|
||||
@@ -100,7 +101,7 @@ void OngoingSubscriptionRequestImpl::Redirect(GURL redirect_url) {
|
||||
@@ -100,7 +113,7 @@ void OngoingSubscriptionRequestImpl::Redirect(GURL redirect_url) {
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
DCHECK(!url_.is_empty()) << "Redirect() called before Start()";
|
||||
DCHECK(url_ != redirect_url) << "Invalid redirect. Same URL";
|
||||
@@ -1600,7 +1616,7 @@ diff --git a/components/adblock/core/subscription/ongoing_subscription_request_i
|
||||
++number_of_redirects_;
|
||||
url_ = std::move(redirect_url);
|
||||
StartInternal();
|
||||
@@ -120,10 +121,14 @@ void OngoingSubscriptionRequestImpl::StartInternal() {
|
||||
@@ -120,10 +133,14 @@ void OngoingSubscriptionRequestImpl::StartInternal() {
|
||||
// indefinitely.
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -14,24 +14,24 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
|
||||
.../java/res/xml/about_chrome_preferences.xml | 5 +
|
||||
.../about_settings/AboutChromeSettings.java | 28 +-
|
||||
.../chrome/browser/omaha/OmahaBase.java | 57 +++-
|
||||
.../chrome/browser/omaha/UpdateConfigs.java | 30 ++-
|
||||
.../chrome/browser/omaha/UpdateConfigs.java | 30 +-
|
||||
.../browser/omaha/UpdateMenuItemHelper.java | 82 +++++-
|
||||
.../browser/omaha/UpdateStatusProvider.java | 161 +++++++++---
|
||||
.../browser/omaha/UpdateStatusProvider.java | 161 ++++++++---
|
||||
.../browser/omaha/VersionNumberGetter.java | 3 +-
|
||||
.../inline/BromiteInlineUpdateController.java | 243 ++++++++++++++++++
|
||||
.../inline/BromiteInlineUpdateController.java | 272 ++++++++++++++++++
|
||||
.../omaha/inline/InlineUpdateController.java | 51 ++++
|
||||
.../inline/InlineUpdateControllerFactory.java | 21 ++
|
||||
chrome/browser/endpoint_fetcher/BUILD.gn | 2 +
|
||||
.../endpoint_fetcher_android.cc | 52 +++-
|
||||
.../endpoint_fetcher/EndpointFetcher.java | 22 +-
|
||||
.../EndpointHeaderResponse.java | 31 +++
|
||||
.../endpoint_fetcher_android.cc | 50 ++++
|
||||
.../endpoint_fetcher/EndpointFetcher.java | 26 +-
|
||||
.../EndpointHeaderResponse.java | 31 ++
|
||||
.../flags/android/chrome_feature_list.cc | 5 +
|
||||
.../flags/android/chrome_feature_list.h | 1 +
|
||||
.../browser/flags/ChromeFeatureList.java | 1 +
|
||||
.../strings/android_chrome_strings.grd | 23 +-
|
||||
.../endpoint_fetcher/endpoint_fetcher.cc | 103 +++++++-
|
||||
.../endpoint_fetcher/endpoint_fetcher.cc | 103 ++++++-
|
||||
.../endpoint_fetcher/endpoint_fetcher.h | 23 +-
|
||||
23 files changed, 899 insertions(+), 53 deletions(-)
|
||||
23 files changed, 933 insertions(+), 50 deletions(-)
|
||||
create mode 100644 chrome/android/java/src/org/chromium/chrome/browser/omaha/inline/BromiteInlineUpdateController.java
|
||||
create mode 100644 chrome/android/java/src/org/chromium/chrome/browser/omaha/inline/InlineUpdateController.java
|
||||
create mode 100644 chrome/android/java/src/org/chromium/chrome/browser/omaha/inline/InlineUpdateControllerFactory.java
|
||||
@@ -741,7 +741,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omaha/inline/Br
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/omaha/inline/BromiteInlineUpdateController.java
|
||||
@@ -0,0 +1,243 @@
|
||||
@@ -0,0 +1,272 @@
|
||||
+// Copyright 2021 The Ungoogled Chromium Authors. All rights reserved.
|
||||
+//
|
||||
+// This file is part of Ungoogled Chromium Android.
|
||||
@@ -786,6 +786,7 @@ new file mode 100644
|
||||
+import org.chromium.content_public.browser.LoadUrlParams;
|
||||
+import org.chromium.content_public.browser.UiThreadTaskTraits;
|
||||
+import org.chromium.ui.base.PageTransition;
|
||||
+import org.chromium.net.NetworkTrafficAnnotationTag;
|
||||
+
|
||||
+import java.io.BufferedReader;
|
||||
+import java.io.IOException;
|
||||
@@ -812,6 +813,34 @@ new file mode 100644
|
||||
+ return UPDATE_VERSION_URL + BuildConfig.BUILD_TARGET_CPU + "_ChromePublic.apk";
|
||||
+ }
|
||||
+
|
||||
+ private static final NetworkTrafficAnnotationTag TRAFFIC_ANNOTATION =
|
||||
+ NetworkTrafficAnnotationTag.createComplete("bromite_inline_update_controller",
|
||||
+ "semantics {"
|
||||
+ + " sender: 'Bromite Inline Update (Android)'"
|
||||
+ + " description:"
|
||||
+ + " 'Check for update'"
|
||||
+ + " trigger: 'This request is made once, on first run'"
|
||||
+ + " data: 'None.'"
|
||||
+ + " destination: OTHER"
|
||||
+ + " internal {"
|
||||
+ + " contacts {"
|
||||
+ + " email: 'uazo@users.noreply.github.com'"
|
||||
+ + " }"
|
||||
+ + " contacts {"
|
||||
+ + " email: 'uazo@users.noreply.github.com'"
|
||||
+ + " }"
|
||||
+ + " }"
|
||||
+ + " user_data {"
|
||||
+ + " type: NONE"
|
||||
+ + " }"
|
||||
+ + " last_reviewed: '2023-01-01'"
|
||||
+ + "}"
|
||||
+ + "policy {"
|
||||
+ + " cookies_allowed: NO"
|
||||
+ + " setting: 'Can be disabled in Settings.'"
|
||||
+ + " policy_exception_justification: 'Not implemented.'"
|
||||
+ + "}");
|
||||
+
|
||||
+ private boolean mEnabled = true;
|
||||
+ private Runnable mCallback;
|
||||
+ private @Nullable @UpdateStatusProvider.UpdateState Integer mUpdateState =
|
||||
@@ -950,7 +979,7 @@ new file mode 100644
|
||||
+ callback.onResult(null);
|
||||
+ },
|
||||
+ Profile.getLastUsedRegularProfile(),
|
||||
+ urlToCheck, /*timeout*/5000, /*follow_redirect*/true);
|
||||
+ urlToCheck, /*timeout*/5000, /*follow_redirect*/true, TRAFFIC_ANNOTATION);
|
||||
+ }
|
||||
+
|
||||
+ private void checkLatestUpstreamVersion(final Callback<VersionNumber> callback) {
|
||||
@@ -976,7 +1005,7 @@ new file mode 100644
|
||||
+ callback.onResult(null);
|
||||
+ },
|
||||
+ Profile.getLastUsedRegularProfile(),
|
||||
+ UPSTREAM_VERSION_URL, /*timeout*/5000, /*follow_redirect*/false);
|
||||
+ UPSTREAM_VERSION_URL, /*timeout*/5000, /*follow_redirect*/false, TRAFFIC_ANNOTATION);
|
||||
+ }
|
||||
+
|
||||
+ private void postStatus(@UpdateStatusProvider.UpdateState int status, String updateUrl) {
|
||||
@@ -1121,28 +1150,25 @@ diff --git a/chrome/browser/endpoint_fetcher/endpoint_fetcher_android.cc b/chrom
|
||||
} // namespace
|
||||
|
||||
// TODO(crbug.com/1077537) Create a KeyProvider so
|
||||
@@ -109,15 +128,17 @@ static void JNI_EndpointFetcher_NativeFetchWithNoAuth(
|
||||
@@ -109,6 +128,7 @@ static void JNI_EndpointFetcher_NativeFetchWithNoAuth(
|
||||
JNIEnv* env,
|
||||
const base::android::JavaParamRef<jobject>& jprofile,
|
||||
const base::android::JavaParamRef<jstring>& jurl,
|
||||
- jint jannotation_hash_code,
|
||||
+ jlong jtimeout, jboolean intercept_redirect,
|
||||
jint jannotation_hash_code,
|
||||
const base::android::JavaParamRef<jobject>& jcallback) {
|
||||
auto endpoint_fetcher = std::make_unique<EndpointFetcher>(
|
||||
ProfileAndroid::FromProfileAndroid(jprofile)
|
||||
@@ -116,6 +136,9 @@ static void JNI_EndpointFetcher_NativeFetchWithNoAuth(
|
||||
->GetDefaultStoragePartition()
|
||||
->GetURLLoaderFactoryForBrowserProcess(),
|
||||
GURL(base::android::ConvertJavaStringToUTF8(env, jurl)),
|
||||
- net::NetworkTrafficAnnotationTag::FromJavaAnnotation(
|
||||
- jannotation_hash_code));
|
||||
+ "GET",
|
||||
+ jtimeout,
|
||||
+ intercept_redirect,
|
||||
+ NO_TRAFFIC_ANNOTATION_YET);
|
||||
net::NetworkTrafficAnnotationTag::FromJavaAnnotation(
|
||||
jannotation_hash_code));
|
||||
auto* const endpoint_fetcher_ptr = endpoint_fetcher.get();
|
||||
endpoint_fetcher_ptr->PerformRequest(
|
||||
base::BindOnce(&OnEndpointFetcherComplete,
|
||||
@@ -127,3 +148,28 @@ static void JNI_EndpointFetcher_NativeFetchWithNoAuth(
|
||||
@@ -127,3 +150,30 @@ static void JNI_EndpointFetcher_NativeFetchWithNoAuth(
|
||||
std::move(endpoint_fetcher)),
|
||||
nullptr);
|
||||
}
|
||||
@@ -1152,6 +1178,7 @@ diff --git a/chrome/browser/endpoint_fetcher/endpoint_fetcher_android.cc b/chrom
|
||||
+ const base::android::JavaParamRef<jobject>& jprofile,
|
||||
+ const base::android::JavaParamRef<jstring>& jurl,
|
||||
+ jlong jtimeout, jboolean intercept_redirect,
|
||||
+ jint jannotation_hash_code,
|
||||
+ const base::android::JavaParamRef<jobject>& jcallback) {
|
||||
+ auto endpoint_fetcher = std::make_unique<EndpointFetcher>(
|
||||
+ ProfileAndroid::FromProfileAndroid(jprofile)
|
||||
@@ -1161,7 +1188,8 @@ diff --git a/chrome/browser/endpoint_fetcher/endpoint_fetcher_android.cc b/chrom
|
||||
+ "HEAD",
|
||||
+ jtimeout,
|
||||
+ intercept_redirect,
|
||||
+ NO_TRAFFIC_ANNOTATION_YET);
|
||||
+ net::NetworkTrafficAnnotationTag::FromJavaAnnotation(
|
||||
+ jannotation_hash_code));
|
||||
+ auto* const endpoint_fetcher_ptr = endpoint_fetcher.get();
|
||||
+ endpoint_fetcher_ptr->PerformRequest(
|
||||
+ base::BindOnce(&OnEndpointFetcherHeadComplete,
|
||||
@@ -1174,39 +1202,43 @@ diff --git a/chrome/browser/endpoint_fetcher/endpoint_fetcher_android.cc b/chrom
|
||||
diff --git a/chrome/browser/endpoint_fetcher/java/src/org/chromium/chrome/browser/endpoint_fetcher/EndpointFetcher.java b/chrome/browser/endpoint_fetcher/java/src/org/chromium/chrome/browser/endpoint_fetcher/EndpointFetcher.java
|
||||
--- a/chrome/browser/endpoint_fetcher/java/src/org/chromium/chrome/browser/endpoint_fetcher/EndpointFetcher.java
|
||||
+++ b/chrome/browser/endpoint_fetcher/java/src/org/chromium/chrome/browser/endpoint_fetcher/EndpointFetcher.java
|
||||
@@ -70,6 +70,22 @@ public final class EndpointFetcher {
|
||||
@@ -70,6 +70,24 @@ public final class EndpointFetcher {
|
||||
postData, timeout, headers, annotation.getHashCode(), callback);
|
||||
}
|
||||
|
||||
+ @MainThread
|
||||
+ public static void nativeHeadWithNoAuth(
|
||||
+ Callback<EndpointHeaderResponse> callback, Profile profile,
|
||||
+ String url, long timeout, boolean allow_redirect) {
|
||||
+ String url, long timeout, boolean allow_redirect,
|
||||
+ NetworkTrafficAnnotationTag annotation) {
|
||||
+ EndpointFetcherJni.get().nativeHeadWithNoAuth(
|
||||
+ profile, url, timeout, allow_redirect, callback);
|
||||
+ profile, url, timeout, allow_redirect, annotation.getHashCode(), callback);
|
||||
+ }
|
||||
+
|
||||
+ @MainThread
|
||||
+ public static void nativeFetchWithNoAuth(
|
||||
+ Callback<EndpointResponse> callback, Profile profile,
|
||||
+ String url, long timeout, boolean allow_redirect) {
|
||||
+ String url, long timeout, boolean allow_redirect,
|
||||
+ NetworkTrafficAnnotationTag annotation) {
|
||||
+ EndpointFetcherJni.get().nativeFetchWithNoAuth(
|
||||
+ profile, url, timeout, allow_redirect, callback);
|
||||
+ profile, url, timeout, allow_redirect, annotation.getHashCode(), callback);
|
||||
+ }
|
||||
+
|
||||
@NativeMethods
|
||||
public interface Natives {
|
||||
void nativeFetchOAuth(Profile profile, String oathConsumerName, String url,
|
||||
@@ -78,7 +94,11 @@ public final class EndpointFetcher {
|
||||
@@ -78,7 +96,13 @@ public final class EndpointFetcher {
|
||||
void nativeFetchChromeAPIKey(Profile profile, String url, String httpsMethod,
|
||||
String contentType, String postData, long timeout, String[] headers,
|
||||
int annotationHashCode, Callback<EndpointResponse> callback);
|
||||
- void nativeFetchWithNoAuth(Profile profile, String url, int annotationHashCode,
|
||||
+ void nativeFetchWithNoAuth(
|
||||
+ Profile profile, String url, long timeout, boolean allow_redirect,
|
||||
+ int annotationHashCode,
|
||||
Callback<EndpointResponse> callback);
|
||||
+ void nativeHeadWithNoAuth(
|
||||
+ Profile profile, String url, long timeout, boolean allow_redirect,
|
||||
+ int annotationHashCode,
|
||||
+ Callback<EndpointHeaderResponse> callback);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
|
||||
components/component_updater/BUILD.gn | 7 +
|
||||
.../adblock_updater_service.cc | 268 ++++++++++++++++++
|
||||
.../adblock_updater_service.h | 98 +++++++
|
||||
.../download_filters_task.cc | 222 +++++++++++++++
|
||||
.../download_filters_task.cc | 239 ++++++++++++++++
|
||||
.../component_updater/download_filters_task.h | 129 +++++++++
|
||||
...ent_subresource_filter_throttle_manager.cc | 11 +
|
||||
.../content/browser/ruleset_service.cc | 33 ++-
|
||||
@@ -50,7 +50,7 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
|
||||
.../browser/subresource_filter_features.cc | 116 +-------
|
||||
.../core/common/indexed_ruleset.cc | 5 +-
|
||||
third_party/blink/common/features.cc | 12 +-
|
||||
38 files changed, 1158 insertions(+), 130 deletions(-)
|
||||
38 files changed, 1175 insertions(+), 130 deletions(-)
|
||||
create mode 100644 chrome/android/java/res/layout/adblock_editor.xml
|
||||
create mode 100644 chrome/android/java/res/xml/adblock_preferences.xml
|
||||
create mode 100644 chrome/android/java/src/org/chromium/chrome/browser/settings/AdBlockEditor.java
|
||||
@@ -1118,7 +1118,7 @@ diff --git a/components/component_updater/download_filters_task.cc b/components/
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/components/component_updater/download_filters_task.cc
|
||||
@@ -0,0 +1,222 @@
|
||||
@@ -0,0 +1,239 @@
|
||||
+/*
|
||||
+ This file is part of Bromite.
|
||||
+
|
||||
@@ -1155,7 +1155,7 @@ new file mode 100644
|
||||
+const int kMaxRetriesOnNetworkChange = 3;
|
||||
+
|
||||
+const net::NetworkTrafficAnnotationTag traffic_annotation =
|
||||
+ net::DefineNetworkTrafficAnnotation("update_client", R"(
|
||||
+ net::DefineNetworkTrafficAnnotation("filters_update", R"(
|
||||
+ semantics {
|
||||
+ sender: "Bromite AdBlock filters updater"
|
||||
+ description:
|
||||
@@ -1164,8 +1164,25 @@ new file mode 100644
|
||||
+ data:
|
||||
+ "Subresource filters rulesets, binary format"
|
||||
+ destination: WEBSITE
|
||||
+ internal {
|
||||
+ contacts {
|
||||
+ email: "uazo@users.noreply.github.com"
|
||||
+ }
|
||||
+ contacts {
|
||||
+ email: "uazo@users.noreply.github.com"
|
||||
+ }
|
||||
+ }
|
||||
+ user_data {
|
||||
+ type: NONE
|
||||
+ }
|
||||
+ last_reviewed: "2023-01-01"
|
||||
+ }
|
||||
+ )");
|
||||
+ policy {
|
||||
+ cookies_allowed: NO
|
||||
+ setting:
|
||||
+ "You enable or disable this feature via 'Adblock Enable' pref."
|
||||
+ policy_exception_justification: "Not implemented."
|
||||
+ })");
|
||||
+
|
||||
+DownloadFiltersTask::DownloadFiltersTask(scoped_refptr<network::SharedURLLoaderFactory> shared_url_network_factory,
|
||||
+ bool is_foreground, const std::string& filters_url, base::Time min_last_modified,
|
||||
|
||||
Reference in New Issue
Block a user