Experimental user scripts support, Internal firewall: allow building with is_desktop_android = true (#256)
This commit is contained in:
@@ -93,8 +93,8 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
|
||||
components/user_scripts/common/host_id.cc | 31 +
|
||||
components/user_scripts/common/host_id.h | 35 +
|
||||
.../user_scripts/common/script_constants.h | 33 +
|
||||
components/user_scripts/common/url_pattern.cc | 809 ++++++++++++++++++
|
||||
components/user_scripts/common/url_pattern.h | 302 +++++++
|
||||
components/user_scripts/common/url_pattern.cc | 813 ++++++++++++++++++
|
||||
components/user_scripts/common/url_pattern.h | 306 +++++++
|
||||
.../user_scripts/common/url_pattern_set.cc | 335 ++++++++
|
||||
.../user_scripts/common/url_pattern_set.h | 160 ++++
|
||||
components/user_scripts/common/user_script.cc | 329 +++++++
|
||||
@@ -106,17 +106,17 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
|
||||
components/user_scripts/renderer/BUILD.gn | 65 ++
|
||||
.../renderer/extension_frame_helper.cc | 95 ++
|
||||
.../renderer/extension_frame_helper.h | 90 ++
|
||||
.../user_scripts/renderer/injection_host.cc | 12 +
|
||||
.../user_scripts/renderer/injection_host.cc | 16 +
|
||||
.../user_scripts/renderer/injection_host.h | 41 +
|
||||
.../renderer/resources/greasemonkey_api.js | 82 ++
|
||||
.../user_scripts_renderer_resources.grd | 14 +
|
||||
.../user_scripts/renderer/script_context.cc | 191 +++++
|
||||
.../user_scripts/renderer/script_context.cc | 191 ++++
|
||||
.../user_scripts/renderer/script_context.h | 67 ++
|
||||
.../user_scripts/renderer/script_injection.cc | 295 +++++++
|
||||
.../user_scripts/renderer/script_injection.h | 155 ++++
|
||||
.../renderer/script_injection_manager.cc | 414 +++++++++
|
||||
.../renderer/script_injection_manager.h | 100 +++
|
||||
.../user_scripts/renderer/script_injector.h | 96 +++
|
||||
.../user_scripts/renderer/script_injector.h | 100 +++
|
||||
.../user_scripts/renderer/scripts_run_info.cc | 31 +
|
||||
.../user_scripts/renderer/scripts_run_info.h | 69 ++
|
||||
.../renderer/user_script_injector.cc | 227 +++++
|
||||
@@ -130,12 +130,12 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
|
||||
.../renderer/user_scripts_renderer_client.cc | 108 +++
|
||||
.../renderer/user_scripts_renderer_client.h | 38 +
|
||||
.../renderer/web_ui_injection_host.cc | 40 +
|
||||
.../renderer/web_ui_injection_host.h | 27 +
|
||||
.../renderer/web_ui_injection_host.h | 31 +
|
||||
.../strings/userscripts_strings.grdp | 54 ++
|
||||
.../Experimental-user-scripts-support.inc | 13 +
|
||||
ipc/ipc_message_start.h | 1 +
|
||||
tools/gritsettings/resource_ids.spec | 6 +
|
||||
108 files changed, 9494 insertions(+), 2 deletions(-)
|
||||
108 files changed, 9514 insertions(+), 2 deletions(-)
|
||||
create mode 100644 components/user_scripts/README.md
|
||||
create mode 100755 components/user_scripts/android/BUILD.gn
|
||||
create mode 100644 components/user_scripts/android/java/res/layout/accept_script_item.xml
|
||||
@@ -4781,7 +4781,7 @@ diff --git a/components/user_scripts/common/url_pattern.cc b/components/user_scr
|
||||
new file mode 100755
|
||||
--- /dev/null
|
||||
+++ b/components/user_scripts/common/url_pattern.cc
|
||||
@@ -0,0 +1,809 @@
|
||||
@@ -0,0 +1,813 @@
|
||||
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
+// Use of this source code is governed by a BSD-style license that can be
|
||||
+// found in the LICENSE file.
|
||||
@@ -4806,6 +4806,8 @@ new file mode 100755
|
||||
+#include "url/gurl.h"
|
||||
+#include "url/url_util.h"
|
||||
+
|
||||
+namespace user_scripts {
|
||||
+
|
||||
+const char URLPattern::kAllUrlsPattern[] = "<all_urls>";
|
||||
+
|
||||
+namespace {
|
||||
@@ -5591,11 +5593,13 @@ new file mode 100755
|
||||
+ auto parseResultMessages = base::span(kParseResultMessages);
|
||||
+ return parseResultMessages[static_cast<int>(parse_result)];
|
||||
+}
|
||||
+
|
||||
+}
|
||||
diff --git a/components/user_scripts/common/url_pattern.h b/components/user_scripts/common/url_pattern.h
|
||||
new file mode 100755
|
||||
--- /dev/null
|
||||
+++ b/components/user_scripts/common/url_pattern.h
|
||||
@@ -0,0 +1,302 @@
|
||||
@@ -0,0 +1,306 @@
|
||||
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
+// Use of this source code is governed by a BSD-style license that can be
|
||||
+// found in the LICENSE file.
|
||||
@@ -5612,6 +5616,8 @@ new file mode 100755
|
||||
+
|
||||
+class GURL;
|
||||
+
|
||||
+namespace user_scripts {
|
||||
+
|
||||
+// A pattern that can be used to match URLs. A URLPattern is a very restricted
|
||||
+// subset of URL syntax:
|
||||
+//
|
||||
@@ -5897,6 +5903,8 @@ new file mode 100755
|
||||
+
|
||||
+typedef std::vector<URLPattern> URLPatternList;
|
||||
+
|
||||
+}
|
||||
+
|
||||
+#endif // USERSCRIPTS_COMMON_URL_PATTERN_H_
|
||||
diff --git a/components/user_scripts/common/url_pattern_set.cc b/components/user_scripts/common/url_pattern_set.cc
|
||||
new file mode 100755
|
||||
@@ -7586,19 +7594,23 @@ diff --git a/components/user_scripts/renderer/injection_host.cc b/components/use
|
||||
new file mode 100755
|
||||
--- /dev/null
|
||||
+++ b/components/user_scripts/renderer/injection_host.cc
|
||||
@@ -0,0 +1,12 @@
|
||||
@@ -0,0 +1,16 @@
|
||||
+// Copyright 2015 The Chromium Authors. All rights reserved.
|
||||
+// Use of this source code is governed by a BSD-style license that can be
|
||||
+// found in the LICENSE file.
|
||||
+
|
||||
+#include "injection_host.h"
|
||||
+
|
||||
+namespace user_scripts {
|
||||
+
|
||||
+InjectionHost::InjectionHost(const HostID& host_id) :
|
||||
+ id_(host_id) {
|
||||
+}
|
||||
+
|
||||
+InjectionHost::~InjectionHost() {
|
||||
+}
|
||||
+
|
||||
+}
|
||||
diff --git a/components/user_scripts/renderer/injection_host.h b/components/user_scripts/renderer/injection_host.h
|
||||
new file mode 100755
|
||||
--- /dev/null
|
||||
@@ -7614,9 +7626,7 @@ new file mode 100755
|
||||
+#include "../common/host_id.h"
|
||||
+#include "url/gurl.h"
|
||||
+
|
||||
+namespace content {
|
||||
+class RenderFrame;
|
||||
+}
|
||||
+namespace user_scripts {
|
||||
+
|
||||
+// An interface for all kinds of hosts who own user scripts.
|
||||
+class InjectionHost {
|
||||
@@ -7644,6 +7654,8 @@ new file mode 100755
|
||||
+ HostID id_;
|
||||
+};
|
||||
+
|
||||
+}
|
||||
+
|
||||
+#endif // USERSCRIPTS_RENDERER_INJECTION_HOST_H_
|
||||
diff --git a/components/user_scripts/renderer/resources/greasemonkey_api.js b/components/user_scripts/renderer/resources/greasemonkey_api.js
|
||||
new file mode 100755
|
||||
@@ -9007,7 +9019,7 @@ diff --git a/components/user_scripts/renderer/script_injector.h b/components/use
|
||||
new file mode 100755
|
||||
--- /dev/null
|
||||
+++ b/components/user_scripts/renderer/script_injector.h
|
||||
@@ -0,0 +1,96 @@
|
||||
@@ -0,0 +1,100 @@
|
||||
+// Copyright 2014 The Chromium Authors. All rights reserved.
|
||||
+// Use of this source code is governed by a BSD-style license that can be
|
||||
+// found in the LICENSE file.
|
||||
@@ -9028,6 +9040,10 @@ new file mode 100755
|
||||
+class WebLocalFrame;
|
||||
+}
|
||||
+
|
||||
+namespace content {
|
||||
+class RenderFrame;
|
||||
+}
|
||||
+
|
||||
+namespace user_scripts {
|
||||
+
|
||||
+// The pseudo-delegate class for a ScriptInjection that provides all necessary
|
||||
@@ -10325,22 +10341,22 @@ new file mode 100755
|
||||
+#include "web_ui_injection_host.h"
|
||||
+#include "base/no_destructor.h"
|
||||
+
|
||||
+namespace {
|
||||
+namespace user_scripts {
|
||||
+
|
||||
+// The default secure CSP to be used in order to prevent remote scripts.
|
||||
+const char kDefaultSecureCSP[] = "script-src 'self'; object-src 'self';";
|
||||
+
|
||||
+}
|
||||
+
|
||||
+WebUIInjectionHost::WebUIInjectionHost(const HostID& host_id)
|
||||
+user_scripts::WebUIInjectionHost::WebUIInjectionHost(const HostID& host_id)
|
||||
+ : InjectionHost(host_id),
|
||||
+ url_(host_id.id()) {
|
||||
+}
|
||||
+
|
||||
+WebUIInjectionHost::~WebUIInjectionHost() {
|
||||
+user_scripts::WebUIInjectionHost::~WebUIInjectionHost() {
|
||||
+}
|
||||
+
|
||||
+const std::string* WebUIInjectionHost::GetContentSecurityPolicy() const {
|
||||
+const std::string* user_scripts::WebUIInjectionHost::GetContentSecurityPolicy() const {
|
||||
+ // Use the main world CSP.
|
||||
+ // return nullptr;
|
||||
+
|
||||
@@ -10351,18 +10367,18 @@ new file mode 100755
|
||||
+ return default_isolated_world_csp.get();
|
||||
+}
|
||||
+
|
||||
+const GURL& WebUIInjectionHost::url() const {
|
||||
+const GURL& user_scripts::WebUIInjectionHost::url() const {
|
||||
+ return url_;
|
||||
+}
|
||||
+
|
||||
+const std::string& WebUIInjectionHost::name() const {
|
||||
+const std::string& user_scripts::WebUIInjectionHost::name() const {
|
||||
+ return id().id();
|
||||
+}
|
||||
diff --git a/components/user_scripts/renderer/web_ui_injection_host.h b/components/user_scripts/renderer/web_ui_injection_host.h
|
||||
new file mode 100755
|
||||
--- /dev/null
|
||||
+++ b/components/user_scripts/renderer/web_ui_injection_host.h
|
||||
@@ -0,0 +1,27 @@
|
||||
@@ -0,0 +1,31 @@
|
||||
+// Copyright 2015 The Chromium Authors. All rights reserved.
|
||||
+// Use of this source code is governed by a BSD-style license that can be
|
||||
+// found in the LICENSE file.
|
||||
@@ -10372,7 +10388,9 @@ new file mode 100755
|
||||
+
|
||||
+#include "injection_host.h"
|
||||
+
|
||||
+class WebUIInjectionHost : public InjectionHost {
|
||||
+namespace user_scripts {
|
||||
+
|
||||
+class WebUIInjectionHost : public user_scripts::InjectionHost {
|
||||
+ public:
|
||||
+ WebUIInjectionHost(const WebUIInjectionHost&) = delete;
|
||||
+ WebUIInjectionHost& operator=(const WebUIInjectionHost&) = delete;
|
||||
@@ -10389,6 +10407,8 @@ new file mode 100755
|
||||
+ GURL url_;
|
||||
+};
|
||||
+
|
||||
+}
|
||||
+
|
||||
+#endif // USERSCRIPTS_RENDERER_WEB_UI_INJECTION_HOST_H_
|
||||
diff --git a/components/user_scripts/strings/userscripts_strings.grdp b/components/user_scripts/strings/userscripts_strings.grdp
|
||||
new file mode 100755
|
||||
|
||||
@@ -20,7 +20,7 @@ License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html
|
||||
.../network_traffic_annotation.h | 4 -
|
||||
net/url_request/url_request_http_job.cc | 15 +
|
||||
net/url_request/url_request_http_job.h | 3 +
|
||||
services/firewall/public/BUILD.gn | 70 +++
|
||||
services/firewall/public/BUILD.gn | 74 +++
|
||||
services/firewall/public/firewall_features.cc | 28 +
|
||||
services/firewall/public/firewall_features.h | 31 ++
|
||||
services/firewall/public/firewall_service.cc | 46 ++
|
||||
@@ -40,7 +40,7 @@ License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html
|
||||
.../loader/fetch/url_loader/url_loader.cc | 4 +-
|
||||
.../scripts/auditor/auditor.py | 1 +
|
||||
.../scripts/auditor/util.py | 1 +
|
||||
31 files changed, 1648 insertions(+), 22 deletions(-)
|
||||
31 files changed, 1652 insertions(+), 22 deletions(-)
|
||||
create mode 100644 cromite_flags/chrome/browser/about_flags_cc/Internal-firewall.inc
|
||||
create mode 100644 services/firewall/public/BUILD.gn
|
||||
create mode 100644 services/firewall/public/firewall_features.cc
|
||||
@@ -367,7 +367,7 @@ diff --git a/services/firewall/public/BUILD.gn b/services/firewall/public/BUILD.
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/services/firewall/public/BUILD.gn
|
||||
@@ -0,0 +1,70 @@
|
||||
@@ -0,0 +1,74 @@
|
||||
+# 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
|
||||
@@ -394,6 +394,10 @@ new file mode 100644
|
||||
+ "//base",
|
||||
+ "//third_party/abseil-cpp:absl"
|
||||
+ ]
|
||||
+
|
||||
+ deps = [
|
||||
+ ":gen_firewall_builders",
|
||||
+ ]
|
||||
+}
|
||||
+
|
||||
+action("gen_firewall_builders") {
|
||||
|
||||
Reference in New Issue
Block a user