diff --git a/components/brave_extension/extension/brave_extension/BUILD.gn b/components/brave_extension/extension/brave_extension/BUILD.gn
index 571f11ec73cd..10f4e248c874 100644
--- a/components/brave_extension/extension/brave_extension/BUILD.gn
+++ b/components/brave_extension/extension/brave_extension/BUILD.gn
@@ -40,14 +40,18 @@ transpile_web_ui("brave_extension") {
"background/reducers/shieldsPanelReducer.ts",
"background/store.ts",
"braveShieldsPanel.tsx",
- "components/braveShields/braveShields.tsx",
- "components/braveShields/footer.tsx",
- "components/braveShields/header.tsx",
- "components/braveShields/interfaceControls.tsx",
- "components/braveShields/privacyControls.tsx",
- "components/braveShields/blockedResources/blockedResources.tsx",
- "components/braveShields/blockedResources/scriptsList.tsx",
- "components/braveShields/blockedResources/staticList.tsx",
+ "components/braveShields.tsx",
+ "components/footer.tsx",
+ "components/header.tsx",
+ "components/interfaceControls.tsx",
+ "components/privacyControls.tsx",
+ "components/controls/adsTrackersControl.tsx",
+ "components/controls/cookiesControl.tsx",
+ "components/controls/deviceRecognitionControl.tsx",
+ "components/controls/httpsUpgradesControl.tsx",
+ "components/controls/scriptsControl.tsx",
+ "components/list/dynamic.tsx",
+ "components/list/static.tsx",
"constants/cosmeticFilterTypes.ts",
"constants/resourceIdentifiers.ts",
"constants/runtimeActionTypes.ts",
diff --git a/components/brave_extension/extension/brave_extension/_locales/en_US/messages.json b/components/brave_extension/extension/brave_extension/_locales/en_US/messages.json
index eb925256842c..e1be70d452f8 100644
--- a/components/brave_extension/extension/brave_extension/_locales/en_US/messages.json
+++ b/components/brave_extension/extension/brave_extension/_locales/en_US/messages.json
@@ -15,10 +15,6 @@
"message": "down",
"description": "Message for when shields is disabled"
},
- "totalBlocked": {
- "message": "Total blocked",
- "description": "Message showing the amount of all blocked resources"
- },
"forThisSite": {
"message": "for this site",
"description": "Partial string for the phrase `shields is up *for this site*`"
@@ -31,69 +27,65 @@
"message": "You’re browsing this site without any privacy and security protections.",
"description": "Message telling the user that shields are disabled"
},
- "blockAds": {
- "message": "Ads and trackers blocked",
- "description": "Message indicating the number of ads and trackers blocked"
+ "itemsBlocked": {
+ "message": "Items blocked",
+ "description": "Message for the main blocked resources text when there is more than one ad/track/script blocked (plural)"
},
- "blockPopups": {
- "message": "Pop-ups blocked",
- "description": "Message indicating the number of pop-ups blocked"
+ "itemBlocked": {
+ "message": "Item blocked",
+ "description": "Message for the main blocked resources text when there is one ad/track/script blocked (singular)"
},
- "blockImages": {
- "message": "Images blocked",
- "description": "Message indicating the number of images blocked"
+ "and": {
+ "message": "and",
+ "description": "Message for the `and` conjunction. Used to connect grammatically the `item blocked and connection upgrades` and its variant phrases"
},
- "block3partyCookies": {
- "message": "3rd-party cookies blocked",
- "description": "Message for the select option about cookies blocked, blocking 3rd party cookies"
+ "connectionsUpgraded": {
+ "message": "connections upgraded",
+ "description": "Message for the main blocked resources text when there is at least one ad/track/script blocked and more than one connection upgrade (plural)"
},
- "allowAllCookies": {
- "message": "All cookies allowed",
- "description": "Message for the select option about cookies blocked, allowing all cookies"
+ "connectionUpgraded": {
+ "message": "connection upgraded",
+ "description": "Message for the main blocked resources text when there is at least one ad/track/script blocked and one connection upgrade (singular)"
},
- "blockAllCookies": {
- "message": "Cookies blocked",
- "description": "Message for the select option about cookies blocked, blocking all cookies"
+ "thirdPartyTrackersBlocked": {
+ "message": "3rd-party trackers blocked",
+ "description": "Message for the scripts blocked row label"
},
- "blockSomeScripts": {
- "message": "Some scripts blocked",
- "description": "Message for the select option about scripts blocked, blocking 3rd party scripts"
+ "connectionsUpgradedHTTPS": {
+ "message": "Connections upgraded to HTTPS",
+ "description": "Message for the connections upgraded row label and for the main blocked resources text when there is more than one connection upgraded (plural) and no other ads/trackers blocked"
},
- "allowAllScripts": {
- "message": "All scripts allowed",
- "description": "Message for the select option about scripts blocked, allowing all scripts"
+ "connectionUpgradedHTTPS": {
+ "message": "Connection upgraded to HTTPS",
+ "description": "Message for the main blocked resources text when there is one connection upgraded (singular) and no other ads/trackers blocked"
},
- "blockAllScriptsOrigins": {
+ "scriptsBlocked": {
"message": "Scripts blocked",
- "description": "Message for the select option about scripts blocked, blocking all scripts"
- },
- "block3partyFingerprinting": {
- "message": "3rd-party device recognition blocked",
- "description": "Message for the select option about fingerprinting blocked, blocking 3rd party fingerprinting"
+ "description": "Message for the scripts blocked row label"
},
- "allowAllFingerprinting": {
- "message": "All device recognition allowed",
- "description": "Message for the select option about fingerprinting blocked, allowing all fingerprinting"
+ "thirdPartyCookiesBlocked": {
+ "message": "3rd-party cookies blocked",
+ "description": "Message for the option in the cookies select field to block all 3rd party cookies"
},
- "blockAllFingerprinting": {
- "message": "Device recognition blocked",
- "description": "Message for the select option about fingerprinting blocked, blocking all fingerprinting"
+ "allCookiesBlocked": {
+ "message": "Cookies blocked",
+ "description": "Message for the option in the cookies select field to block all cookies"
},
- "blockPishing": {
- "message": "Phishing/malware attempts blocked",
- "description": "Message indicating the number of phishing/malware blocked"
+ "allCookiesAllowed": {
+ "message": "All cookies allowed",
+ "description": "Message for the option in the cookies select field to allow all cookies"
},
- "connectionsEncrypted": {
- "message": "Connections encrypted",
- "description": "Message indicating the number of connections encrypted"
+ "thirdPartyFingerprintingBlocked": {
+ "message": "3rd-party device recognition blocked",
+ "description": "Message for the option in the device recognition select field to block all 3rd party recognition attempts"
},
- "editDefaults": {
- "message": "Global shield defaults",
- "description": "Message linking shields to the global shield settings"
+ "allFingerprintingBlocked": {
+ "message": "Device recognition blocked",
+ "description": "Message for the option in the device recognition select field to block all device recognition attempts"
},
- "cookiesOnThisSite": {
- "message": "Cookies on this site",
- "description": "Message for the cookie resources blocked panel"
+ "allFingerprintingAllowed": {
+ "message": "All device recognition allowed",
+ "description": "Message for the option in the device recognition select field to allow all device recognition attempts"
},
"deviceRecognitionAttempts": {
"message": "Device recognition attempts",
@@ -111,49 +103,21 @@
"message": "Allowed scripts",
"description": "Message for the script resources allowed"
},
- "allowAll": {
- "message": "Allow all",
- "description": "Message for the resources blocked *allow all* option"
- },
- "allow": {
- "message": "Allow",
- "description": "Message for the resources blocked *allow* option"
- },
- "allowed": {
- "message": "Allowed",
- "description": "Message for the resources blocked *allowed* option"
- },
"blockAll": {
"message": "Block all",
"description": "Message for the resources blocked *block all* option"
},
+ "allowAll": {
+ "message": "Allow all",
+ "description": "Message for the resources blocked *allow all* option"
+ },
"block": {
"message": "Block",
"description": "Message for the resources blocked *block* option"
},
- "blocked": {
- "message": "Blocked",
- "description": "Message for the resources blocked *blocked* option"
- },
- "apply": {
- "message": "Apply",
- "description": "Message for the button inside dynamic list of resources blocked"
- },
- "applyOnce": {
- "message": "Apply once",
- "description": "Message for the dropdown option inside dynamic list of resources blocked to *apply once*"
- },
- "applyUntilRestart": {
- "message": "Apply until restart",
- "description": "Message for the dropdown option inside dynamic list of resources blocked to *apply until restart*"
- },
- "alwaysApply": {
- "message": "Always apply",
- "description": "Message for the dropdown option inside dynamic list of resources blocked to *always apply*"
- },
- "undo": {
- "message": "Undo",
- "description": "Message for the resources blocked *undo* option"
+ "allow": {
+ "message": "Allow",
+ "description": "Message for the resources blocked *allow* option"
},
"cancel": {
"message": "Cancel",
@@ -162,5 +126,13 @@
"goBack": {
"message": "Go back",
"description": "Message for the button inside the static list of resources blocked to go back from the current screen"
+ },
+ "applyOnce": {
+ "message": "Apply once",
+ "description": "Message for action in dynamic list of resources blocked to *apply once*"
+ },
+ "changeDefaults": {
+ "message": "Change global shield defaults",
+ "description": "Message for the button action linking to the settings page"
}
}
diff --git a/components/brave_extension/extension/brave_extension/actions/shieldsPanelActions.ts b/components/brave_extension/extension/brave_extension/actions/shieldsPanelActions.ts
index 99546feef9b2..c0305bce38f7 100644
--- a/components/brave_extension/extension/brave_extension/actions/shieldsPanelActions.ts
+++ b/components/brave_extension/extension/brave_extension/actions/shieldsPanelActions.ts
@@ -82,10 +82,9 @@ export const changeNoScriptSettings: actions.ChangeNoScriptSettings = (origin) =
}
}
-export const changeAllNoScriptSettings: actions.ChangeAllNoScriptSettings = (origin, shouldBlock) => {
+export const changeAllNoScriptSettings: actions.ChangeAllNoScriptSettings = (shouldBlock) => {
return {
type: types.CHANGE_ALL_NO_SCRIPT_SETTINGS,
- origin,
shouldBlock
}
}
diff --git a/components/brave_extension/extension/brave_extension/background/api/cosmeticFilterAPI.ts b/components/brave_extension/extension/brave_extension/background/api/cosmeticFilterAPI.ts
index a8905f6f4757..30dfd653893d 100644
--- a/components/brave_extension/extension/brave_extension/background/api/cosmeticFilterAPI.ts
+++ b/components/brave_extension/extension/brave_extension/background/api/cosmeticFilterAPI.ts
@@ -22,13 +22,15 @@ export const applySiteFilters = (hostname: string) => {
chrome.storage.local.get('cosmeticFilterList', (storeData = {}) => {
if (!storeData.cosmeticFilterList) {
if (process.env.NODE_ENV === 'shields_development') {
- console.info('applySiteFilters: no cosmetic filter store yet')
+ console.log('applySiteFilters: no cosmetic filter store yet')
}
return
}
if (storeData.cosmeticFilterList[hostname] !== undefined) {
storeData.cosmeticFilterList[hostname].map((rule: string) => {
- console.log('applying rule', rule)
+ if (process.env.NODE_ENV === 'shields_development') {
+ console.log('applying rule', rule)
+ }
chrome.tabs.insertCSS({
code: `${rule} {display: none;}`,
runAt: 'document_start'
diff --git a/components/brave_extension/extension/brave_extension/background/api/localeAPI.ts b/components/brave_extension/extension/brave_extension/background/api/localeAPI.ts
index 6f68f70a50ea..5d2cea906087 100644
--- a/components/brave_extension/extension/brave_extension/background/api/localeAPI.ts
+++ b/components/brave_extension/extension/brave_extension/background/api/localeAPI.ts
@@ -6,7 +6,7 @@
* Gets the locale message specified in messages.json
* @param {string} message - The locale string
*/
-export const getMessage = (message: string): string => {
+export const getLocale = (message: string): string => {
if (chrome.i18n) {
return chrome.i18n.getMessage(message)
}
diff --git a/components/brave_extension/extension/brave_extension/background/reducers/shieldsPanelReducer.ts b/components/brave_extension/extension/brave_extension/background/reducers/shieldsPanelReducer.ts
index e28ff36373c3..76f13ba97317 100644
--- a/components/brave_extension/extension/brave_extension/background/reducers/shieldsPanelReducer.ts
+++ b/components/brave_extension/extension/brave_extension/background/reducers/shieldsPanelReducer.ts
@@ -305,7 +305,7 @@ export default function shieldsPanelReducer (state: State = { tabs: {}, windows:
}
case shieldsPanelTypes.CHANGE_ALL_NO_SCRIPT_SETTINGS: {
const tabId: number = shieldsPanelState.getActiveTabId(state)
- state = shieldsPanelState.changeAllNoScriptSettings(state, tabId, action.origin, action.shouldBlock)
+ state = shieldsPanelState.changeAllNoScriptSettings(state, tabId, action.shouldBlock)
break
}
}
diff --git a/components/brave_extension/extension/brave_extension/braveShieldsPanel.html b/components/brave_extension/extension/brave_extension/braveShieldsPanel.html
index 1678474edb85..75beeec7aeaf 100644
--- a/components/brave_extension/extension/brave_extension/braveShieldsPanel.html
+++ b/components/brave_extension/extension/brave_extension/braveShieldsPanel.html
@@ -7,7 +7,7 @@
Brave Shields Panel
diff --git a/components/brave_extension/extension/brave_extension/components/braveShields.tsx b/components/brave_extension/extension/brave_extension/components/braveShields.tsx
new file mode 100644
index 000000000000..bc043f05fb40
--- /dev/null
+++ b/components/brave_extension/extension/brave_extension/components/braveShields.tsx
@@ -0,0 +1,149 @@
+/* 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 http://mozilla.org/MPL/2.0/. */
+
+import * as React from 'react'
+
+// CSS normalizer
+import 'emptykit.css'
+
+// Feature-specific components
+import { ShieldsPanel } from 'brave-ui/features/shields'
+
+// Components group
+import Header from './header'
+import InterfaceControls from './interfaceControls'
+import PrivacyControls from './privacyControls'
+import Footer from './footer'
+
+// Types
+import { Tab } from '../types/state/shieldsPannelState'
+import { isShieldsEnabled, getFavicon } from '../helpers/shieldsUtils'
+import {
+ ShieldsToggled,
+ BlockAdsTrackers,
+ HttpsEverywhereToggled,
+ BlockJavaScript,
+ BlockFingerprinting,
+ BlockCookies,
+ AllowScriptOriginsOnce,
+ ChangeNoScriptSettings,
+ ChangeAllNoScriptSettings
+} from '../types/actions/shieldsPanelActions'
+
+interface Props {
+ actions: {
+ shieldsToggled: ShieldsToggled
+ blockAdsTrackers: BlockAdsTrackers
+ httpsEverywhereToggled: HttpsEverywhereToggled
+ blockJavaScript: BlockJavaScript
+ blockFingerprinting: BlockFingerprinting
+ blockCookies: BlockCookies
+ allowScriptOriginsOnce: AllowScriptOriginsOnce
+ changeNoScriptSettings: ChangeNoScriptSettings
+ changeAllNoScriptSettings: ChangeAllNoScriptSettings
+ }
+ shieldsPanelTabData: Tab
+}
+
+interface State {
+ isBlockedListOpen: boolean
+}
+
+export default class Shields extends React.PureComponent {
+ constructor (props: Props) {
+ super(props)
+ this.state = { isBlockedListOpen: false }
+ }
+
+ get favicon (): string {
+ const { url } = this.props.shieldsPanelTabData
+ return getFavicon(url)
+ }
+
+ get isShieldsEnabled (): boolean {
+ const { braveShields } = this.props.shieldsPanelTabData
+ return isShieldsEnabled(braveShields)
+ }
+
+ setBlockedListOpen = () => {
+ this.setState({ isBlockedListOpen: !this.state.isBlockedListOpen })
+ }
+
+ render () {
+ const { shieldsPanelTabData, actions } = this.props
+ const { isBlockedListOpen } = this.state
+
+ if (!shieldsPanelTabData) {
+ return null
+ }
+
+ return (
+
+
+ {
+ this.isShieldsEnabled && (
+ <>
+
+
+ >
+ )
+ }
+
+
+ )
+ }
+}
diff --git a/components/brave_extension/extension/brave_extension/components/braveShields/blockedResources/blockedResources.tsx b/components/brave_extension/extension/brave_extension/components/braveShields/blockedResources/blockedResources.tsx
deleted file mode 100644
index fbbeaa912aa9..000000000000
--- a/components/brave_extension/extension/brave_extension/components/braveShields/blockedResources/blockedResources.tsx
+++ /dev/null
@@ -1,61 +0,0 @@
-/* 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 http://mozilla.org/MPL/2.0/. */
-
-import * as React from 'react'
-
-// Feature-specific components
-import {
- Label,
- ResourcesGrid,
- ResourcesSiteInfoGrid,
- CloseButton,
- CloseIcon,
- EmptyButton,
- StatFlex,
- ShowLessIcon,
- ResourcesStatusTitle,
- ResourcesSiteInfoFlex,
- ResourcesStatusGrid
-} from 'brave-ui/features/shields'
-
-// Utils
-import { getFavicon } from '../../../helpers/shieldsUtils'
-
-interface Props {
- hostname: string
- stats: number | undefined
- title: string
- url: string
- onToggle: (event: React.MouseEvent) => void
- dynamic?: boolean
-}
-
-export default class BlockedResources extends React.PureComponent {
- renderHeader = (stats: number | undefined, title: string, onToggle: (event: React.MouseEvent) => void) => {
- return (
-
-
- {stats !== undefined ? {stats} : null}
- {title}
-
- )
- }
-
- render () {
- const { stats, hostname, title, url, onToggle, children } = this.props
- return (
-
-
-
-
-
-
-
-
- {this.renderHeader(stats, title, onToggle)}
- {children}
-
- )
- }
-}
diff --git a/components/brave_extension/extension/brave_extension/components/braveShields/blockedResources/scriptsList.tsx b/components/brave_extension/extension/brave_extension/components/braveShields/blockedResources/scriptsList.tsx
deleted file mode 100644
index 35a523743676..000000000000
--- a/components/brave_extension/extension/brave_extension/components/braveShields/blockedResources/scriptsList.tsx
+++ /dev/null
@@ -1,187 +0,0 @@
-/* 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 http://mozilla.org/MPL/2.0/. */
-
-import * as React from 'react'
-
-// Feature-specific components
-import {
- AllowedScriptsIcon,
- BlockedScriptsIcon,
- DismissOverlay,
- ResourcesListScroll,
- ResourcesSubTitle,
- ResourcesFooterGrid,
- ResourcesFooterGridColumnLeft,
- ResourcesFooterGridColumnRight,
- ResourcesListItem,
- Link,
- ResourcesListAllowedLink,
- ResourcesListBlockedLink,
- ResourcesSubTitleGrid,
- ResourcesListGrid
-} from 'brave-ui/features/shields'
-
-// Shared components
-import { Button } from 'brave-ui/components'
-
-// Types
-import * as shieldActions from '../../../types/actions/shieldsPanelActions'
-import { BlockJSOptions } from '../../../types/other/blockTypes'
-import { NoScriptInfo } from '../../../types/other/noScriptInfo'
-
-// Utils
-import { getMessage } from '../../../background/api/localeAPI'
-
-interface Props {
- origin: string
- noScriptInfo: NoScriptInfo
- onClickDismiss: () => void
- javascript: BlockJSOptions
- blockJavaScript: shieldActions.BlockJavaScript
- allowScriptOriginsOnce: shieldActions.AllowScriptOriginsOnce
- changeNoScriptSettings: shieldActions.ChangeNoScriptSettings
- changeAllNoScriptSettings: shieldActions.ChangeAllNoScriptSettings
-}
-
-interface State {
- showApplyOptions: boolean
-}
-
-export default class StaticList extends React.PureComponent {
- constructor (props: Props) {
- super(props)
- this.state = { showApplyOptions: false }
- }
-
- get blockedListSize () {
- const { noScriptInfo } = this.props
- return Object.keys(noScriptInfo)
- .filter((origin: string) => noScriptInfo[origin].willBlock === true).length
- }
-
- get allowedListSize () {
- const { noScriptInfo } = this.props
- return Object.keys(noScriptInfo)
- .filter((origin: string) => noScriptInfo[origin].willBlock === false).length
- }
-
- onClickOutsideBounds = () => {
- this.setState({ showApplyOptions: false })
- }
-
- onClickToggleBlockOrAllowScript = (event: React.MouseEvent) => {
- event.preventDefault()
- this.props.changeNoScriptSettings(event.currentTarget.id)
- }
-
- onClickBlockAll = (event: React.MouseEvent) => {
- event.preventDefault()
- const { origin } = this.props
- this.props.changeAllNoScriptSettings(origin, true)
- }
-
- onClickAllowAll = (event: React.MouseEvent) => {
- event.preventDefault()
- const { origin } = this.props
- this.props.changeAllNoScriptSettings(origin, false)
- this.setState({ showApplyOptions: false })
- }
-
- onClickApplyScriptsOnce = () => {
- const { noScriptInfo } = this.props
- const allOrigins = Object.keys(noScriptInfo)
- this.props.allowScriptOriginsOnce(allOrigins.filter(key => noScriptInfo[key].willBlock === false))
- }
-
- renderEnabledList = (list: NoScriptInfo) => {
- return Object.keys(list).map((origin: string, key: number) => {
- if (list[origin].willBlock === false) {
- return null
- }
- return (
-
- {
- list[origin].willBlock
- ? {getMessage('blocked')}
- : {getMessage('allow')}
- }
- {origin}
- {
- list[origin].willBlock
- ? {getMessage('undo')}
- : null
- }
-
- )
- })
- }
-
- renderDisabledList = (list: NoScriptInfo) => {
- return Object.keys(list).map((origin: string, key: number) => {
- if (list[origin].willBlock === true) {
- return null
- }
- return (
-
- {
- list[origin].willBlock
- ? {getMessage('allowed')}
- : {getMessage('block')}
- }
- {origin}
- {
- list[origin].willBlock
- ? {getMessage('undo')}
- : null
- }
-
- )
- })
- }
-
- render () {
- const { showApplyOptions } = this.state
- const { noScriptInfo, onClickDismiss } = this.props
- return (
- <>
-
- {showApplyOptions ? : null}
- {/* blocked scripts */}
-
-
-
- {getMessage('blockedScripts')} ({this.blockedListSize})
-
- {getMessage('allowAll')}
-
- {this.renderEnabledList(noScriptInfo)}
-
- {/* allowed scripts */}
-
-
-
- {getMessage('allowedScripts')} ({this.allowedListSize})
-
- {getMessage('blockAll')}
-
- {this.renderDisabledList(noScriptInfo)}
-
-
-
-
- {getMessage('cancel')}
-
-
-
-
-
- >
- )
- }
-}
diff --git a/components/brave_extension/extension/brave_extension/components/braveShields/blockedResources/staticList.tsx b/components/brave_extension/extension/brave_extension/components/braveShields/blockedResources/staticList.tsx
deleted file mode 100644
index 0be3fba795b3..000000000000
--- a/components/brave_extension/extension/brave_extension/components/braveShields/blockedResources/staticList.tsx
+++ /dev/null
@@ -1,35 +0,0 @@
-/* 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 http://mozilla.org/MPL/2.0/. */
-
-import * as React from 'react'
-
-// Feature-specific components
-import { ResourcesListText, ResourcesListScroll, ResourcesFooterFlex } from 'brave-ui/features/shields'
-
-// Shared components
-import { Button } from 'brave-ui/components'
-
-// Utils
-import { getMessage } from '../../../background/api/localeAPI'
-
-interface Props {
- list: Array
- onClickDismiss: () => void
-}
-
-export default class StaticList extends React.PureComponent {
- render () {
- const { list, onClickDismiss } = this.props
- return (
- <>
-
- {list.map((item: string, index: number) => {item})}
-
-
-
-
- >
- )
- }
-}
diff --git a/components/brave_extension/extension/brave_extension/components/braveShields/braveShields.tsx b/components/brave_extension/extension/brave_extension/components/braveShields/braveShields.tsx
deleted file mode 100644
index 7e9f7e8e0d93..000000000000
--- a/components/brave_extension/extension/brave_extension/components/braveShields/braveShields.tsx
+++ /dev/null
@@ -1,86 +0,0 @@
-/* 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 http://mozilla.org/MPL/2.0/. */
-
-import * as React from 'react'
-
-// Components group
-import ShieldsHeader from './header'
-import ShieldsInterfaceControls from './interfaceControls'
-import ShieldsPrivacyControls from './privacyControls'
-import ShieldsFooter from './footer'
-
-// Utils
-import { ShieldsPanel } from 'brave-ui/features/shields'
-import * as shieldActions from '../../types/actions/shieldsPanelActions'
-import { Tab } from '../../types/state/shieldsPannelState'
-
-interface Props {
- actions: {
- shieldsToggled: shieldActions.ShieldsToggled
- blockAdsTrackers: shieldActions.BlockAdsTrackers
- httpsEverywhereToggled: shieldActions.HttpsEverywhereToggled
- blockJavaScript: shieldActions.BlockJavaScript
- blockFingerprinting: shieldActions.BlockFingerprinting
- blockCookies: shieldActions.BlockCookies
- allowScriptOriginsOnce: shieldActions.AllowScriptOriginsOnce
- changeNoScriptSettings: shieldActions.ChangeNoScriptSettings
- changeAllNoScriptSettings: shieldActions.ChangeAllNoScriptSettings
- }
- shieldsPanelTabData: Tab
-}
-
-export default class BraveShields extends React.Component {
- render () {
- const { shieldsPanelTabData, actions } = this.props
- if (!shieldsPanelTabData) {
- return null
- }
-
- return (
-
-
-
-
-
-
- )
- }
-}
diff --git a/components/brave_extension/extension/brave_extension/components/braveShields/footer.tsx b/components/brave_extension/extension/brave_extension/components/braveShields/footer.tsx
deleted file mode 100644
index 3524e0103fc7..000000000000
--- a/components/brave_extension/extension/brave_extension/components/braveShields/footer.tsx
+++ /dev/null
@@ -1,28 +0,0 @@
-/* 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 http://mozilla.org/MPL/2.0/. */
-
-import * as React from 'react'
-
-// Feature-specific components
-import { MainFooterLinkFlex, LinkIcon } from 'brave-ui/features/shields'
-
-// Utils
-import * as tabsAPI from '../../background/api/tabsAPI'
-import { getMessage } from '../../background/api/localeAPI'
-
-export default class ShieldsFooter extends React.PureComponent<{}, {}> {
- openSettings = (event: React.MouseEvent) => {
- event.preventDefault()
- tabsAPI.createTab({ url: 'chrome://settings/shields' })
- .catch((err) => console.log(err))
- }
- render () {
- return (
-
- {getMessage('editDefaults')}
-
-
- )
- }
-}
diff --git a/components/brave_extension/extension/brave_extension/components/braveShields/header.tsx b/components/brave_extension/extension/brave_extension/components/braveShields/header.tsx
deleted file mode 100644
index fbecb3ab20b4..000000000000
--- a/components/brave_extension/extension/brave_extension/components/braveShields/header.tsx
+++ /dev/null
@@ -1,93 +0,0 @@
-// /* 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 http://mozilla.org/MPL/2.0/. */
-
-import * as React from 'react'
-
-// Feature-specific components
-import {
- Header,
- MainToggleFlex,
- Description,
- SiteInfoCard,
- DisabledTextGrid,
- Label,
- Highlight,
- UnHighlight,
- Toggle,
- ShieldIcon,
- MainSiteInfoGrid,
- ShieldIconFlex
-} from 'brave-ui/features/shields'
-
-// Types
-import { Tab } from '../../types/state/shieldsPannelState'
-import { BlockOptions } from '../../types/other/blockTypes'
-
-// Utils
-import * as shieldActions from '../../types/actions/shieldsPanelActions'
-import { getMessage } from '../../background/api/localeAPI'
-import { isHttpOrHttps } from '../../helpers/urlUtils'
-import { getFavicon, getTotalResourcesBlocked } from '../../helpers/shieldsUtils'
-
-export interface Props {
- tabData: Tab
- shieldsToggled: shieldActions.ShieldsToggled
-}
-
-export default class ShieldsHeader extends React.PureComponent {
- onToggleShields = (event: React.ChangeEvent) => {
- const { origin } = this.props.tabData
- if (!isHttpOrHttps(origin)) {
- return
- }
- const shieldsOption: BlockOptions = event.target.checked ? 'allow' : 'block'
- this.props.shieldsToggled(shieldsOption)
- }
-
- renderEnabledContent = () => {
- return (
-
- {getTotalResourcesBlocked(this.props.tabData)}
-
-
- )
- }
-
- renderDisabledContent = () => {
- return (
-
-
-
-
- {getMessage('disabledMessage')}
-
- )
- }
-
- render () {
- const { braveShields, hostname, url } = this.props.tabData
- const enabled = braveShields !== 'block'
-
- return (
-
-
-
-
-
- {enabled ? {getMessage('enabledMessage')} : null}
-
-
-
-
-
- {enabled ? this.renderEnabledContent() : this.renderDisabledContent()}
-
-
- )
- }
-}
diff --git a/components/brave_extension/extension/brave_extension/components/braveShields/interfaceControls.tsx b/components/brave_extension/extension/brave_extension/components/braveShields/interfaceControls.tsx
deleted file mode 100644
index 7e2eb3f1b6a0..000000000000
--- a/components/brave_extension/extension/brave_extension/components/braveShields/interfaceControls.tsx
+++ /dev/null
@@ -1,165 +0,0 @@
-/* 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 http://mozilla.org/MPL/2.0/. */
-
-import * as React from 'react'
-
-// Feature-specific components
-import {
- ShowMoreIcon,
- Toggle,
- StatFlex,
- ResourcesSwitchLabel,
- EmptyButton,
- ToggleFlex,
- ToggleGrid
-} from 'brave-ui/features/shields'
-
-// Component groups
-import BlockedResources from './blockedResources/blockedResources'
-import StaticList from './blockedResources/staticList'
-
-// Types
-import { BlockOptions } from '../../types/other/blockTypes'
-
-// Utils
-import { getMessage } from '../../background/api/localeAPI'
-import * as shieldActions from '../../types/actions/shieldsPanelActions'
-import { totalAdsTrackersBlocked, blockedResourcesSize } from '../../helpers/shieldsUtils'
-
-export interface Props {
- braveShields: BlockOptions
- url: string
- hostname: string
- ads: BlockOptions
- adsBlocked: number
- adsBlockedResources: Array
- blockAdsTrackers: shieldActions.BlockAdsTrackers
- trackers: BlockOptions
- trackersBlocked: number
- trackersBlockedResources: Array
- httpsRedirected: number
- httpUpgradableResources: BlockOptions
- httpsRedirectedResources: Array
- httpsEverywhereToggled: shieldActions.HttpsEverywhereToggled
-}
-
-interface State {
- openTotalAdsTrackersBlockedList: boolean,
- openConnectionsEncryptedList: boolean
-}
-
-export default class ShieldsInterfaceControls extends React.PureComponent {
- constructor (props: Props) {
- super(props)
- this.state = {
- openTotalAdsTrackersBlockedList: false,
- openConnectionsEncryptedList: false
- }
- }
-
- get totalAdsTrackersBlocked (): number {
- const { adsBlocked, trackersBlocked } = this.props
- return totalAdsTrackersBlocked(adsBlocked, trackersBlocked)
- }
-
- get totalAdsTrackersBlockedList (): Array {
- const { adsBlockedResources, trackersBlockedResources } = this.props
- return [...adsBlockedResources, ...trackersBlockedResources]
- }
-
- onChangeBlockAds = (event: React.ChangeEvent) => {
- if (!event.target) {
- return
- }
- const shoudEnableAdsTracks = event.target.checked ? 'allow' : 'block'
- this.props.blockAdsTrackers(shoudEnableAdsTracks)
- }
-
- onChangeConnectionsEncrypted = (event: React.ChangeEvent) => {
- if (!event.target) {
- return
- }
- const shouldEnableHttpsEverywhere = event.target.checked ? 'allow' : 'block'
- this.props.httpsEverywhereToggled(shouldEnableHttpsEverywhere)
- }
-
- onToggleTotalAdsTrackersBlocked = () => {
- this.setState({ openTotalAdsTrackersBlockedList: !this.state.openTotalAdsTrackersBlockedList })
- }
-
- onToggleConnectionsEncrypted = () => {
- this.setState({ openConnectionsEncryptedList: !this.state.openConnectionsEncryptedList })
- }
-
- renderTotalAdsTrackersBlockedList = (url: string, hostname: string, onToggle: () => void) => {
- return (
-
-
-
- )
- }
-
- renderConnectionsEncryptedList = (url: string, hostname: string, onToggle: () => void) => {
- const { httpsRedirected, httpsRedirectedResources } = this.props
- return (
-
-
-
- )
- }
-
- render () {
- const { braveShields, url, hostname, ads, trackers, httpsRedirected, httpUpgradableResources } = this.props
- const { openTotalAdsTrackersBlockedList, openConnectionsEncryptedList } = this.state
-
- const enabled = braveShields !== 'block'
- const blockAdsOption = ads !== 'allow' && trackers !== 'allow'
- const connectionsEncrypted = httpUpgradableResources !== 'allow'
-
- if (!enabled) {
- return null
- }
-
- return (
-