This repository has been archived by the owner on Dec 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 975
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolves #7859 Auditors: @bradleyrichter @jonathansampson @bsclifton Test Plan: - go to youtube - play some videos - check if licon badge has the same number as shield panel
- Loading branch information
Showing
4 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ const React = require('react') | |
const ImmutableComponent = require('./immutableComponent') | ||
const Immutable = require('immutable') | ||
const electron = require('electron') | ||
const {StyleSheet, css} = require('aphrodite') | ||
const ipc = electron.ipcRenderer | ||
// const systemPreferences = electron.remote.systemPreferences | ||
|
||
|
@@ -880,6 +881,14 @@ class Main extends ImmutableComponent { | |
return null | ||
} | ||
|
||
getTotalBlocks (frames) { | ||
const ads = frames.getIn(['adblock', 'blocked']) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
const trackers = frames.getIn(['trackingProtection', 'blocked']) | ||
This comment has been minimized.
Sorry, something went wrong.
jonathansampson
Collaborator
|
||
const blocked = (ads ? ads.size : 0) + (trackers ? trackers.size : 0) | ||
|
||
return (blocked > 99) ? '99+' : blocked | ||
} | ||
|
||
render () { | ||
const comparatorByKeyAsc = (a, b) => a.get('key') > b.get('key') | ||
? 1 : b.get('key') > a.get('key') ? -1 : 0 | ||
|
@@ -1067,6 +1076,13 @@ class Main extends ImmutableComponent { | |
? <span className='buttonSeparator' /> | ||
: null | ||
} | ||
{ | ||
!this.braveShieldsDisabled | ||
? <div className={css(styles.lionBadge)} data-test-id='lionBadge'> | ||
{this.getTotalBlocks(activeFrame)} | ||
</div> | ||
: null | ||
} | ||
</div> | ||
</div> | ||
</div> | ||
|
@@ -1342,4 +1358,20 @@ class Main extends ImmutableComponent { | |
} | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
lionBadge: { | ||
right: '2px', | ||
position: 'absolute', | ||
top: '15px', | ||
color: '#FFF', | ||
borderRadius: '2px', | ||
padding: '1px 2px', | ||
pointerEvents: 'none', | ||
font: '7pt "Arial Narrow"', | ||
textAlign: 'center', | ||
border: '.5px solid #FFF', | ||
background: '#555555' | ||
} | ||
}) | ||
|
||
module.exports = Main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
frames
may not be an immutable list, causing agetIn from undefined
exception. Ran into this just now when firing-up Brave locally.