Localhost Permission => Local Network Access cleanup (#32910)
Brave's custom localhost access permission feature has been replaced with Chromium's Local Network Access (LNA) feature.
This commit is contained in:
@@ -24,7 +24,6 @@ public abstract class BraveFeatureList {
|
||||
"BraveVPNLinkSubscriptionAndroidUI";
|
||||
public static final String DEBOUNCE = "BraveDebounce";
|
||||
public static final String BRAVE_GOOGLE_SIGN_IN_PERMISSION = "BraveGoogleSignInPermission";
|
||||
public static final String BRAVE_LOCALHOST_PERMISSION = "BraveLocalhostPermission";
|
||||
public static final String BRAVE_PLAYLIST = "Playlist";
|
||||
public static final String HTTPS_BY_DEFAULT = "HttpsByDefault";
|
||||
public static final String BRAVE_FORGET_FIRST_PARTY_STORAGE = "BraveForgetFirstPartyStorage";
|
||||
|
||||
@@ -963,24 +963,7 @@
|
||||
<message name="IDS_SETTINGS_SITE_SETTINGS_GOOGLE_SIGN_IN_ALLOW_EXCEPTIONS" desc="Label for G sign-in site settings.">
|
||||
Allowed to use third-party cookies for legacy Google Sign-In
|
||||
</message>
|
||||
|
||||
<!-- Localhost access setting -->
|
||||
<message name="IDS_SETTINGS_SITE_SETTINGS_LOCALHOST_ACCESS" desc="Label for localhost site settings.">
|
||||
Localhost access
|
||||
</message>
|
||||
<message name="IDS_SETTINGS_SITE_SETTINGS_LOCALHOST_ACCESS_ASK" desc="Label for localhost access site settings.">
|
||||
Sites can request access to localhost resources
|
||||
</message>
|
||||
<message name="IDS_SETTINGS_SITE_SETTINGS_LOCALHOST_ACCESS_BLOCK" desc="Label for localhost access site settings.">
|
||||
Don't allow access to localhost resources
|
||||
</message>
|
||||
<message name="IDS_SETTINGS_SITE_SETTINGS_LOCALHOST_ACCESS_BLOCK_EXCEPTIONS" desc="Label for localhost access site settings.">
|
||||
Not allowed to access localhost resources
|
||||
</message>
|
||||
<message name="IDS_SETTINGS_SITE_SETTINGS_LOCALHOST_ACCESS_ALLOW_EXCEPTIONS" desc="Label for localhost access site settings.">
|
||||
Allowed to access localhost resources
|
||||
</message>
|
||||
|
||||
|
||||
<!-- AI chat setting -->
|
||||
<message name="IDS_SETTINGS_SITE_SETTINGS_BRAVE_OPEN_AI_CHAT" desc="Label for opening Leo AI chat site settings.">
|
||||
Leo AI chat
|
||||
|
||||
@@ -212,7 +212,6 @@ TEST(FeatureDefaultsTest, DisabledFeatures) {
|
||||
&net::features::kWaitForFirstPartySetsInit,
|
||||
&network::features::kBrowsingTopics,
|
||||
&network::features::kInterestGroupStorage,
|
||||
&network::features::kLocalNetworkAccessChecks,
|
||||
&network::features::kSharedStorageAPI,
|
||||
&network_time::kNetworkTimeServiceQuerying,
|
||||
&ntp_features::kCustomizeChromeSidePanelExtensionsCard,
|
||||
@@ -293,6 +292,7 @@ TEST(FeatureDefaultsTest, EnabledFeatures) {
|
||||
&features::kSideBySide,
|
||||
&sharing_hub::kDesktopScreenshots,
|
||||
#endif
|
||||
&network::features::kLocalNetworkAccessChecksWebSockets,
|
||||
};
|
||||
|
||||
for (const auto* feature : enabled_features) {
|
||||
|
||||
@@ -988,14 +988,6 @@ constexpr flags_ui::FeatureEntry::Choice kVerticalTabCollapseDelayChoices[] = {
|
||||
FEATURE_VALUE_TYPE(google_sign_in_permission::features:: \
|
||||
kBraveGoogleSignInPermission), \
|
||||
}, \
|
||||
{ \
|
||||
"brave-localhost-access-permission", \
|
||||
"Enable Localhost access permission prompt", \
|
||||
"Enable permissioning access to localhost connections", \
|
||||
kOsAll, \
|
||||
FEATURE_VALUE_TYPE( \
|
||||
brave_shields::features::kBraveLocalhostAccessPermission), \
|
||||
}, \
|
||||
{ \
|
||||
"brave-extension-network-blocking", \
|
||||
"Enable extension network blocking", \
|
||||
|
||||
@@ -1,156 +0,0 @@
|
||||
// Copyright (c) 2023 The Brave Authors. All rights reserved.
|
||||
// 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 https://mozilla.org/MPL/2.0/.
|
||||
|
||||
#include "brave/browser/net/brave_localhost_permission_network_delegate_helper.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "base/check_op.h"
|
||||
#include "brave/browser/brave_browser_process.h"
|
||||
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
|
||||
#include "components/content_settings/core/browser/host_content_settings_map.h"
|
||||
#include "components/prefs/pref_service.h"
|
||||
#include "content/public/browser/browser_context.h"
|
||||
#include "content/public/browser/navigation_controller.h"
|
||||
#include "content/public/browser/permission_controller.h"
|
||||
#include "content/public/browser/permission_descriptor_util.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "net/base/net_errors.h"
|
||||
#include "net/base/url_util.h"
|
||||
#include "third_party/blink/public/common/permissions/permission_utils.h"
|
||||
|
||||
namespace brave {
|
||||
|
||||
void OnPermissionRequestStatus(
|
||||
content::FrameTreeNodeId frame_tree_node_id,
|
||||
const std::vector<content::PermissionResult>& permission_statuses) {
|
||||
DCHECK_EQ(1u, permission_statuses.size());
|
||||
// Once permission status has been updated, reload the page.
|
||||
// We do this so as to let the user know that they should retry
|
||||
// an action. Also just makes state management easier.
|
||||
auto* contents =
|
||||
content::WebContents::FromFrameTreeNodeId(frame_tree_node_id);
|
||||
if (contents &&
|
||||
permission_statuses[0].status == content::PermissionStatus::GRANTED) {
|
||||
contents->GetController().Reload(content::ReloadType::NORMAL, true);
|
||||
}
|
||||
}
|
||||
|
||||
bool IsLocalhostRequest(const GURL& request_url,
|
||||
const GURL& request_initiator_url) {
|
||||
return net::IsLocalhost(request_url) &&
|
||||
!net::IsLocalhost(request_initiator_url);
|
||||
}
|
||||
|
||||
// Assumes that the caller has verified that
|
||||
// the request is valid and for a localhost subresource.
|
||||
// If no WebContents, then we can't prompt for permission;
|
||||
// use existing content setting.
|
||||
int HandleLocalhostRequestsWithNoWebContents(
|
||||
const GURL& request_initiator_url,
|
||||
content::BrowserContext* browser_context) {
|
||||
auto* settings_map =
|
||||
HostContentSettingsMapFactory::GetForProfile(browser_context);
|
||||
auto setting_for_url = settings_map->GetContentSetting(
|
||||
request_initiator_url, GURL(),
|
||||
ContentSettingsType::BRAVE_LOCALHOST_ACCESS);
|
||||
switch (setting_for_url) {
|
||||
case ContentSetting::CONTENT_SETTING_ALLOW: {
|
||||
return net::OK;
|
||||
}
|
||||
default: {
|
||||
return net::ERR_ACCESS_DENIED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int OnBeforeURLRequest_LocalhostPermissionWork(
|
||||
const ResponseCallback& next_callback,
|
||||
std::shared_ptr<BraveRequestInfo> ctx) {
|
||||
// If request is already blocked by adblock, return.
|
||||
if (ctx->blocked_by == kAdBlocked) {
|
||||
return net::OK;
|
||||
}
|
||||
|
||||
const bool is_web_socket_request = ctx->request_url.SchemeIsWSOrWSS();
|
||||
const bool is_valid_subresource_request =
|
||||
ctx->resource_type != blink::mojom::ResourceType::kMainFrame &&
|
||||
ctx->resource_type != BraveRequestInfo::kInvalidResourceType;
|
||||
|
||||
// Only throttle valid subresource requests + WebSockets.
|
||||
// https://github.com/brave/brave-browser/issues/26302
|
||||
if (!is_web_socket_request && !is_valid_subresource_request) {
|
||||
return net::OK;
|
||||
}
|
||||
|
||||
const auto& request_initiator_url = ctx->initiator_url;
|
||||
const auto& request_url = ctx->request_url;
|
||||
|
||||
const bool is_request_url_valid =
|
||||
request_url.is_valid() && !request_url.is_empty();
|
||||
const bool is_request_initiator_url_valid =
|
||||
request_initiator_url.is_valid() && !request_initiator_url.is_empty() &&
|
||||
request_initiator_url.has_host();
|
||||
|
||||
// If the following info isn't available, then there's not much we can do.
|
||||
if (!is_request_url_valid || !is_request_initiator_url_valid) {
|
||||
return net::OK;
|
||||
}
|
||||
|
||||
// We don't want to block requests from extensions, because
|
||||
// we don't currently do that via adblock.
|
||||
if (request_initiator_url.SchemeIs(content_settings::kExtensionScheme)) {
|
||||
return net::OK;
|
||||
}
|
||||
|
||||
if (!IsLocalhostRequest(request_url, request_initiator_url)) {
|
||||
return net::OK;
|
||||
}
|
||||
|
||||
auto* contents =
|
||||
content::WebContents::FromFrameTreeNodeId(ctx->frame_tree_node_id);
|
||||
|
||||
if (!contents) {
|
||||
return HandleLocalhostRequestsWithNoWebContents(request_initiator_url,
|
||||
ctx->browser_context);
|
||||
}
|
||||
|
||||
auto* permission_controller =
|
||||
contents->GetBrowserContext()->GetPermissionController();
|
||||
auto current_status =
|
||||
permission_controller
|
||||
->GetPermissionResultForCurrentDocument(
|
||||
content::PermissionDescriptorUtil::
|
||||
CreatePermissionDescriptorForPermissionType(
|
||||
blink::PermissionType::BRAVE_LOCALHOST_ACCESS),
|
||||
/* rfh */ contents->GetPrimaryMainFrame())
|
||||
.status;
|
||||
|
||||
switch (current_status) {
|
||||
case blink::mojom::PermissionStatus::GRANTED: {
|
||||
return net::OK;
|
||||
}
|
||||
|
||||
case blink::mojom::PermissionStatus::DENIED: {
|
||||
return net::ERR_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
case blink::mojom::PermissionStatus::ASK: {
|
||||
// Check if website is allowed to ask for permission.
|
||||
permission_controller->RequestPermissionsFromCurrentDocument(
|
||||
/* rfh */ contents->GetPrimaryMainFrame(),
|
||||
content::PermissionRequestDescription(
|
||||
content::PermissionDescriptorUtil::
|
||||
CreatePermissionDescriptorForPermissionType(
|
||||
blink::PermissionType::BRAVE_LOCALHOST_ACCESS),
|
||||
/*user_gesture*/ true),
|
||||
base::BindOnce(&OnPermissionRequestStatus, ctx->frame_tree_node_id));
|
||||
return net::ERR_ACCESS_DENIED;
|
||||
}
|
||||
}
|
||||
return net::OK;
|
||||
}
|
||||
|
||||
} // namespace brave
|
||||
@@ -1,23 +0,0 @@
|
||||
// Copyright (c) 2023 The Brave Authors. All rights reserved.
|
||||
// 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 https://mozilla.org/MPL/2.0/.
|
||||
|
||||
#ifndef BRAVE_BROWSER_NET_BRAVE_LOCALHOST_PERMISSION_NETWORK_DELEGATE_HELPER_H_
|
||||
#define BRAVE_BROWSER_NET_BRAVE_LOCALHOST_PERMISSION_NETWORK_DELEGATE_HELPER_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "brave/browser/net/url_context.h"
|
||||
|
||||
struct BraveRequestInfo;
|
||||
|
||||
namespace brave {
|
||||
|
||||
int OnBeforeURLRequest_LocalhostPermissionWork(
|
||||
const ResponseCallback& next_callback,
|
||||
std::shared_ptr<BraveRequestInfo> ctx);
|
||||
|
||||
} // namespace brave
|
||||
|
||||
#endif // BRAVE_BROWSER_NET_BRAVE_LOCALHOST_PERMISSION_NETWORK_DELEGATE_HELPER_H_
|
||||
@@ -14,7 +14,6 @@
|
||||
#include "brave/browser/net/brave_ad_block_csp_network_delegate_helper.h"
|
||||
#include "brave/browser/net/brave_ad_block_tp_network_delegate_helper.h"
|
||||
#include "brave/browser/net/brave_common_static_redirect_network_delegate_helper.h"
|
||||
#include "brave/browser/net/brave_localhost_permission_network_delegate_helper.h"
|
||||
#include "brave/browser/net/brave_reduce_language_network_delegate_helper.h"
|
||||
#include "brave/browser/net/brave_service_key_network_delegate_helper.h"
|
||||
#include "brave/browser/net/brave_site_hacks_network_delegate_helper.h"
|
||||
@@ -43,8 +42,9 @@
|
||||
static bool IsInternalScheme(std::shared_ptr<brave::BraveRequestInfo> ctx) {
|
||||
DCHECK(ctx);
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
if (ctx->request_url.SchemeIs(extensions::kExtensionScheme))
|
||||
if (ctx->request_url.SchemeIs(extensions::kExtensionScheme)) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return ctx->request_url.SchemeIs(content::kChromeUIScheme);
|
||||
}
|
||||
@@ -74,13 +74,6 @@ void BraveRequestHandler::SetupCallbacks() {
|
||||
before_url_request_callbacks_.push_back(callback);
|
||||
#endif
|
||||
|
||||
if (base::FeatureList::IsEnabled(
|
||||
brave_shields::features::kBraveLocalhostAccessPermission)) {
|
||||
callback =
|
||||
base::BindRepeating(brave::OnBeforeURLRequest_LocalhostPermissionWork);
|
||||
before_url_request_callbacks_.push_back(callback);
|
||||
}
|
||||
|
||||
brave::OnBeforeStartTransactionCallback start_transaction_callback =
|
||||
base::BindRepeating(brave::OnBeforeStartTransaction_SiteHacksWork);
|
||||
before_start_transaction_callbacks_.push_back(start_transaction_callback);
|
||||
|
||||
@@ -17,8 +17,6 @@ brave_browser_net_sources = [
|
||||
"//brave/browser/net/brave_block_safebrowsing_urls.h",
|
||||
"//brave/browser/net/brave_common_static_redirect_network_delegate_helper.cc",
|
||||
"//brave/browser/net/brave_common_static_redirect_network_delegate_helper.h",
|
||||
"//brave/browser/net/brave_localhost_permission_network_delegate_helper.cc",
|
||||
"//brave/browser/net/brave_localhost_permission_network_delegate_helper.h",
|
||||
"//brave/browser/net/brave_proxying_url_loader_factory.cc",
|
||||
"//brave/browser/net/brave_proxying_url_loader_factory.h",
|
||||
"//brave/browser/net/brave_proxying_web_socket.cc",
|
||||
|
||||
@@ -39,6 +39,7 @@ if (!is_android) {
|
||||
"//chrome/test:test_support_ui",
|
||||
"//components/permissions",
|
||||
"//content/test:test_support",
|
||||
"//services/network/public/cpp:ip_address_space_overrides_test_utils",
|
||||
]
|
||||
|
||||
if (enable_brave_wallet) {
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include "brave/components/brave_shields/content/browser/ad_block_service.h"
|
||||
#include "brave/components/brave_shields/content/test/test_filters_provider.h"
|
||||
#include "brave/components/brave_shields/core/browser/brave_shields_utils.h"
|
||||
#include "brave/components/brave_shields/core/common/features.h"
|
||||
#include "brave/components/constants/brave_paths.h"
|
||||
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
@@ -20,7 +19,6 @@
|
||||
#include "chrome/browser/profiles/profile_test_util.h"
|
||||
#include "chrome/browser/ui/browser.h"
|
||||
#include "chrome/test/base/in_process_browser_test.h"
|
||||
#include "chrome/test/base/testing_browser_process.h"
|
||||
#include "chrome/test/base/ui_test_utils.h"
|
||||
#include "components/content_settings/core/browser/host_content_settings_map.h"
|
||||
#include "components/content_settings/core/common/content_settings.h"
|
||||
@@ -36,7 +34,9 @@
|
||||
#include "net/dns/mock_host_resolver.h"
|
||||
#include "net/test/embedded_test_server/embedded_test_server.h"
|
||||
#include "net/test/embedded_test_server/install_default_websocket_handlers.h"
|
||||
#include "net/test/test_data_directory.h"
|
||||
#include "services/network/public/cpp/features.h"
|
||||
#include "services/network/public/cpp/ip_address_space_overrides_test_utils.h"
|
||||
#include "services/network/public/cpp/network_switches.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
using net::test_server::EmbeddedTestServer;
|
||||
@@ -52,8 +52,22 @@ constexpr char kSimplePage[] = "/simple.html";
|
||||
class LocalhostAccessBrowserTest : public InProcessBrowserTest {
|
||||
public:
|
||||
LocalhostAccessBrowserTest() {
|
||||
feature_list_.InitAndEnableFeature(
|
||||
brave_shields::features::kBraveLocalhostAccessPermission);
|
||||
feature_list_.InitWithFeaturesAndParameters(
|
||||
{{network::features::kLocalNetworkAccessChecksWebSockets, {}},
|
||||
{network::features::kLocalNetworkAccessChecks,
|
||||
{{"LocalNetworkAccessChecksWarn", "false"}}}},
|
||||
{});
|
||||
// Embedding website server
|
||||
https_server_ = std::make_unique<net::EmbeddedTestServer>(
|
||||
net::test_server::EmbeddedTestServer::TYPE_HTTPS);
|
||||
content::SetupCrossSiteRedirector(https_server_.get());
|
||||
CHECK(https_server_->InitializeAndListen());
|
||||
// Localhost server
|
||||
localhost_server_ = std::make_unique<net::EmbeddedTestServer>(
|
||||
net::test_server::EmbeddedTestServer::TYPE_HTTPS);
|
||||
net::test_server::InstallDefaultWebSocketHandlers(localhost_server_.get());
|
||||
content::SetupCrossSiteRedirector(localhost_server_.get());
|
||||
CHECK(localhost_server_->InitializeAndListen());
|
||||
}
|
||||
|
||||
void SetUpOnMainThread() override {
|
||||
@@ -62,20 +76,13 @@ class LocalhostAccessBrowserTest : public InProcessBrowserTest {
|
||||
host_resolver()->AddRule("*", "127.0.0.1");
|
||||
current_browser_ = InProcessBrowserTest::browser();
|
||||
|
||||
// Embedding website server
|
||||
https_server_ = std::make_unique<net::EmbeddedTestServer>(
|
||||
net::test_server::EmbeddedTestServer::TYPE_HTTPS);
|
||||
base::FilePath test_data_dir;
|
||||
base::PathService::Get(brave::DIR_TEST_DATA, &test_data_dir);
|
||||
https_server_->ServeFilesFromDirectory(test_data_dir);
|
||||
content::SetupCrossSiteRedirector(https_server_.get());
|
||||
ASSERT_TRUE(https_server_->Start());
|
||||
// Localhost server
|
||||
localhost_server_ = std::make_unique<net::EmbeddedTestServer>(
|
||||
net::test_server::EmbeddedTestServer::TYPE_HTTPS);
|
||||
localhost_server_->ServeFilesFromDirectory(test_data_dir);
|
||||
content::SetupCrossSiteRedirector(localhost_server_.get());
|
||||
ASSERT_TRUE(localhost_server_->Start());
|
||||
https_server_->ServeFilesFromDirectory(
|
||||
base::PathService::CheckedGet(brave::DIR_TEST_DATA));
|
||||
localhost_server_->ServeFilesFromDirectory(
|
||||
base::PathService::CheckedGet(brave::DIR_TEST_DATA));
|
||||
|
||||
https_server_->StartAcceptingConnections();
|
||||
localhost_server_->StartAcceptingConnections();
|
||||
|
||||
permissions::PermissionRequestManager* manager =
|
||||
GetPermissionRequestManager();
|
||||
@@ -101,6 +108,11 @@ class LocalhostAccessBrowserTest : public InProcessBrowserTest {
|
||||
void SetUpCommandLine(base::CommandLine* command_line) override {
|
||||
InProcessBrowserTest::SetUpCommandLine(command_line);
|
||||
mock_cert_verifier_.SetUpCommandLine(command_line);
|
||||
network::AddIpAddressSpaceOverridesToCommandLine(
|
||||
{network::GenerateIpAddressSpaceOverride(*https_server_),
|
||||
network::GenerateIpAddressSpaceOverride(
|
||||
*localhost_server_, network::mojom::IPAddressSpace::kLocal)},
|
||||
*command_line);
|
||||
}
|
||||
|
||||
void SetUpInProcessBrowserTestFixture() override {
|
||||
@@ -168,14 +180,14 @@ class LocalhostAccessBrowserTest : public InProcessBrowserTest {
|
||||
void CheckCurrentStatusIs(ContentSetting content_setting) {
|
||||
EXPECT_EQ(content_settings()->GetContentSetting(
|
||||
embedding_url_, embedding_url_,
|
||||
ContentSettingsType::BRAVE_LOCALHOST_ACCESS),
|
||||
ContentSettingsType::LOCAL_NETWORK_ACCESS),
|
||||
content_setting);
|
||||
}
|
||||
|
||||
void SetCurrentStatus(ContentSetting content_setting) {
|
||||
content_settings()->SetContentSettingDefaultScope(
|
||||
embedding_url_, embedding_url_,
|
||||
ContentSettingsType::BRAVE_LOCALHOST_ACCESS, content_setting);
|
||||
ContentSettingsType::LOCAL_NETWORK_ACCESS, content_setting);
|
||||
}
|
||||
|
||||
void CheckAskAndAcceptFlow(GURL localhost_url, int prompt_count = 0) {
|
||||
@@ -186,7 +198,7 @@ class LocalhostAccessBrowserTest : public InProcessBrowserTest {
|
||||
prompt_factory()->set_response_type(
|
||||
permissions::PermissionRequestManager::ACCEPT_ALL);
|
||||
// Load subresource.
|
||||
InsertImage(localhost_url.spec(), false);
|
||||
InsertImage(localhost_url.spec(), true);
|
||||
// Make sure prompt came up.
|
||||
EXPECT_EQ(prompt_count + 1, prompt_factory()->show_count());
|
||||
// Check content setting is now ALLOWed.
|
||||
@@ -228,14 +240,14 @@ class LocalhostAccessBrowserTest : public InProcessBrowserTest {
|
||||
// Load subresource
|
||||
InsertImage(localhost_url.spec(), false);
|
||||
// Make sure prompt came up.
|
||||
EXPECT_EQ(prompt_count + 1, prompt_factory()->show_count());
|
||||
EXPECT_EQ(prompt_count + 2, prompt_factory()->show_count());
|
||||
// Check content setting is still ASK.
|
||||
CheckCurrentStatusIs(ContentSetting::CONTENT_SETTING_ASK);
|
||||
// Access to localhost resources should be denied.
|
||||
ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), embedding_url_));
|
||||
InsertImage(localhost_url.spec(), false);
|
||||
// Still ask for prompt.
|
||||
EXPECT_EQ(prompt_count + 2, prompt_factory()->show_count());
|
||||
EXPECT_EQ(prompt_count + 3, prompt_factory()->show_count());
|
||||
}
|
||||
|
||||
void CheckNoPromptFlow(const bool expected, GURL localhost_url) {
|
||||
@@ -288,7 +300,8 @@ IN_PROC_BROWSER_TEST_F(LocalhostAccessBrowserTest, Localhost) {
|
||||
IN_PROC_BROWSER_TEST_F(LocalhostAccessBrowserTest, DotLocalhost) {
|
||||
std::string test_domain = "test.localhost";
|
||||
embedding_url_ = https_server_->GetURL(kTestEmbeddingDomain, kSimplePage);
|
||||
const auto& target_url = https_server_->GetURL(test_domain, kTestTargetPath);
|
||||
const auto& target_url =
|
||||
localhost_server_->GetURL(test_domain, kTestTargetPath);
|
||||
CheckAskAndAcceptFlow(target_url);
|
||||
// Reset content setting.
|
||||
SetCurrentStatus(ContentSetting::CONTENT_SETTING_ASK);
|
||||
@@ -301,7 +314,8 @@ IN_PROC_BROWSER_TEST_F(LocalhostAccessBrowserTest, DotLocalhost) {
|
||||
IN_PROC_BROWSER_TEST_F(LocalhostAccessBrowserTest, OneTwoSeven) {
|
||||
std::string test_domain = "127.0.0.1";
|
||||
embedding_url_ = https_server_->GetURL(kTestEmbeddingDomain, kSimplePage);
|
||||
const auto& target_url = https_server_->GetURL(test_domain, kTestTargetPath);
|
||||
const auto& target_url =
|
||||
localhost_server_->GetURL(test_domain, kTestTargetPath);
|
||||
CheckAskAndAcceptFlow(target_url);
|
||||
// Reset content setting
|
||||
SetCurrentStatus(ContentSetting::CONTENT_SETTING_ASK);
|
||||
@@ -315,7 +329,8 @@ IN_PROC_BROWSER_TEST_F(LocalhostAccessBrowserTest, IncognitoModeInheritAllow) {
|
||||
// Allowed permission for a website is ASK in incognito.
|
||||
std::string test_domain = "localhost";
|
||||
embedding_url_ = https_server_->GetURL(kTestEmbeddingDomain, kSimplePage);
|
||||
const auto& target_url = https_server_->GetURL(test_domain, kTestTargetPath);
|
||||
const auto& target_url =
|
||||
localhost_server_->GetURL(test_domain, kTestTargetPath);
|
||||
CheckAskAndAcceptFlow(target_url);
|
||||
// Check incognito mode.
|
||||
Profile* profile = browser()->profile();
|
||||
@@ -328,7 +343,8 @@ IN_PROC_BROWSER_TEST_F(LocalhostAccessBrowserTest, IncognitoModeInheritBlock) {
|
||||
// Blocked permission for a website is ASK in incognito.
|
||||
std::string test_domain = "localhost";
|
||||
embedding_url_ = https_server_->GetURL(kTestEmbeddingDomain, kSimplePage);
|
||||
const auto& target_url = https_server_->GetURL(test_domain, kTestTargetPath);
|
||||
const auto& target_url =
|
||||
localhost_server_->GetURL(test_domain, kTestTargetPath);
|
||||
CheckAskAndDenyFlow(target_url);
|
||||
// Check Incognito mode.
|
||||
Profile* profile = browser()->profile();
|
||||
@@ -345,7 +361,8 @@ IN_PROC_BROWSER_TEST_F(LocalhostAccessBrowserTest, IncognitoModeDoesNotLeak) {
|
||||
SetPromptFactory(GetPermissionRequestManager());
|
||||
std::string test_domain = "localhost";
|
||||
embedding_url_ = https_server_->GetURL(kTestEmbeddingDomain, kSimplePage);
|
||||
const auto& target_url = https_server_->GetURL(test_domain, kTestTargetPath);
|
||||
const auto& target_url =
|
||||
localhost_server_->GetURL(test_domain, kTestTargetPath);
|
||||
CheckAskAndAcceptFlow(target_url);
|
||||
// Check permission did not leak.
|
||||
SetBrowser(original_browser);
|
||||
@@ -364,11 +381,8 @@ IN_PROC_BROWSER_TEST_F(LocalhostAccessBrowserTest, NoPermissionPrompt) {
|
||||
// Test that WebSocket connections to localhost are blocked/allowed.
|
||||
IN_PROC_BROWSER_TEST_F(LocalhostAccessBrowserTest, WebSocket) {
|
||||
// Start a WebSocket server.
|
||||
net::EmbeddedTestServer ws_server(net::EmbeddedTestServer::TYPE_HTTPS);
|
||||
net::test_server::InstallDefaultWebSocketHandlers(&ws_server);
|
||||
ASSERT_TRUE(ws_server.Start());
|
||||
auto ws_url = net::test_server::GetWebSocketURL(ws_server, "localhost",
|
||||
"/echo-with-no-extension");
|
||||
auto ws_url = net::test_server::GetWebSocketURL(
|
||||
*localhost_server_, "localhost", "/echo-with-no-extension");
|
||||
// Script to connect to ws server.
|
||||
std::string ws_open_script_template = R"(
|
||||
new Promise(resolve => {
|
||||
@@ -381,16 +395,21 @@ IN_PROC_BROWSER_TEST_F(LocalhostAccessBrowserTest, WebSocket) {
|
||||
embedding_url_ = https_server_->GetURL(kTestEmbeddingDomain, kSimplePage);
|
||||
ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), embedding_url_));
|
||||
prompt_factory()->set_response_type(
|
||||
permissions::PermissionRequestManager::ACCEPT_ALL);
|
||||
permissions::PermissionRequestManager::DISMISS);
|
||||
// Run script to open WebSocket, it should error out.
|
||||
const std::string& ws_open_script =
|
||||
content::JsReplace(ws_open_script_template, ws_url);
|
||||
ASSERT_EQ("error", EvalJs(contents(), ws_open_script));
|
||||
EXPECT_EQ(1, prompt_factory()->show_count());
|
||||
CheckCurrentStatusIs(ContentSetting::CONTENT_SETTING_ASK);
|
||||
|
||||
prompt_factory()->set_response_type(
|
||||
permissions::PermissionRequestManager::ACCEPT_ALL);
|
||||
contents()->GetController().Reload(content::ReloadType::NORMAL, false);
|
||||
// Wait for tab to reload after permission grant.
|
||||
WaitForLoadStop(contents());
|
||||
CheckCurrentStatusIs(ContentSetting::CONTENT_SETTING_ALLOW);
|
||||
ASSERT_EQ("open", EvalJs(contents(), ws_open_script));
|
||||
CheckCurrentStatusIs(ContentSetting::CONTENT_SETTING_ALLOW);
|
||||
}
|
||||
|
||||
// Test that service worker connections are blocked/allowed correctly.
|
||||
@@ -484,8 +503,9 @@ class LocalhostAccessBrowserTestFeatureDisabled
|
||||
public:
|
||||
LocalhostAccessBrowserTestFeatureDisabled() {
|
||||
feature_list_.Reset();
|
||||
feature_list_.InitAndDisableFeature(
|
||||
brave_shields::features::kBraveLocalhostAccessPermission);
|
||||
feature_list_.InitAndEnableFeatureWithParameters(
|
||||
network::features::kLocalNetworkAccessChecks,
|
||||
{{"LocalNetworkAccessChecksWarn", "true"}});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ import { loadTimeData } from "../i18n_setup.js"
|
||||
import { pageVisibility } from './page_visibility.js'
|
||||
import '../brave_survey_panelist_page/brave_survey_panelist_page.js'
|
||||
import '../site_settings/site_settings_autoplay.js'
|
||||
import '../site_settings/site_settings_localhost.js'
|
||||
// <if expr="enable_brave_wallet">
|
||||
import '../site_settings/site_settings_cardano.js'
|
||||
import '../site_settings/site_settings_ethereum.js'
|
||||
@@ -130,17 +129,6 @@ RegisterPolymerTemplateModifications({
|
||||
in-search-mode="[[inSearchMode_]]">
|
||||
</site-settings-autoplay-page>`)
|
||||
|
||||
if (loadTimeData.getBoolean('isLocalhostAccessFeatureEnabled')) {
|
||||
viewManager.appendChild(html`
|
||||
<site-settings-localhost-page
|
||||
id="${ContentSettingsTypes.LOCALHOST_ACCESS}"
|
||||
route-path$="[[routes_.SITE_SETTINGS_LOCALHOST_ACCESS.path]]"
|
||||
data-parent-view-id="siteSettings"
|
||||
slot="view"
|
||||
in-search-mode="[[inSearchMode_]]">
|
||||
</site-settings-localhost-page>`)
|
||||
}
|
||||
|
||||
// <if expr="enable_ai_chat">
|
||||
if (loadTimeData.getBoolean('isOpenAIChatFromBraveSearchEnabled')) {
|
||||
viewManager.appendChild(html`
|
||||
|
||||
@@ -81,24 +81,6 @@ RegisterPolymerTemplateModifications({
|
||||
}
|
||||
curChild++
|
||||
}
|
||||
// Localhost Access feature
|
||||
const isLocalhostAccessFeatureEnabled =
|
||||
loadTimeData.getBoolean('isLocalhostAccessFeatureEnabled')
|
||||
if (isLocalhostAccessFeatureEnabled) {
|
||||
insertBefore(firstPermissionItem, html`<site-details-permission
|
||||
category="[[contentSettingsTypesEnum_.LOCALHOST_ACCESS]]"
|
||||
icon="smartphone-desktop">
|
||||
</site-details-permission>`)
|
||||
const localhostAccessSettings = templateContent.querySelector(
|
||||
`div.list-frame > site-details-permission:nth-child(${curChild})`)
|
||||
if (!localhostAccessSettings) {
|
||||
console.error('[Settings] Localhost access settings not found')
|
||||
} else {
|
||||
localhostAccessSettings.setAttribute(
|
||||
'label', loadTimeData.getString('siteSettingsLocalhostAccess'))
|
||||
}
|
||||
curChild++
|
||||
}
|
||||
// <if expr="enable_ai_chat">
|
||||
// AI Chat feature
|
||||
const isOpenAIChatFromBraveSearchEnabled =
|
||||
|
||||
@@ -126,21 +126,6 @@ RegisterPolymerComponentReplacement(
|
||||
lists.permissionsAdvanced.splice(currentIndex, 0,
|
||||
googleSignInItem)
|
||||
}
|
||||
const isLocalhostAccessFeatureEnabled =
|
||||
loadTimeData.getBoolean('isLocalhostAccessFeatureEnabled')
|
||||
if (isLocalhostAccessFeatureEnabled) {
|
||||
currentIndex++
|
||||
const localhostAccessItem = {
|
||||
route: routes.SITE_SETTINGS_LOCALHOST_ACCESS,
|
||||
id: ContentSettingsTypes.LOCALHOST_ACCESS,
|
||||
label: 'siteSettingsLocalhostAccess',
|
||||
icon: 'smartphone-desktop',
|
||||
enabledLabel: 'siteSettingsLocalhostAccessAsk',
|
||||
disabledLabel: 'siteSettingsLocalhostAccessBlock'
|
||||
}
|
||||
lists.permissionsAdvanced.splice(currentIndex, 0,
|
||||
localhostAccessItem)
|
||||
}
|
||||
// <if expr="enable_ai_chat">
|
||||
const isOpenAIChatFromBraveSearchEnabled =
|
||||
loadTimeData.getBoolean('isOpenAIChatFromBraveSearchEnabled')
|
||||
|
||||
@@ -91,12 +91,6 @@ export default function addBraveRoutes(r: Partial<SettingsRoutes>) {
|
||||
r.SITE_SETTINGS_GOOGLE_SIGN_IN =
|
||||
r.SITE_SETTINGS.createChild('googleSignIn')
|
||||
}
|
||||
const isLocalhostAccessFeatureEnabled =
|
||||
loadTimeData.getBoolean('isLocalhostAccessFeatureEnabled')
|
||||
if (isLocalhostAccessFeatureEnabled) {
|
||||
r.SITE_SETTINGS_LOCALHOST_ACCESS = r.SITE_SETTINGS
|
||||
.createChild('localhostAccess')
|
||||
}
|
||||
// <if expr="enable_ai_chat">
|
||||
const isOpenAIChatFromBraveSearchEnabled =
|
||||
loadTimeData.getBoolean('isOpenAIChatFromBraveSearchEnabled')
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
<!-- Copyright (c) 2025 The Brave Authors. All rights reserved.
|
||||
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 https://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<settings-subpage page-title="$i18n{siteSettingsLocalhostAccess}">
|
||||
<settings-category-default-radio-group id="localhostAccessDefault"
|
||||
category="[[contentSettingsTypesEnum_.LOCALHOST_ACCESS]]"
|
||||
block-option-label="$i18n{siteSettingsLocalhostAccessBlock}"
|
||||
allow-option-label="$i18n{siteSettingsLocalhostAccessAsk}" allow-option-icon="smartphone-desktop"
|
||||
block-option-icon="smartphone-desktop-off">
|
||||
</settings-category-default-radio-group>
|
||||
<category-setting-exceptions id="localhostExceptions" category="[[contentSettingsTypesEnum_.LOCALHOST_ACCESS]]"
|
||||
block-header="$i18n{siteSettingsLocalhostAccessBlockExceptions}"
|
||||
allow-header="$i18n{siteSettingsLocalhostAccessAllowExceptions}">
|
||||
</category-setting-exceptions>
|
||||
</settings-subpage>
|
||||
@@ -1,46 +0,0 @@
|
||||
// Copyright (c) 2025 The Brave Authors. All rights reserved.
|
||||
// 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 https://mozilla.org/MPL/2.0/.
|
||||
|
||||
import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
|
||||
|
||||
import {SettingsViewMixin} from '../settings_page/settings_view_mixin.js';
|
||||
import {ChooserType, ContentSettingsTypes} from '../site_settings/constants.js';
|
||||
|
||||
import {getTemplate} from './site_settings_localhost.html.js';
|
||||
|
||||
const SiteSettingsLocalhostPageBase = SettingsViewMixin(PolymerElement);
|
||||
|
||||
export class SiteSettingsLocalhostPage extends SiteSettingsLocalhostPageBase {
|
||||
static get is() {
|
||||
return 'site-settings-localhost-page';
|
||||
}
|
||||
|
||||
static get template() {
|
||||
return getTemplate();
|
||||
}
|
||||
|
||||
static get properties() {
|
||||
return {
|
||||
// Expose ContentSettingsTypes enum to the HTML template.
|
||||
contentSettingsTypesEnum_: {
|
||||
type: Object,
|
||||
value: ContentSettingsTypes,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
// SettingsViewMixin implementation.
|
||||
override focusBackButton() {
|
||||
this.shadowRoot!.querySelector('settings-subpage')!.focusBackButton();
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
'site-settings-localhost-page': SiteSettingsLocalhostPage;
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define(SiteSettingsLocalhostPage.is, SiteSettingsLocalhostPage);
|
||||
@@ -60,7 +60,6 @@ brave_settings_web_component_files = [
|
||||
"getting_started_page/getting_started_page_index.ts",
|
||||
"site_settings/site_settings_autoplay.ts",
|
||||
"site_settings/site_settings_brave_ai.ts",
|
||||
"site_settings/site_settings_localhost.ts",
|
||||
"site_settings/site_settings_google.ts",
|
||||
"site_settings/site_settings_shields.ts",
|
||||
"social_blocking_page/social_blocking_page.ts",
|
||||
|
||||
@@ -688,20 +688,6 @@ This file contains all "about" strings. It is set to NOT be translated, in tran
|
||||
<message name="IDS_WEBSITE_SETTINGS_GOOGLE_SIGN_IN_ALLOW_EXCEPTIONS" desc="Label for G sign-in site settings.">
|
||||
Allowed to use third-party cookies for legacy Google Sign-In
|
||||
</message>
|
||||
<!-- LOCALHOST SIGN IN SITE SETTING -->
|
||||
<message name="IDS_LOCALHOST_TITLE" desc="Label for localhost site settings.">
|
||||
Localhost access
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_CATEGORY_LOCALHOST_ASK" desc="Label for localhost site settings.">
|
||||
Sites can request access to localhost resources
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_CATEGORY_LOCALHOST_BLOCK" desc="Label for localhost site settings.">
|
||||
Don't allow access to localhost resources
|
||||
</message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_LOCALHOST_ALLOW_EXCEPTIONS" desc="Label for localhost site settings.">
|
||||
Allowed to access localhost resources
|
||||
</message>
|
||||
|
||||
<message name="IDS_PREFS_SECTION_BRAVE_SHIELDS_GLOBALS" desc="Title for Brave shields global defaults section in the privacy preferences screen">
|
||||
Brave shields global defaults
|
||||
</message>
|
||||
|
||||
@@ -127,10 +127,6 @@ void BravePrivacyHandler::AddLoadTimeData(content::WebUIDataSource* data_source,
|
||||
data_source->AddBoolean(
|
||||
"isGoogleSignInFeatureEnabled",
|
||||
google_sign_in_permission::IsGoogleSignInFeatureEnabled());
|
||||
data_source->AddBoolean(
|
||||
"isLocalhostAccessFeatureEnabled",
|
||||
base::FeatureList::IsEnabled(
|
||||
brave_shields::features::kBraveLocalhostAccessPermission));
|
||||
#if BUILDFLAG(ENABLE_AI_CHAT)
|
||||
data_source->AddBoolean(
|
||||
"isOpenAIChatFromBraveSearchEnabled",
|
||||
|
||||
@@ -171,18 +171,6 @@ void BraveAddCommonStrings(content::WebUIDataSource* html_source,
|
||||
{"siteSettingsBraveOpenAIChatBlock",
|
||||
IDS_SETTINGS_SITE_SETTINGS_BRAVE_OPEN_AI_CHAT_BLOCK},
|
||||
|
||||
{"siteSettingsLocalhostAccess",
|
||||
IDS_SETTINGS_SITE_SETTINGS_LOCALHOST_ACCESS},
|
||||
{"siteSettingsCategoryLocalhostAccess",
|
||||
IDS_SETTINGS_SITE_SETTINGS_LOCALHOST_ACCESS},
|
||||
{"siteSettingsLocalhostAccessAsk",
|
||||
IDS_SETTINGS_SITE_SETTINGS_LOCALHOST_ACCESS_ASK},
|
||||
{"siteSettingsLocalhostAccessBlock",
|
||||
IDS_SETTINGS_SITE_SETTINGS_LOCALHOST_ACCESS_BLOCK},
|
||||
{"siteSettingsLocalhostAccessBlockExceptions",
|
||||
IDS_SETTINGS_SITE_SETTINGS_LOCALHOST_ACCESS_BLOCK_EXCEPTIONS},
|
||||
{"siteSettingsLocalhostAccessAllowExceptions",
|
||||
IDS_SETTINGS_SITE_SETTINGS_LOCALHOST_ACCESS_ALLOW_EXCEPTIONS},
|
||||
{"braveGetStartedTitle", IDS_SETTINGS_BRAVE_GET_STARTED_TITLE},
|
||||
{"braveOriginTitle", IDS_SETTINGS_BRAVE_ORIGIN_TITLE},
|
||||
{"braveOriginHeadingTitle", IDS_SETTINGS_BRAVE_ORIGIN_HEADING_TITLE},
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
case PermissionType::BRAVE_SPEEDREADER: \
|
||||
BRAVE_WALLET_PERMISSION_TYPES \
|
||||
case PermissionType::BRAVE_GOOGLE_SIGN_IN: \
|
||||
case PermissionType::BRAVE_LOCALHOST_ACCESS: \
|
||||
case PermissionType::BRAVE_OPEN_AI_CHAT: \
|
||||
case PermissionType::NUM
|
||||
|
||||
|
||||
@@ -79,7 +79,6 @@
|
||||
&google_sign_in_permission::features::kBraveGoogleSignInPermission, \
|
||||
&net::features::kBraveForgetFirstPartyStorage, \
|
||||
&brave_shields::features::kBraveShowStrictFingerprintingMode, \
|
||||
&brave_shields::features::kBraveLocalhostAccessPermission, \
|
||||
&brave_shields::features::kBlockAllCookiesToggle, \
|
||||
&brave_shields::features::kBraveShieldsElementPicker, \
|
||||
&features::kBraveAndroidDynamicColors, \
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include "brave/components/brave_wallet/common/buildflags/buildflags.h"
|
||||
#include "brave/components/permissions/brave_permission_manager.h"
|
||||
#include "brave/components/permissions/contexts/brave_google_sign_in_permission_context.h"
|
||||
#include "brave/components/permissions/contexts/brave_localhost_permission_context.h"
|
||||
#include "brave/components/permissions/contexts/brave_open_ai_chat_permission_context.h"
|
||||
#include "brave/components/permissions/permission_lifetime_manager.h"
|
||||
#include "components/permissions/features.h"
|
||||
@@ -50,8 +49,6 @@ PermissionManagerFactory::BuildServiceInstanceForBrowserContext(
|
||||
permission_contexts[ContentSettingsType::BRAVE_GOOGLE_SIGN_IN] =
|
||||
std::make_unique<permissions::BraveGoogleSignInPermissionContext>(
|
||||
profile);
|
||||
permission_contexts[ContentSettingsType::BRAVE_LOCALHOST_ACCESS] =
|
||||
std::make_unique<permissions::BraveLocalhostPermissionContext>(profile);
|
||||
permission_contexts[ContentSettingsType::BRAVE_OPEN_AI_CHAT] =
|
||||
std::make_unique<permissions::BraveOpenAIChatPermissionContext>(profile);
|
||||
|
||||
|
||||
@@ -50,7 +50,6 @@
|
||||
{ContentSettingsType::BRAVE_GOOGLE_SIGN_IN, "googleSignIn"}, \
|
||||
{ContentSettingsType::BRAVE_HTTPS_UPGRADE, nullptr}, \
|
||||
{ContentSettingsType::BRAVE_REMEMBER_1P_STORAGE, nullptr}, \
|
||||
{ContentSettingsType::BRAVE_LOCALHOST_ACCESS, "localhostAccess"}, \
|
||||
{ContentSettingsType::BRAVE_OPEN_AI_CHAT, "braveOpenAIChat"}, \
|
||||
{ContentSettingsType::BRAVE_AUTO_SHRED, nullptr}, \
|
||||
{ContentSettingsType::BRAVE_WEBCOMPAT_NONE, nullptr}, \
|
||||
@@ -134,9 +133,6 @@ bool HasRegisteredGroupName(ContentSettingsType type) {
|
||||
if (type == ContentSettingsType::BRAVE_GOOGLE_SIGN_IN) {
|
||||
return true;
|
||||
}
|
||||
if (type == ContentSettingsType::BRAVE_LOCALHOST_ACCESS) {
|
||||
return true;
|
||||
}
|
||||
#if BUILDFLAG(ENABLE_BRAVE_WALLET)
|
||||
if (type == ContentSettingsType::BRAVE_ETHEREUM) {
|
||||
return true;
|
||||
@@ -162,7 +158,6 @@ std::vector<ContentSettingsType> GetVisiblePermissionCategories(
|
||||
// Add Brave-specific content settings types
|
||||
types.push_back(ContentSettingsType::AUTOPLAY);
|
||||
types.push_back(ContentSettingsType::BRAVE_GOOGLE_SIGN_IN);
|
||||
types.push_back(ContentSettingsType::BRAVE_LOCALHOST_ACCESS);
|
||||
types.push_back(ContentSettingsType::BRAVE_OPEN_AI_CHAT);
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_WALLET)
|
||||
|
||||
+2
-3
@@ -18,9 +18,8 @@
|
||||
case ContentSettingsType::BACKGROUND_SYNC
|
||||
|
||||
// Default is ASK
|
||||
#define CLIPBOARD_READ_WRITE \
|
||||
BRAVE_GOOGLE_SIGN_IN: \
|
||||
case ContentSettingsType::BRAVE_LOCALHOST_ACCESS: \
|
||||
#define CLIPBOARD_READ_WRITE \
|
||||
BRAVE_GOOGLE_SIGN_IN: \
|
||||
case ContentSettingsType::CLIPBOARD_READ_WRITE
|
||||
|
||||
#define JNI_WebsitePreferenceBridge_ClearCookieData \
|
||||
|
||||
@@ -242,19 +242,6 @@ void ContentSettingsRegistry::BraveInit() {
|
||||
ContentSettingsInfo::INHERIT_IN_INCOGNITO,
|
||||
PermissionSettingsInfo::EXCEPTIONS_ON_SECURE_AND_INSECURE_ORIGINS);
|
||||
|
||||
// Register localhost permission default value as Ask.
|
||||
Register(ContentSettingsType::BRAVE_LOCALHOST_ACCESS,
|
||||
"brave_localhost_access", CONTENT_SETTING_ASK,
|
||||
WebsiteSettingsInfo::UNSYNCABLE,
|
||||
/*allowlisted_schemes=*/{},
|
||||
/*valid_settings=*/
|
||||
{CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK, CONTENT_SETTING_ASK},
|
||||
WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE,
|
||||
WebsiteSettingsRegistry::DESKTOP |
|
||||
WebsiteSettingsRegistry::PLATFORM_ANDROID,
|
||||
ContentSettingsInfo::INHERIT_IF_LESS_PERMISSIVE,
|
||||
PermissionSettingsInfo::EXCEPTIONS_ON_SECURE_AND_INSECURE_ORIGINS);
|
||||
|
||||
// Register AI chat permission default value as Ask.
|
||||
Register(ContentSettingsType::BRAVE_OPEN_AI_CHAT, "brave_open_ai_chat",
|
||||
CONTENT_SETTING_ASK, WebsiteSettingsInfo::UNSYNCABLE,
|
||||
|
||||
@@ -44,7 +44,6 @@ static_assert(static_cast<int>(ContentSettingsType::kMaxValue) <
|
||||
{ContentSettingsType::BRAVE_GOOGLE_SIGN_IN, brave_value(11)}, \
|
||||
{ContentSettingsType::BRAVE_HTTPS_UPGRADE, brave_value(12)}, \
|
||||
{ContentSettingsType::BRAVE_REMEMBER_1P_STORAGE, brave_value(13)}, \
|
||||
{ContentSettingsType::BRAVE_LOCALHOST_ACCESS, brave_value(14)}, \
|
||||
{ContentSettingsType::BRAVE_OPEN_AI_CHAT, brave_value(15)}, \
|
||||
{ContentSettingsType::BRAVE_AUTO_SHRED, brave_value(16)}, \
|
||||
/* Begin webcompat items */ \
|
||||
|
||||
@@ -39,7 +39,6 @@ bool RendererContentSettingRules::IsRendererContentSetting(
|
||||
content_type == ContentSettingsType::BRAVE_COSMETIC_FILTERING ||
|
||||
content_type == ContentSettingsType::BRAVE_FINGERPRINTING_V2 ||
|
||||
content_type == ContentSettingsType::BRAVE_GOOGLE_SIGN_IN ||
|
||||
content_type == ContentSettingsType::BRAVE_LOCALHOST_ACCESS ||
|
||||
content_type == ContentSettingsType::BRAVE_SHIELDS;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ enum ContentSettingsType {
|
||||
BRAVE_GOOGLE_SIGN_IN,
|
||||
BRAVE_HTTPS_UPGRADE,
|
||||
BRAVE_REMEMBER_1P_STORAGE,
|
||||
BRAVE_LOCALHOST_ACCESS,
|
||||
// Allow a site to open AI Chat (in side panel on Desktop).
|
||||
// This is limited to Brave Search only.
|
||||
BRAVE_OPEN_AI_CHAT,
|
||||
|
||||
@@ -45,9 +45,6 @@
|
||||
case RequestType::kBraveGoogleSignInPermission: \
|
||||
message_id = IDS_GOOGLE_SIGN_IN_PERMISSION_FRAGMENT; \
|
||||
break; \
|
||||
case RequestType::kBraveLocalhostAccessPermission: \
|
||||
message_id = IDS_LOCALHOST_ACCESS_PERMISSION_FRAGMENT; \
|
||||
break; \
|
||||
case RequestType::kBraveOpenAIChat: \
|
||||
message_id = IDS_OPEN_AI_CHAT_PERMISSION_FRAGMENT; \
|
||||
break;
|
||||
@@ -57,9 +54,6 @@
|
||||
case RequestType::kBraveGoogleSignInPermission: \
|
||||
message_id = IDS_GOOGLE_SIGN_IN_INFOBAR_TEXT; \
|
||||
break; \
|
||||
case RequestType::kBraveLocalhostAccessPermission: \
|
||||
message_id = IDS_LOCALHOST_ACCESS_INFOBAR_TEXT; \
|
||||
break; \
|
||||
case RequestType::kBraveOpenAIChat: \
|
||||
message_id = IDS_OPEN_AI_CHAT_INFOBAR_TEXT; \
|
||||
break;
|
||||
|
||||
@@ -25,8 +25,6 @@ std::optional<RequestType> ContentSettingsTypeToRequestTypeIfExists_BraveImpl(
|
||||
#endif
|
||||
case ContentSettingsType::BRAVE_GOOGLE_SIGN_IN:
|
||||
return RequestType::kBraveGoogleSignInPermission;
|
||||
case ContentSettingsType::BRAVE_LOCALHOST_ACCESS:
|
||||
return RequestType::kBraveLocalhostAccessPermission;
|
||||
case ContentSettingsType::BRAVE_OPEN_AI_CHAT:
|
||||
return RequestType::kBraveOpenAIChat;
|
||||
default:
|
||||
|
||||
@@ -17,12 +17,11 @@
|
||||
case RequestType::kBraveCardano:
|
||||
|
||||
// Since we don't do UMA just reuse an existing UMA type instead of adding one.
|
||||
#define BRAVE_GET_UMA_VALUE_FOR_REQUEST_TYPE \
|
||||
case RequestType::kWidevine: \
|
||||
BRAVE_WALLET_UMA_CASES \
|
||||
case RequestType::kBraveGoogleSignInPermission: \
|
||||
case RequestType::kBraveLocalhostAccessPermission: \
|
||||
case RequestType::kBraveOpenAIChat: \
|
||||
#define BRAVE_GET_UMA_VALUE_FOR_REQUEST_TYPE \
|
||||
case RequestType::kWidevine: \
|
||||
BRAVE_WALLET_UMA_CASES \
|
||||
case RequestType::kBraveGoogleSignInPermission: \
|
||||
case RequestType::kBraveOpenAIChat: \
|
||||
return RequestTypeForUma::PERMISSION_VR;
|
||||
|
||||
// These requests may be batched together, so we must handle them explicitly as
|
||||
@@ -69,8 +68,6 @@
|
||||
return ContentSettingsType::BRAVE_SPEEDREADER; \
|
||||
case PermissionType::BRAVE_GOOGLE_SIGN_IN: \
|
||||
return ContentSettingsType::BRAVE_GOOGLE_SIGN_IN; \
|
||||
case PermissionType::BRAVE_LOCALHOST_ACCESS: \
|
||||
return ContentSettingsType::BRAVE_LOCALHOST_ACCESS; \
|
||||
case PermissionType::BRAVE_OPEN_AI_CHAT: \
|
||||
return ContentSettingsType::BRAVE_OPEN_AI_CHAT; \
|
||||
BRAVE_WALLET_PERMISSION_TYPE_CASES
|
||||
@@ -99,8 +96,6 @@ std::string PermissionUtil::GetPermissionString(
|
||||
#endif
|
||||
case ContentSettingsType::BRAVE_GOOGLE_SIGN_IN:
|
||||
return "BraveGoogleSignInPermission";
|
||||
case ContentSettingsType::BRAVE_LOCALHOST_ACCESS:
|
||||
return "BraveLocalhostAccessPermission";
|
||||
case ContentSettingsType::BRAVE_OPEN_AI_CHAT:
|
||||
return "BraveOpenAIChatPermission";
|
||||
default:
|
||||
@@ -123,10 +118,6 @@ bool PermissionUtil::GetPermissionType(ContentSettingsType type,
|
||||
*out = PermissionType::BRAVE_GOOGLE_SIGN_IN;
|
||||
return true;
|
||||
}
|
||||
if (type == ContentSettingsType::BRAVE_LOCALHOST_ACCESS) {
|
||||
*out = PermissionType::BRAVE_LOCALHOST_ACCESS;
|
||||
return true;
|
||||
}
|
||||
if (type == ContentSettingsType::BRAVE_OPEN_AI_CHAT) {
|
||||
*out = PermissionType::BRAVE_OPEN_AI_CHAT;
|
||||
return true;
|
||||
@@ -145,7 +136,6 @@ bool PermissionUtil::IsPermission(ContentSettingsType type) {
|
||||
return true;
|
||||
#endif
|
||||
case ContentSettingsType::BRAVE_GOOGLE_SIGN_IN:
|
||||
case ContentSettingsType::BRAVE_LOCALHOST_ACCESS:
|
||||
case ContentSettingsType::BRAVE_OPEN_AI_CHAT:
|
||||
return true;
|
||||
default:
|
||||
@@ -182,8 +172,6 @@ PermissionType PermissionUtil::ContentSettingsTypeToPermissionType(
|
||||
#endif
|
||||
case ContentSettingsType::BRAVE_GOOGLE_SIGN_IN:
|
||||
return PermissionType::BRAVE_GOOGLE_SIGN_IN;
|
||||
case ContentSettingsType::BRAVE_LOCALHOST_ACCESS:
|
||||
return PermissionType::BRAVE_LOCALHOST_ACCESS;
|
||||
case ContentSettingsType::BRAVE_OPEN_AI_CHAT:
|
||||
return PermissionType::BRAVE_OPEN_AI_CHAT;
|
||||
default:
|
||||
|
||||
@@ -31,13 +31,12 @@ constexpr auto kAndroidStorageAccess = IDR_ANDROID_STORAGE_ACCESS;
|
||||
case RequestType::kBraveSolana: \
|
||||
case RequestType::kBraveCardano:
|
||||
|
||||
#define IDR_ANDROID_STORAGE_ACCESS \
|
||||
kAndroidStorageAccess; \
|
||||
case RequestType::kWidevine: \
|
||||
BRAVE_WALLET_ANDROID_CASES \
|
||||
case RequestType::kBraveGoogleSignInPermission: \
|
||||
case RequestType::kBraveLocalhostAccessPermission: \
|
||||
case RequestType::kBraveOpenAIChat: \
|
||||
#define IDR_ANDROID_STORAGE_ACCESS \
|
||||
kAndroidStorageAccess; \
|
||||
case RequestType::kWidevine: \
|
||||
BRAVE_WALLET_ANDROID_CASES \
|
||||
case RequestType::kBraveGoogleSignInPermission: \
|
||||
case RequestType::kBraveOpenAIChat: \
|
||||
return IDR_ANDROID_INFOBAR_PERMISSION_COOKIE
|
||||
|
||||
// Add Brave cases into GetIconIdDesktop.
|
||||
@@ -46,13 +45,12 @@ constexpr auto kAndroidStorageAccess = IDR_ANDROID_STORAGE_ACCESS;
|
||||
case RequestType::kBraveSolana: \
|
||||
case RequestType::kBraveCardano:
|
||||
|
||||
#define kStorageAccessIcon \
|
||||
kStorageAccessIcon; \
|
||||
case RequestType::kWidevine: \
|
||||
BRAVE_WALLET_DESKTOP_CASES \
|
||||
case RequestType::kBraveGoogleSignInPermission: \
|
||||
case RequestType::kBraveLocalhostAccessPermission: \
|
||||
case RequestType::kBraveOpenAIChat: \
|
||||
#define kStorageAccessIcon \
|
||||
kStorageAccessIcon; \
|
||||
case RequestType::kWidevine: \
|
||||
BRAVE_WALLET_DESKTOP_CASES \
|
||||
case RequestType::kBraveGoogleSignInPermission: \
|
||||
case RequestType::kBraveOpenAIChat: \
|
||||
return vector_icons::kExtensionIcon
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_WALLET)
|
||||
@@ -71,15 +69,13 @@ constexpr auto kAndroidStorageAccess = IDR_ANDROID_STORAGE_ACCESS;
|
||||
NOTREACHED();
|
||||
#endif
|
||||
|
||||
#define BRAVE_PERMISSION_KEY_FOR_REQUEST_TYPE \
|
||||
case permissions::RequestType::kWidevine: \
|
||||
return "widevine"; \
|
||||
BRAVE_WALLET_PERMISSION_KEYS \
|
||||
case permissions::RequestType::kBraveGoogleSignInPermission: \
|
||||
return "brave_google_sign_in"; \
|
||||
case permissions::RequestType::kBraveLocalhostAccessPermission: \
|
||||
return "brave_localhost_access"; \
|
||||
case permissions::RequestType::kBraveOpenAIChat: \
|
||||
#define BRAVE_PERMISSION_KEY_FOR_REQUEST_TYPE \
|
||||
case permissions::RequestType::kWidevine: \
|
||||
return "widevine"; \
|
||||
BRAVE_WALLET_PERMISSION_KEYS \
|
||||
case permissions::RequestType::kBraveGoogleSignInPermission: \
|
||||
return "brave_google_sign_in"; \
|
||||
case permissions::RequestType::kBraveOpenAIChat: \
|
||||
return "brave_ai_chat";
|
||||
|
||||
#define ContentSettingsTypeToRequestType \
|
||||
@@ -117,8 +113,6 @@ RequestType ContentSettingsTypeToRequestType(
|
||||
#endif
|
||||
case ContentSettingsType::BRAVE_GOOGLE_SIGN_IN:
|
||||
return RequestType::kBraveGoogleSignInPermission;
|
||||
case ContentSettingsType::BRAVE_LOCALHOST_ACCESS:
|
||||
return RequestType::kBraveLocalhostAccessPermission;
|
||||
case ContentSettingsType::BRAVE_OPEN_AI_CHAT:
|
||||
return RequestType::kBraveOpenAIChat;
|
||||
case ContentSettingsType::DEFAULT:
|
||||
@@ -137,8 +131,6 @@ std::optional<ContentSettingsType> RequestTypeToContentSettingsType(
|
||||
switch (request_type) {
|
||||
case RequestType::kBraveGoogleSignInPermission:
|
||||
return ContentSettingsType::BRAVE_GOOGLE_SIGN_IN;
|
||||
case RequestType::kBraveLocalhostAccessPermission:
|
||||
return ContentSettingsType::BRAVE_LOCALHOST_ACCESS;
|
||||
#if BUILDFLAG(ENABLE_BRAVE_WALLET)
|
||||
case RequestType::kBraveEthereum:
|
||||
return ContentSettingsType::BRAVE_ETHEREUM;
|
||||
@@ -157,7 +149,6 @@ std::optional<ContentSettingsType> RequestTypeToContentSettingsType(
|
||||
bool IsRequestablePermissionType(ContentSettingsType content_settings_type) {
|
||||
switch (content_settings_type) {
|
||||
case ContentSettingsType::BRAVE_GOOGLE_SIGN_IN:
|
||||
case ContentSettingsType::BRAVE_LOCALHOST_ACCESS:
|
||||
#if BUILDFLAG(ENABLE_BRAVE_WALLET)
|
||||
case ContentSettingsType::BRAVE_ETHEREUM:
|
||||
case ContentSettingsType::BRAVE_SOLANA:
|
||||
|
||||
@@ -8,9 +8,8 @@
|
||||
|
||||
#define kStorageAccess \
|
||||
kStorageAccess, kWidevine, kBraveEthereum, kBraveSolana, kBraveOpenAIChat, \
|
||||
kBraveGoogleSignInPermission, kBraveLocalhostAccessPermission, \
|
||||
kBraveCardano, kBraveMinValue = kWidevine, \
|
||||
kBraveMaxValue = kBraveCardano
|
||||
kBraveGoogleSignInPermission, kBraveCardano, \
|
||||
kBraveMinValue = kWidevine, kBraveMaxValue = kBraveCardano
|
||||
|
||||
#define ContentSettingsTypeToRequestType \
|
||||
ContentSettingsTypeToRequestType_ChromiumImpl
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
case PermissionType::BRAVE_ETHEREUM: \
|
||||
case PermissionType::BRAVE_SOLANA: \
|
||||
case PermissionType::BRAVE_GOOGLE_SIGN_IN: \
|
||||
case PermissionType::BRAVE_LOCALHOST_ACCESS: \
|
||||
case PermissionType::BRAVE_OPEN_AI_CHAT: \
|
||||
case PermissionType::BRAVE_CARDANO: \
|
||||
case PermissionType::NUM
|
||||
|
||||
@@ -54,9 +54,6 @@
|
||||
case blink::PermissionType::BRAVE_GOOGLE_SIGN_IN: \
|
||||
return CreatePermissionDescriptor( \
|
||||
blink::mojom::PermissionName::BRAVE_GOOGLE_SIGN_IN); \
|
||||
case blink::PermissionType::BRAVE_LOCALHOST_ACCESS: \
|
||||
return CreatePermissionDescriptor( \
|
||||
blink::mojom::PermissionName::BRAVE_LOCALHOST_ACCESS); \
|
||||
case blink::PermissionType::BRAVE_OPEN_AI_CHAT: \
|
||||
return CreatePermissionDescriptor( \
|
||||
blink::mojom::PermissionName::BRAVE_OPEN_AI_CHAT); \
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
case PermissionType::BRAVE_SOLANA: \
|
||||
case PermissionType::BRAVE_CARDANO: \
|
||||
case PermissionType::BRAVE_GOOGLE_SIGN_IN: \
|
||||
case PermissionType::BRAVE_LOCALHOST_ACCESS: \
|
||||
case PermissionType::BRAVE_OPEN_AI_CHAT: \
|
||||
case PermissionType::NUM
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace network::features {
|
||||
OVERRIDE_FEATURE_DEFAULT_STATES({{
|
||||
{kBrowsingTopics, base::FEATURE_DISABLED_BY_DEFAULT},
|
||||
{kInterestGroupStorage, base::FEATURE_DISABLED_BY_DEFAULT},
|
||||
{kLocalNetworkAccessChecks, base::FEATURE_DISABLED_BY_DEFAULT},
|
||||
{kLocalNetworkAccessChecksWebSockets, base::FEATURE_ENABLED_BY_DEFAULT},
|
||||
{kSharedStorageAPI, base::FEATURE_DISABLED_BY_DEFAULT},
|
||||
}});
|
||||
|
||||
|
||||
@@ -43,8 +43,6 @@
|
||||
return "BraveSpeedreaders"; \
|
||||
case PermissionType::BRAVE_GOOGLE_SIGN_IN: \
|
||||
return "BraveGoogleSignInPermission"; \
|
||||
case PermissionType::BRAVE_LOCALHOST_ACCESS: \
|
||||
return "BraveLocalhostAccessPermission"; \
|
||||
case PermissionType::BRAVE_OPEN_AI_CHAT: \
|
||||
return "BraveOpenAIChatPermission"; \
|
||||
BRAVE_WALLET_PERMISSION_UTIL_GET_PERMISSION_STRING
|
||||
@@ -77,7 +75,6 @@
|
||||
case PermissionType::BRAVE_COOKIES: \
|
||||
case PermissionType::BRAVE_SPEEDREADER: \
|
||||
case PermissionType::BRAVE_GOOGLE_SIGN_IN: \
|
||||
case PermissionType::BRAVE_LOCALHOST_ACCESS: \
|
||||
case PermissionType::BRAVE_OPEN_AI_CHAT: \
|
||||
return std::nullopt
|
||||
|
||||
@@ -117,8 +114,6 @@
|
||||
return PermissionType::BRAVE_SPEEDREADER; \
|
||||
case PermissionName::BRAVE_GOOGLE_SIGN_IN: \
|
||||
return PermissionType::BRAVE_GOOGLE_SIGN_IN; \
|
||||
case PermissionName::BRAVE_LOCALHOST_ACCESS: \
|
||||
return PermissionType::BRAVE_LOCALHOST_ACCESS; \
|
||||
case PermissionName::BRAVE_OPEN_AI_CHAT: \
|
||||
return PermissionType::BRAVE_OPEN_AI_CHAT;
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
BRAVE_ETHEREUM, \
|
||||
BRAVE_SOLANA, \
|
||||
BRAVE_GOOGLE_SIGN_IN, \
|
||||
BRAVE_LOCALHOST_ACCESS, \
|
||||
BRAVE_OPEN_AI_CHAT, \
|
||||
BRAVE_CARDANO, \
|
||||
NUM
|
||||
|
||||
@@ -18,7 +18,6 @@ enum PermissionName {
|
||||
BRAVE_ETHEREUM,
|
||||
BRAVE_SOLANA,
|
||||
BRAVE_GOOGLE_SIGN_IN,
|
||||
BRAVE_LOCALHOST_ACCESS,
|
||||
BRAVE_OPEN_AI_CHAT,
|
||||
BRAVE_CARDANO,
|
||||
};
|
||||
|
||||
-2
@@ -44,8 +44,6 @@
|
||||
BRAVE_WALLET_WEB_PRINTING_CASES \
|
||||
case PermissionName::BRAVE_GOOGLE_SIGN_IN: \
|
||||
return "brave_google_sign_in"; \
|
||||
case PermissionName::BRAVE_LOCALHOST_ACCESS: \
|
||||
return "brave_localhost_access"; \
|
||||
case PermissionName::BRAVE_OPEN_AI_CHAT: \
|
||||
return "brave_open_ai_chat"; \
|
||||
case PermissionName::WEB_PRINTING
|
||||
|
||||
@@ -9,19 +9,13 @@
|
||||
#include <vector>
|
||||
|
||||
#include "base/task/single_thread_task_runner.h"
|
||||
#include "brave/components/brave_shields/core/browser/ad_block_filters_provider_manager.h"
|
||||
#include "components/prefs/pref_service.h"
|
||||
#include "brave/components/brave_component_updater/browser/dat_file_util.h"
|
||||
|
||||
namespace brave_shields {
|
||||
|
||||
namespace {
|
||||
|
||||
void AddDATBufferToFilterSet(DATFileDataBuffer buffer,
|
||||
rust::Box<adblock::FilterSet>* filter_set) {
|
||||
(*filter_set)->add_filter_list(buffer);
|
||||
}
|
||||
|
||||
constexpr char kLocalhostBadfilters[] = R"(
|
||||
constexpr uint8_t kLocalhostBadfilters[] = R"(
|
||||
||0.0.0.0^$third-party,domain=~[::]|~[::ffff:0:0],badfilter
|
||||
||[::]^$third-party,domain=~0.0.0.0|~[::ffff:0:0],badfilter
|
||||
||[::ffff:0:0]^$third-party,domain=~0.0.0.0|~[::],badfilter
|
||||
@@ -31,6 +25,12 @@ constexpr char kLocalhostBadfilters[] = R"(
|
||||
||[::ffff:7f00:1]^$third-party,domain=~localhost|~127.0.0.1|~[::1],badfilter
|
||||
)";
|
||||
|
||||
void AddDATBufferToFilterSet(rust::Box<adblock::FilterSet>* filter_set) {
|
||||
(*filter_set)
|
||||
->add_filter_list(std::vector<uint8_t>(std::begin(kLocalhostBadfilters),
|
||||
std::end(kLocalhostBadfilters)));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
AdBlockLocalhostFiltersProvider::AdBlockLocalhostFiltersProvider(
|
||||
@@ -39,7 +39,7 @@ AdBlockLocalhostFiltersProvider::AdBlockLocalhostFiltersProvider(
|
||||
NotifyObservers(engine_is_default_);
|
||||
}
|
||||
|
||||
AdBlockLocalhostFiltersProvider::~AdBlockLocalhostFiltersProvider() {}
|
||||
AdBlockLocalhostFiltersProvider::~AdBlockLocalhostFiltersProvider() = default;
|
||||
|
||||
std::string AdBlockLocalhostFiltersProvider::GetNameForDebugging() {
|
||||
return "AdBlockLocalhostFiltersProvider";
|
||||
@@ -50,14 +50,10 @@ void AdBlockLocalhostFiltersProvider::LoadFilterSet(
|
||||
void(base::OnceCallback<void(rust::Box<adblock::FilterSet>*)>)> cb) {
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
|
||||
auto buffer = std::vector<unsigned char>(std::begin(kLocalhostBadfilters),
|
||||
std::end(kLocalhostBadfilters));
|
||||
|
||||
// PostTask so this has an async return to match other loaders
|
||||
base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask(
|
||||
FROM_HERE,
|
||||
base::BindOnce(std::move(cb),
|
||||
base::BindOnce(&AddDATBufferToFilterSet, buffer)));
|
||||
base::BindOnce(std::move(cb), base::BindOnce(&AddDATBufferToFilterSet)));
|
||||
}
|
||||
|
||||
} // namespace brave_shields
|
||||
|
||||
@@ -9,16 +9,12 @@
|
||||
#include <string>
|
||||
|
||||
#include "base/functional/callback.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/sequence_checker.h"
|
||||
#include "brave/components/brave_component_updater/browser/dat_file_util.h"
|
||||
#include "brave/components/brave_shields/core/browser/ad_block_filters_provider.h"
|
||||
#include "brave/components/brave_shields/core/browser/ad_block_filters_provider_manager.h"
|
||||
#include "brave/components/brave_shields/core/browser/adblock/rs/src/lib.rs.h"
|
||||
#include "third_party/rust/cxx/v1/cxx.h"
|
||||
|
||||
using brave_component_updater::DATFileDataBuffer;
|
||||
|
||||
namespace brave_shields {
|
||||
|
||||
class AdBlockLocalhostFiltersProvider : public AdBlockFiltersProvider {
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "components/prefs/pref_registry_simple.h"
|
||||
#include "components/prefs/pref_service.h"
|
||||
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
|
||||
#include "services/network/public/cpp/features.h"
|
||||
#include "url/origin.h"
|
||||
|
||||
namespace brave_shields {
|
||||
@@ -357,7 +358,11 @@ AdBlockService::AdBlockService(
|
||||
local_state_, filters_provider_manager_.get());
|
||||
|
||||
if (base::FeatureList::IsEnabled(
|
||||
brave_shields::features::kBraveLocalhostAccessPermission)) {
|
||||
network::features::kLocalNetworkAccessChecks) &&
|
||||
!network::features::kLocalNetworkAccessChecksWarn.Get() &&
|
||||
base::FeatureList::IsEnabled(
|
||||
network::features::kLocalNetworkAccessChecksWebSockets)) {
|
||||
// If LNA enabled and blocks request
|
||||
localhost_filters_provider_ =
|
||||
std::make_unique<AdBlockLocalhostFiltersProvider>(
|
||||
filters_provider_manager_.get());
|
||||
|
||||
@@ -100,10 +100,6 @@ BASE_FEATURE(kBraveIOSEnableFarblingPlugins,
|
||||
// When enabled, show Strict (aggressive) fingerprinting mode in Brave Shields.
|
||||
BASE_FEATURE(kBraveShowStrictFingerprintingMode,
|
||||
base::FEATURE_DISABLED_BY_DEFAULT);
|
||||
// when enabled, brave will prompt for permission on sites which want to connect
|
||||
// to localhost.
|
||||
BASE_FEATURE(kBraveLocalhostAccessPermission,
|
||||
base::FEATURE_DISABLED_BY_DEFAULT);
|
||||
// When enabled, Brave will always report Light in Fingerprinting: Strict mode
|
||||
BASE_FEATURE(kBraveDarkModeBlock,
|
||||
base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
|
||||
@@ -32,7 +32,6 @@ BASE_DECLARE_FEATURE(kBraveDomainBlock);
|
||||
BASE_DECLARE_FEATURE(kBraveDomainBlock1PES);
|
||||
BASE_DECLARE_FEATURE(kBraveExtensionNetworkBlocking);
|
||||
BASE_DECLARE_FEATURE(kBraveFarbling);
|
||||
BASE_DECLARE_FEATURE(kBraveLocalhostAccessPermission);
|
||||
BASE_DECLARE_FEATURE(kBraveReduceLanguage);
|
||||
BASE_DECLARE_FEATURE(kBraveShredFeature);
|
||||
BASE_DECLARE_FEATURE(kBraveShredCacheData);
|
||||
|
||||
-3
@@ -12,9 +12,6 @@
|
||||
<org.chromium.components.browser_ui.settings.ChromeBasePreference
|
||||
android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings"
|
||||
android:key="brave_google_sign_in" />
|
||||
<org.chromium.components.browser_ui.settings.ChromeBasePreference
|
||||
android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings"
|
||||
android:key="brave_localhost_access" />
|
||||
<org.chromium.components.browser_ui.settings.ChromeBasePreference
|
||||
android:fragment="org.chromium.chrome.browser.site_settings.BraveWalletEthereumConnectedSites"
|
||||
android:key="ethereum_connected_sites"
|
||||
|
||||
-12
@@ -57,18 +57,6 @@ public class BraveContentSettingsResources extends ContentSettingsResources {
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
case ContentSettingsType.BRAVE_LOCALHOST_ACCESS:
|
||||
return new ResourceItem(
|
||||
R.drawable.ic_desktop_windows,
|
||||
R.string.localhost_title,
|
||||
ContentSetting.ASK,
|
||||
ContentSetting.BLOCK,
|
||||
R.string.website_settings_category_localhost_ask,
|
||||
R.string.website_settings_category_localhost_block,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
}
|
||||
|
||||
return (ResourceItem)
|
||||
|
||||
+1
-4
@@ -29,8 +29,6 @@ public class BraveSingleCategorySettings extends BaseSiteSettingsFragment
|
||||
resource = R.string.website_settings_add_site_description_autoplay;
|
||||
} else if (mCategory.getType() == SiteSettingsCategory.Type.BRAVE_GOOGLE_SIGN_IN) {
|
||||
resource = R.string.website_settings_google_sign_in_allow_exceptions;
|
||||
} else if (mCategory.getType() == SiteSettingsCategory.Type.BRAVE_LOCALHOST_ACCESS) {
|
||||
resource = R.string.website_settings_localhost_allow_exceptions;
|
||||
} else {
|
||||
return (int)
|
||||
BraveReflectionUtil.invokeMethod(
|
||||
@@ -51,8 +49,7 @@ public class BraveSingleCategorySettings extends BaseSiteSettingsFragment
|
||||
SingleCategorySettings.class, "mCategory", this);
|
||||
|
||||
if (mCategory.getType() == SiteSettingsCategory.Type.AUTOPLAY
|
||||
|| mCategory.getType() == SiteSettingsCategory.Type.BRAVE_GOOGLE_SIGN_IN
|
||||
|| mCategory.getType() == SiteSettingsCategory.Type.BRAVE_LOCALHOST_ACCESS) {
|
||||
|| mCategory.getType() == SiteSettingsCategory.Type.BRAVE_GOOGLE_SIGN_IN) {
|
||||
exception = true;
|
||||
}
|
||||
if (exception) {
|
||||
|
||||
-38
@@ -27,8 +27,6 @@ public class BraveSingleWebsiteSettings extends BaseSiteSettingsFragment {
|
||||
return "autoplay_permission_list";
|
||||
case ContentSettingsType.BRAVE_GOOGLE_SIGN_IN:
|
||||
return "brave_google_sign_in";
|
||||
case ContentSettingsType.BRAVE_LOCALHOST_ACCESS:
|
||||
return "brave_localhost_access";
|
||||
default:
|
||||
return (String)
|
||||
BraveReflectionUtil.invokeMethod(
|
||||
@@ -50,11 +48,6 @@ public class BraveSingleWebsiteSettings extends BaseSiteSettingsFragment {
|
||||
preference.setKey(getPreferenceKey(ContentSettingsType.BRAVE_GOOGLE_SIGN_IN));
|
||||
setUpGoogleSignInPreference(preference);
|
||||
|
||||
// Localhost
|
||||
preference = new ChromeSwitchPreference(getStyledContext());
|
||||
preference.setKey(getPreferenceKey(ContentSettingsType.BRAVE_LOCALHOST_ACCESS));
|
||||
setUpLocalhostPreference(preference);
|
||||
|
||||
// SingleWebsiteSettings.setupContentSettingsPreferences has its own for loop
|
||||
BraveReflectionUtil.invokeMethod(
|
||||
SingleWebsiteSettings.class, this, "setupContentSettingsPreferences");
|
||||
@@ -122,37 +115,6 @@ public class BraveSingleWebsiteSettings extends BaseSiteSettingsFragment {
|
||||
false);
|
||||
}
|
||||
|
||||
private void setUpLocalhostPreference(Preference preference) {
|
||||
BrowserContextHandle browserContextHandle =
|
||||
getSiteSettingsDelegate().getBrowserContextHandle();
|
||||
@Nullable
|
||||
Website mSite =
|
||||
(Website) BraveReflectionUtil.getField(SingleWebsiteSettings.class, "mSite", this);
|
||||
Integer currentValue =
|
||||
mSite.getContentSetting(
|
||||
browserContextHandle, ContentSettingsType.BRAVE_LOCALHOST_ACCESS);
|
||||
if (currentValue == null) {
|
||||
currentValue =
|
||||
WebsitePreferenceBridge.isCategoryEnabled(
|
||||
browserContextHandle,
|
||||
ContentSettingsType.BRAVE_LOCALHOST_ACCESS)
|
||||
? ContentSetting.ASK
|
||||
: ContentSetting.BLOCK;
|
||||
}
|
||||
BraveReflectionUtil.invokeMethod(
|
||||
SingleWebsiteSettings.class,
|
||||
this,
|
||||
"setupContentSettingsPreference",
|
||||
Preference.class,
|
||||
preference,
|
||||
Integer.class,
|
||||
currentValue,
|
||||
boolean.class,
|
||||
false,
|
||||
boolean.class,
|
||||
false);
|
||||
}
|
||||
|
||||
private Context getStyledContext() {
|
||||
return getPreferenceManager().getContext();
|
||||
}
|
||||
|
||||
-4
@@ -15,8 +15,6 @@ public class BraveSiteSettingsCategory {
|
||||
return ContentSettingsType.AUTOPLAY;
|
||||
case Type.BRAVE_GOOGLE_SIGN_IN:
|
||||
return ContentSettingsType.BRAVE_GOOGLE_SIGN_IN;
|
||||
case Type.BRAVE_LOCALHOST_ACCESS:
|
||||
return ContentSettingsType.BRAVE_LOCALHOST_ACCESS;
|
||||
default:
|
||||
return SiteSettingsCategory.contentSettingsType(type);
|
||||
}
|
||||
@@ -28,8 +26,6 @@ public class BraveSiteSettingsCategory {
|
||||
return "autoplay";
|
||||
case Type.BRAVE_GOOGLE_SIGN_IN:
|
||||
return "brave_google_sign_in";
|
||||
case Type.BRAVE_LOCALHOST_ACCESS:
|
||||
return "brave_localhost_access";
|
||||
default:
|
||||
return SiteSettingsCategory.preferenceKey(type);
|
||||
}
|
||||
|
||||
-21
@@ -73,27 +73,6 @@ public class BraveWebsite {
|
||||
ContentSettingException.class,
|
||||
exception);
|
||||
}
|
||||
} else if (type == ContentSettingsType.BRAVE_LOCALHOST_ACCESS) {
|
||||
if (exception == null) {
|
||||
exception =
|
||||
new ContentSettingException(
|
||||
ContentSettingsType.BRAVE_LOCALHOST_ACCESS,
|
||||
((WebsiteAddress)
|
||||
BraveReflectionUtil.invokeMethod(
|
||||
Website.class, this, "getAddress"))
|
||||
.getHost(),
|
||||
value,
|
||||
ProviderType.NONE,
|
||||
false);
|
||||
BraveReflectionUtil.invokeMethod(
|
||||
Website.class,
|
||||
this,
|
||||
"setContentSettingException",
|
||||
int.class,
|
||||
type,
|
||||
ContentSettingException.class,
|
||||
exception);
|
||||
}
|
||||
}
|
||||
|
||||
BraveReflectionUtil.invokeMethod(
|
||||
|
||||
-1
@@ -14,7 +14,6 @@ public class BraveWebsitePermissionsFetcher {
|
||||
switch (contentSettingsType) {
|
||||
case ContentSettingsType.AUTOPLAY:
|
||||
case ContentSettingsType.BRAVE_GOOGLE_SIGN_IN:
|
||||
case ContentSettingsType.BRAVE_LOCALHOST_ACCESS:
|
||||
return WebsitePermissionsType.CONTENT_SETTING_EXCEPTION;
|
||||
case ContentSettingsType.STORAGE_ACCESS:
|
||||
return null;
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
// Copyright (c) 2023 The Brave Authors. All rights reserved.
|
||||
// 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 https://mozilla.org/MPL/2.0/.
|
||||
|
||||
#include "brave/components/permissions/contexts/brave_localhost_permission_context.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "components/content_settings/browser/page_specific_content_settings.h"
|
||||
#include "components/content_settings/core/common/content_settings_types.h"
|
||||
#include "components/permissions/permission_request_id.h"
|
||||
|
||||
namespace permissions {
|
||||
|
||||
BraveLocalhostPermissionContext::BraveLocalhostPermissionContext(
|
||||
content::BrowserContext* browser_context)
|
||||
: ContentSettingPermissionContextBase(
|
||||
browser_context,
|
||||
ContentSettingsType::BRAVE_LOCALHOST_ACCESS,
|
||||
network::mojom::PermissionsPolicyFeature::kNotFound) {}
|
||||
|
||||
BraveLocalhostPermissionContext::~BraveLocalhostPermissionContext() = default;
|
||||
|
||||
bool BraveLocalhostPermissionContext::IsRestrictedToSecureOrigins() const {
|
||||
return false;
|
||||
}
|
||||
} // namespace permissions
|
||||
@@ -1,33 +0,0 @@
|
||||
// Copyright (c) 2023 The Brave Authors. All rights reserved.
|
||||
// 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 https://mozilla.org/MPL/2.0/.
|
||||
|
||||
#ifndef BRAVE_COMPONENTS_PERMISSIONS_CONTEXTS_BRAVE_LOCALHOST_PERMISSION_CONTEXT_H_
|
||||
#define BRAVE_COMPONENTS_PERMISSIONS_CONTEXTS_BRAVE_LOCALHOST_PERMISSION_CONTEXT_H_
|
||||
|
||||
#include "components/permissions/content_setting_permission_context_base.h"
|
||||
#include "content/public/browser/browser_context.h"
|
||||
|
||||
namespace permissions {
|
||||
|
||||
class BraveLocalhostPermissionContext
|
||||
: public ContentSettingPermissionContextBase {
|
||||
public:
|
||||
// using ContentSettingPermissionContextBase::RequestPermission;
|
||||
explicit BraveLocalhostPermissionContext(
|
||||
content::BrowserContext* browser_context);
|
||||
~BraveLocalhostPermissionContext() override;
|
||||
|
||||
BraveLocalhostPermissionContext(const BraveLocalhostPermissionContext&) =
|
||||
delete;
|
||||
BraveLocalhostPermissionContext& operator=(
|
||||
const BraveLocalhostPermissionContext&) = delete;
|
||||
|
||||
private:
|
||||
bool IsRestrictedToSecureOrigins() const override;
|
||||
};
|
||||
|
||||
} // namespace permissions
|
||||
|
||||
#endif // BRAVE_COMPONENTS_PERMISSIONS_CONTEXTS_BRAVE_LOCALHOST_PERMISSION_CONTEXT_H_
|
||||
@@ -11,8 +11,6 @@ brave_components_permissions_sources = [
|
||||
"//brave/components/permissions/brave_permission_manager.h",
|
||||
"//brave/components/permissions/contexts/brave_google_sign_in_permission_context.cc",
|
||||
"//brave/components/permissions/contexts/brave_google_sign_in_permission_context.h",
|
||||
"//brave/components/permissions/contexts/brave_localhost_permission_context.cc",
|
||||
"//brave/components/permissions/contexts/brave_localhost_permission_context.h",
|
||||
"//brave/components/permissions/contexts/brave_open_ai_chat_permission_context.cc",
|
||||
"//brave/components/permissions/contexts/brave_open_ai_chat_permission_context.h",
|
||||
"//brave/components/permissions/permission_expiration_key.cc",
|
||||
|
||||
@@ -821,7 +821,6 @@
|
||||
<part file="request_otr_strings.grdp" />
|
||||
<part file="permissions_strings.grdp" />
|
||||
<part file="google_sign_in_permission_strings.grdp" />
|
||||
<part file="localhost_access_permission_strings.grdp" />
|
||||
<part file="rewards_strings.grdp" />
|
||||
<part file="wallet_strings.grdp" />
|
||||
<part file="tor_strings.grdp" />
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<grit-part>
|
||||
<message name="IDS_LOCALHOST_ACCESS_PERMISSION_FRAGMENT" desc="Label for localhost access permission prompt.">
|
||||
Allow access to localhost resources
|
||||
</message>
|
||||
<message name="IDS_LOCALHOST_ACCESS_INFOBAR_TEXT" desc="Label for localhost access permission prompt (Android).">
|
||||
<ph name="URL">$1<ex>https://trezor.io</ex></ph> wants access to localhost resources
|
||||
</message>
|
||||
</grit-part>
|
||||
@@ -41,7 +41,6 @@ OBJC_EXPORT
|
||||
@property(class, nonatomic, readonly) Feature* kBraveDebounce;
|
||||
@property(class, nonatomic, readonly) Feature* kBraveDomainBlock;
|
||||
@property(class, nonatomic, readonly) Feature* kBraveDomainBlock1PES;
|
||||
@property(class, nonatomic, readonly) Feature* kBraveLocalhostAccessPermission;
|
||||
@property(class, nonatomic, readonly) Feature* kBraveNTPBrandedWallpaper;
|
||||
@property(class, nonatomic, readonly)
|
||||
Feature* kBraveNTPBrandedWallpaperSurveyPanelist;
|
||||
|
||||
@@ -161,11 +161,6 @@
|
||||
initWithFeature:&brave_shields::features::kBraveDomainBlock1PES];
|
||||
}
|
||||
|
||||
+ (Feature*)kBraveLocalhostAccessPermission {
|
||||
return [[Feature alloc] initWithFeature:&brave_shields::features::
|
||||
kBraveLocalhostAccessPermission];
|
||||
}
|
||||
|
||||
+ (Feature*)kBraveNTPBrandedWallpaper {
|
||||
return [[Feature alloc] initWithFeature:&ntp_background_images::features::
|
||||
kBraveNTPBrandedWallpaper];
|
||||
|
||||
@@ -6,7 +6,7 @@ index f4d7e51eb5d722c9a8c5ae67660d8da24459df77..bf28d516427c584a3420df667aa9f71e
|
||||
IMPORT_DATA: Route;
|
||||
SIGN_OUT: Route;
|
||||
// </if>
|
||||
+ GET_STARTED: Route; ORIGIN: Route; SHIELDS: Route; SOCIAL_BLOCKING: Route; EXTENSIONS: Route; EXTENSIONS_V2: Route; BRAVE_SYNC: Route; BRAVE_SYNC_SETUP: Route; BRAVE_WALLET: Route; BRAVE_WEB3: Route; BRAVE_NEW_TAB: Route; THEMES: Route; SITE_SETTINGS_AUTOPLAY: Route; SITE_SETTINGS_GOOGLE_SIGN_IN: Route; SITE_SETTINGS_LOCALHOST_ACCESS: Route; SITE_SETTINGS_BRAVE_OPEN_AI_CHAT: Route; SITE_SETTINGS_ETHEREUM: Route; SITE_SETTINGS_SOLANA: Route; SITE_SETTINGS_CARDANO: Route; SITE_SETTINGS_SHIELDS_STATUS: Route; SHIELDS_ADBLOCK: Route; SHORTCUTS: Route; BRAVE_WALLET_NETWORKS: Route; BRAVE_LEO_ASSISTANT: Route; BRAVE_LEO_CUSTOMIZATION: Route; BRAVE_CONTENT: Route; BRAVE_SURVEY_PANELIST: Route; DEFAULT_SEARCH: Route; PRIVATE_SEARCH: Route; EMAIL_ALIASES: Route;
|
||||
+ GET_STARTED: Route; ORIGIN: Route; SHIELDS: Route; SOCIAL_BLOCKING: Route; EXTENSIONS: Route; EXTENSIONS_V2: Route; BRAVE_SYNC: Route; BRAVE_SYNC_SETUP: Route; BRAVE_WALLET: Route; BRAVE_WEB3: Route; BRAVE_NEW_TAB: Route; THEMES: Route; SITE_SETTINGS_AUTOPLAY: Route; SITE_SETTINGS_GOOGLE_SIGN_IN: Route; SITE_SETTINGS_BRAVE_OPEN_AI_CHAT: Route; SITE_SETTINGS_ETHEREUM: Route; SITE_SETTINGS_SOLANA: Route; SITE_SETTINGS_CARDANO: Route; SITE_SETTINGS_SHIELDS_STATUS: Route; SHIELDS_ADBLOCK: Route; SHORTCUTS: Route; BRAVE_WALLET_NETWORKS: Route; BRAVE_LEO_ASSISTANT: Route; BRAVE_LEO_CUSTOMIZATION: Route; BRAVE_CONTENT: Route; BRAVE_SURVEY_PANELIST: Route; DEFAULT_SEARCH: Route; PRIVATE_SEARCH: Route; EMAIL_ALIASES: Route;
|
||||
}
|
||||
|
||||
/** Class for navigable routes. */
|
||||
|
||||
@@ -6,7 +6,7 @@ index 70c6055368b7edf01b7c05dbe711f93b385a8802..a8301dc5db48f26da111afff14144a95
|
||||
PDF_DOCUMENTS = 'pdfDocuments',
|
||||
SITE_DATA = 'site-data',
|
||||
OFFER_WRITING_HELP = 'offer-writing-help',
|
||||
+ AUTOPLAY = 'autoplay', ETHEREUM = 'ethereum', SOLANA = 'solana', CARDANO = 'cardano', BRAVE_SHIELDS = 'braveShields', GOOGLE_SIGN_IN = 'googleSignIn', LOCALHOST_ACCESS = 'localhostAccess', BRAVE_OPEN_AI_CHAT = 'braveOpenAIChat'
|
||||
+ AUTOPLAY = 'autoplay', ETHEREUM = 'ethereum', SOLANA = 'solana', CARDANO = 'cardano', BRAVE_SHIELDS = 'braveShields', GOOGLE_SIGN_IN = 'googleSignIn', BRAVE_OPEN_AI_CHAT = 'braveOpenAIChat'
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ index 1ad00705bb9c003c7bae916ec96d622758cacd48..6dcd4972d65884362984a3fbd666821e
|
||||
case ContentSettingsTypes.WEB_PRINTING:
|
||||
// "Ask" vs "Blocked".
|
||||
return ContentSetting.ASK;
|
||||
+ case ContentSettingsTypes.ETHEREUM: case ContentSettingsTypes.SOLANA: case ContentSettingsTypes.CARDANO: case ContentSettingsTypes.GOOGLE_SIGN_IN: case ContentSettingsTypes.LOCALHOST_ACCESS: case ContentSettingsTypes.BRAVE_OPEN_AI_CHAT: return ContentSetting.ASK; case ContentSettingsTypes.AUTOPLAY: return ContentSetting.ALLOW;
|
||||
+ case ContentSettingsTypes.ETHEREUM: case ContentSettingsTypes.SOLANA: case ContentSettingsTypes.CARDANO: case ContentSettingsTypes.GOOGLE_SIGN_IN: case ContentSettingsTypes.BRAVE_OPEN_AI_CHAT: return ContentSetting.ASK; case ContentSettingsTypes.AUTOPLAY: return ContentSetting.ALLOW;
|
||||
default:
|
||||
assertNotReached('Invalid category: ' + this.category);
|
||||
}
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@ index ae0964539b36830ec117a8c748e1c893d42f843d..1696f70392e55594d029161a5bb52af5
|
||||
Type.LOCAL_NETWORK_ACCESS,
|
||||
Type.WINDOW_MANAGEMENT,
|
||||
Type.AUTO_PICTURE_IN_PICTURE,
|
||||
+ Type.AUTOPLAY, Type.BRAVE_GOOGLE_SIGN_IN, Type.BRAVE_LOCALHOST_ACCESS,
|
||||
+ Type.AUTOPLAY, Type.BRAVE_GOOGLE_SIGN_IN,
|
||||
Type.NUM_ENTRIES
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@@ -15,7 +15,7 @@ index ae0964539b36830ec117a8c748e1c893d42f843d..1696f70392e55594d029161a5bb52af5
|
||||
|
||||
/** Number of handled categories used for calculating array sizes. */
|
||||
- int NUM_ENTRIES = 38;
|
||||
+ int AUTOPLAY = 38; int BRAVE_GOOGLE_SIGN_IN = 39; int BRAVE_LOCALHOST_ACCESS = 40; int NUM_ENTRIES = 41;
|
||||
+ int AUTOPLAY = 38; int BRAVE_GOOGLE_SIGN_IN = 39; int NUM_ENTRIES = 40;
|
||||
}
|
||||
|
||||
private final BrowserContextHandle mBrowserContextHandle;
|
||||
|
||||
Reference in New Issue
Block a user