Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This pull request relates to two issues, #41427 and #41213 #26233

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
2c07d55
Add BraveWebtorrentDisabled.yaml to disable webtorrent
Terrencezzz Oct 20, 2024
fbe32e5
Add entry to about webtorrent disable to brave_simple_policy_map.h
Terrencezzz Oct 20, 2024
5bc8879
Modify IsWebtorrentEnabled in webtorrent_util.cc to match the policy …
Terrencezzz Oct 20, 2024
b4180ac
Create a "common" directory under component/brave_webtorrent, then ad…
Terrencezzz Oct 20, 2024
c5f8145
Include "brave/components/webtorrent/common/pref_names.h" and "compon…
Terrencezzz Oct 20, 2024
017416d
Add padding to cr_buttons to prevent overlap
Alec-Smith29 Oct 20, 2024
820b42c
Change padding to em
Alec-Smith29 Oct 20, 2024
4f5c686
Merge branch 'brave:master' into Deal-with-overlapping-of-delet-butto…
Alec-Smith29 Oct 22, 2024
5e6fc8e
Merge branch 'brave:master' into Deal-with-overlapping-of-delet-butto…
Alec-Smith29 Oct 22, 2024
c96d59a
Merge branch 'brave:master' into Deal-with-overlapping-of-delet-butto…
Alec-Smith29 Oct 24, 2024
9f949ae
Add padding to search field
Alec-Smith29 Oct 24, 2024
964e9ee
Added padding to navigation bar to prevent overlap with menu
Alec-Smith29 Oct 24, 2024
2c70906
Merge pull request #3 from Terrencezzz/Deal-with-overlapping-of-delet…
Alec-Smith29 Oct 25, 2024
76063f5
Merge branch 'brave:master' into master
Alec-Smith29 Oct 25, 2024
c9b5a46
Merge branch 'brave:master' into master
Terrencezzz Oct 25, 2024
c5a3905
Merge pull request #1 from Terrencezzz/Add-Group-policy-to-disable-we…
Terrencezzz Oct 25, 2024
5a0026e
Merge branch 'brave:master' into master
Terrencezzz Oct 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions browser/policy/brave_simple_policy_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ inline constexpr PolicyToPreferenceMapEntry kBraveSimplePolicyMap[] = {
kManagedBraveShieldsEnabledForUrls, base::Value::Type::LIST},
{policy::key::kBraveSyncUrl, brave_sync::kCustomSyncServiceUrl,
base::Value::Type::STRING},
{policy::key::kWebTorrentDisabled,
webtorrent::prefs::kWebTorrentDisabledByPolicy, base::Value::Type::BOOLEAN},
#endif

#if BUILDFLAG(ENABLE_TOR)
Expand Down
8 changes: 8 additions & 0 deletions components/brave_webtorrent/browser/webtorrent_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include "extensions/common/constants.h"
#include "net/http/http_content_disposition.h"
#include "net/http/http_response_headers.h"
#include "brave/components/webtorrent/common/pref_names.h"
#include "components/prefs/pref_service.h"

namespace webtorrent {

Expand Down Expand Up @@ -47,6 +49,12 @@ bool IsWebtorrentEnabled(content::BrowserContext* browser_context) {
if (!registry) {
return false;
}

PrefService* prefs = Profile::FromBrowserContext(browser_context)->GetPrefs();
if (prefs && prefs->GetBoolean(webtorrent::prefs::kWebTorrentDisabledByPolicy)) {
return false;
}

return registry->enabled_extensions().Contains(brave_webtorrent_extension_id);
}

Expand Down
18 changes: 18 additions & 0 deletions components/brave_webtorrent/common/pref_names.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright (c) 2021 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_WEBTORRENT_COMMON_PREF_NAMES_H_
#define BRAVE_COMPONENTS_WEBTORRENT_COMMON_PREF_NAMES_H_

namespace webtorrent {
namespace prefs {

inline constexpr char kWebTorrentDisabledByPolicy[] =
"webtorrent.disabled_by_policy";

} // namespace prefs
} // namespace webtorrent

#endif // BRAVE_COMPONENTS_WEBTORRENT_COMMON_PREF_NAMES_H_
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
caption: Disable WebTorrent
default: null
desc: |-
Disable WebTorrent in Brave.

WebTorrent is a feature that allows users to stream and download torrents directly in Brave.

If this policy is set to true, WebTorrent will always be disabled.

If this policy is set to false, WebTorrent will always be enabled.

If you set this policy, users cannot change or override it.

If this policy is left unset, WebTorrent will be enabled by default.
example_value: true
features:
can_be_mandatory: true
can_be_recommended: false
dynamic_refresh: false
per_profile: true
items:
- caption: Enable WebTorrent
value: false
- caption: Disable WebTorrent
value: true
- caption: Allow the user to decide
value: null
owners:
- bbondy@brave.com
- peter@brave.com
- clifton@brave.com
schema:
type: boolean
supported_on:
- chrome.*:105-
tags: []
type: main
3 changes: 2 additions & 1 deletion ui/webui/resources/br_elements/br_toolbar/br_toolbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
display: flex;
justify-content: center;
margin: 0;
padding: 6px 0;
padding-right:1em;
padding-left:1em;
gap: 6px;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<style>
:host {
--search-icon-size: 20px;
--search-padding: 16px;
--search-padding: 0.5em;
--search-icon-padding: 4px;
--search-button-width: calc(var(--search-icon-size) + 2 * var(--search-padding) + 2 * var(--search-icon-padding));
position: absolute;
Expand Down
1 change: 1 addition & 0 deletions ui/webui/resources/cr_elements/cr_button/cr_button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export class CrButtonElement extends CrLitElement {
:host {
display: inline-block;
height: min-content;
padding:2em;
}

:host(.cancel-button) {
Expand Down