Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Add extension inspect views
Browse files Browse the repository at this point in the history
Fixes #8012

Auditors: @luixxiul

Test Plan:

Ensure extension links work when presented and are not present for
disabled / invalid:
1. Go to `about:extensions`
2. Click on the pdf viewer inspect view and confirm dev tools are launched
3. In another tab go to `about:preferences#extensions` and enable 1password
4. Click on the 1password inspect view and confirm dev tools are launched
5. In another tab go to `about:preferences#extensions` and enable bitwarden
6. Confirm the dev tools pane for 1password has closed
7. Confirm that `about:extensions` no longer shows inspect views for 1password
8. Click on the bitwarden inspect view and confirm dev tools are launched
9. Confirm that `about:extensions` has no inspect views for torrent viewer

Ensure the following appear as orange anchor links:
1. Payment FAQ on `about:preferences#payment`
2. Adobe and wiki `about:preferences#plugins`
3. Release notes and revision on `about:brave`
4. Inspect pages on `about:extensions`
5. Manage passwords on `about:preferences#security`
  • Loading branch information
evq committed Aug 9, 2017
1 parent 0779430 commit 8110f82
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 30 deletions.
1 change: 1 addition & 0 deletions app/extensions/brave/locales/en-US/extensions.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ extensions=Extensions
extensionIdLabel=ID:
extensionPathLabel=Path:
extensionPermissionsLabel=Permissions:
extensionInspectViewsLabel=Inspect Views:
notifyNewExtensionsAdded=Notify me when new extensions are added
extensionsTabFooterInfo=Looking for a favorite extension? Let us know through our
latest=Latest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const ImmutableComponent = require('../../immutableComponent')

// style
const globalStyles = require('../../styles/global')
const commonStyles = require('../../styles/commonStyles')
const {paymentStyles} = require('../../styles/payment')
const PIA = require('../../../../extensions/brave/img/private_internet_access.png')
const PIA2 = require('../../../../extensions/brave/img/private_internet_access_2x.png')
Expand All @@ -30,7 +31,7 @@ class DisabledContent extends ImmutableComponent {
<div className={css(styles.text)}data-l10n-id='paymentsWelcomeText5' />
<div className={css(styles.text)}>
<span data-l10n-id='paymentsWelcomeText6' />&nbsp;
<a className='linkText' href='https://brave.com/Payments_FAQ.html' rel='noopener' target='_blank' data-l10n-id='paymentsWelcomeLink' />&nbsp;
<a className={css(commonStyles.linkText)} href='https://brave.com/Payments_FAQ.html' rel='noopener' target='_blank' data-l10n-id='paymentsWelcomeLink' />&nbsp;
<span data-l10n-id='paymentsWelcomeText7' />
</div>
</div>
Expand Down
7 changes: 5 additions & 2 deletions app/renderer/components/preferences/pluginsTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ const WidevineInfo = require('../main/widevineInfo')
const flash = appConfig.resourceNames.FLASH
const widevine = appConfig.resourceNames.WIDEVINE

const {css} = require('aphrodite/no-important')
const commonStyles = require('../styles/commonStyles')

const {SettingsList, SettingCheckbox} = require('../common/settings')
const {DefaultSectionTitle} = require('../common/sectionTitle')

Expand Down Expand Up @@ -62,7 +65,7 @@ class PluginsTab extends ImmutableComponent {
? <div>
{this.infoCircle(appConfig.flash.installUrl)}
<span data-l10n-id='enableFlashSubtext' />&nbsp;
<span className='linkText' onClick={aboutActions.createTabRequested.bind(null, {
<span className={css(commonStyles.linkText)} onClick={aboutActions.createTabRequested.bind(null, {
url: appConfig.flash.installUrl
})} title={appConfig.flash.installUrl}>{'Adobe'}</span>.
</div>
Expand All @@ -74,7 +77,7 @@ class PluginsTab extends ImmutableComponent {
<div>
{this.infoCircle(flashInfoLink)}
<span data-l10n-id='flashTroubleshooting' />&nbsp;
<span className='linkText'
<span className={css(commonStyles.linkText)}
onClick={aboutActions.createTabRequested.bind(null, {
url: flashInfoLink,
active: true
Expand Down
16 changes: 16 additions & 0 deletions app/renderer/components/styles/commonStyles.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,22 @@ const styles = StyleSheet.create({
isCommonForm: {
fontSize: globalStyles.fontSize.flyoutDialog,
width: '100%'
},

linkText: {
display: 'inline-block',
textDecoration: 'underline',
color: globalStyles.color.braveOrange,
cursor: 'pointer',
margin: '0',

':hover': {
color: '#000'
}
},

linkText_small: {
fontSize: '14px'
}
})

Expand Down
4 changes: 2 additions & 2 deletions js/about/brave.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class AboutBrave extends React.Component {
<div>
<span data-l10n-id='relNotesInfo1' />
&nbsp;
<a className='linkText' href={`https://github.com/brave/browser-laptop/releases/tag/v${this.state.versionInformation.get('Brave')}dev`} rel='noopener' target='_blank' data-l10n-id='relNotesInfo2' />
<a className={css(commonStyles.linkText)} href={`https://github.com/brave/browser-laptop/releases/tag/v${this.state.versionInformation.get('Brave')}dev`} rel='noopener' target='_blank' data-l10n-id='relNotesInfo2' />
&nbsp;
<span data-l10n-id='relNotesInfo3' />
</div>
Expand All @@ -83,7 +83,7 @@ class AboutBrave extends React.Component {
},
{
html: name === 'rev'
? <a rel='noopener' target='_blank' href={`https://github.com/brave/browser-laptop/commit/${version}`}>{(version && version.substring(0, 7)) || ''}</a>
? <a rel='noopener' target='_blank' className={css(commonStyles.linkText)} href={`https://github.com/brave/browser-laptop/commit/${version}`}>{(version && version.substring(0, 7)) || ''}</a>
: version,
value: version
}
Expand Down
21 changes: 21 additions & 0 deletions js/about/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const Immutable = require('immutable')
const ImmutableComponent = require('../../app/renderer/components/immutableComponent')
const messages = require('../constants/messages')
const aboutActions = require('./aboutActions')
const appActions = require('../actions/appActions')

const {StyleSheet, css} = require('aphrodite/no-important')
const globalStyles = require('../../app/renderer/components/styles/global')
Expand All @@ -24,6 +25,7 @@ class ExtensionItem extends ImmutableComponent {
constructor () {
super()
this.onContextMenu = this.onContextMenu.bind(this)
this.onInspect = this.onInspect.bind(this)
}
onContextMenu (e) {
aboutActions.contextMenu(this.props.extension.toJS(), 'extensions', e)
Expand All @@ -35,6 +37,19 @@ class ExtensionItem extends ImmutableComponent {
this.props.extension.getIn(['manifest', 'icons', '16']) ||
null
}
get backgroundPage () {
return this.props.extension.getIn(['manifest', 'background', 'page']) || '_generated_background_page.html'
}
onInspect () {
const url = this.props.extension.get('url')
const backgroundPage = this.backgroundPage
chrome.tabs.query(
{currentWindow: true, active: true},
function (tabArray) {
appActions.loadURLRequested(tabArray[0].id, url + backgroundPage)
}
)
}

render () {
const className = css(
Expand All @@ -44,6 +59,7 @@ class ExtensionItem extends ImmutableComponent {
)
const icon = this.icon
const permissions = this.props.extension.getIn(['manifest', 'permissions'])
const hasBackground = this.props.extension.getIn(['manifest', 'background'])

return <div role='listitem'
disabled={!this.props.extension.get('enabled')}
Expand All @@ -70,6 +86,11 @@ class ExtensionItem extends ImmutableComponent {
? <div className='extensionPermissions'><span data-l10n-id='extensionPermissionsLabel' /> <span>{permissions.join(', ')}</span></div>
: null
}
{
hasBackground && this.props.extension.get('enabled')
? <div className='extensionInspectViews'><span data-l10n-id='extensionInspectViewsLabel' /> <label className={css(commonStyles.linkText, commonStyles.linkText_small)} onClick={this.onInspect}>{this.backgroundPage}</label></div>
: null
}
</div>
</div>
}
Expand Down
4 changes: 2 additions & 2 deletions js/about/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -607,15 +607,15 @@ class SecurityTab extends ImmutableComponent {
</SettingItem>
{
getSetting(settings.ACTIVE_PASSWORD_MANAGER, this.props.settings) === passwordManagers.BUILT_IN
? <label className='linkTextSmall' data-l10n-id='managePasswords'
? <label className={css(commonStyles.linkText, commonStyles.linkText_small)} data-l10n-id='managePasswords'
onClick={aboutActions.createTabRequested.bind(null, {
url: 'about:passwords'
})} />
: null
}
{
getSetting(settings.ACTIVE_PASSWORD_MANAGER, this.props.settings) === passwordManagers.LAST_PASS
? <label className='linkTextSmall' data-l10n-id='preferences'
? <label className={css(commonStyles.linkText, commonStyles.linkText_small)} data-l10n-id='preferences'
onClick={aboutActions.createTabRequested.bind(null, {
url: lastPassPreferencesUrl
})} />
Expand Down
23 changes: 0 additions & 23 deletions less/about/preferences.less
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,6 @@ span.settingsListCopy {
font-size: 0.95em;
}

span.linkText {
text-align: left;
display: inline;
margin-left: 10px;
}

input[type="number"] {
width: 50px;
min-width: 50px;
Expand Down Expand Up @@ -193,23 +187,6 @@ input[type="checkbox"][disabled] {
pointer-events: none;
}

.linkText {
display: inline-block;
text-decoration: underline;
color: @braveOrange;
cursor: pointer;
margin: 0;

&:hover {
color: #000;
}
}

.linkTextSmall {
.linkText;
font-size: 14px;
}

.permissionItem {
color: grey;
}
Expand Down

3 comments on commit 8110f82

@luixxiul
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@evq would you mind letting me know what was changed since the last commit, if any? thanks!

@evq
Copy link
Member Author

@evq evq commented on 8110f82 Aug 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@luixxiul It was a rebase due to merge conflicts. Specifically the addition of rel='noopener' for links with target='_blank'

@luixxiul
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

Please sign in to comment.