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

Commit

Permalink
Add support for welcome page
Browse files Browse the repository at this point in the history
- Auditors: @bsclifton
- Closes #7821
  • Loading branch information
cezaraugusto committed May 8, 2017
1 parent 140d5b5 commit 4235b50
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ let generateBraveManifest = () => {
'referrer': 'no-referrer',
'style-src': '\'self\' \'unsafe-inline\'',
'img-src': '* data: file://*',
'frame-src': '\'self\' https://buy.coinbase.com'
'frame-src': '\'self\' https://buy.coinbase.com https://brave.com'
}

if (process.env.NODE_ENV === 'development') {
Expand Down
21 changes: 21 additions & 0 deletions app/extensions/brave/about-welcome.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

<!DOCTYPE html>
<!-- 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/. -->
<html>
<head>
<meta charset="utf-8">
<meta name="availableLanguages" content="">
<meta name="defaultLanguage" content="en-US">
<link rel="shortcut icon" type="image/x-icon" href="data:image/x-icon;,">
<title data-l10n-id="aboutWelcome"></title>
<script src="ext/l20n.min.js"></script>
<script src="gen/aboutPages.entry.js" async></script>
<link rel="localization" href="locales/{locale}/app.properties">
<link rel="stylesheet" href="content/styles/defaultStyles.css">
</head>
<body>
<div id="appContainer"/>
</body>
</html>
18 changes: 18 additions & 0 deletions app/extensions/brave/content/styles/defaultStyles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* 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/. */

html, body {
font-family: "Helvetica Neue", Arial, sans-serif;
font-weight: 400;
margin: 0;
padding: 0;
}

html, body, #appContainer, #appContainer > div {
height: 100%;
}

body {
font-size: 100%;
}
1 change: 1 addition & 0 deletions app/extensions/brave/locales/en-US/app.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ submit=Submit
settings=Settings
aboutPages=About pages
aboutBrave=About Brave
aboutWelcome=Welcome to Brave
braveInfo=Browse faster and safer with Brave.
releaseNotes=Release Notes
relNotesInfo1=Click
Expand Down
23 changes: 23 additions & 0 deletions app/renderer/about/welcome.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* 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/. */

const React = require('react')
const {StyleSheet, css} = require('aphrodite/no-important')

class AboutWelcome extends React.Component {
render () {
return <iframe data-test-id='welcomeIframe'
className={css(styles.welcomeIframe)} src='https://brave.com/welcome.html' />
}
}

const styles = StyleSheet.create({
welcomeIframe: {
width: '100%',
height: '100%',
border: 0
}
})

module.exports = <AboutWelcome />
3 changes: 3 additions & 0 deletions js/about/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ switch (getBaseUrl(getSourceAboutUrl(window.location.href))) {
case 'about:contributions':
element = require('./contributionStatement')
break
case 'about:welcome':
element = require('../../app/renderer/about/welcome')
break
}

if (element) {
Expand Down
3 changes: 2 additions & 1 deletion js/lib/appUrlUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ module.exports.aboutUrls = new Immutable.Map({
'about:preferences': module.exports.getBraveExtUrl('about-preferences.html'),
'about:safebrowsing': module.exports.getBraveExtUrl('about-safebrowsing.html'),
'about:styles': module.exports.getBraveExtUrl('about-styles.html'),
'about:contributions': module.exports.getBraveExtUrl('about-contributions.html')
'about:contributions': module.exports.getBraveExtUrl('about-contributions.html'),
'about:welcome': module.exports.getBraveExtUrl('about-welcome.html')
})

module.exports.isIntermediateAboutPage = (location) =>
Expand Down
35 changes: 35 additions & 0 deletions test/unit/about/welcomePageTest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/* 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/. */
/* global describe, before, after, it */

const mockery = require('mockery')
const {shallow} = require('enzyme')
const assert = require('assert')
let AboutWelcome
require('../braveUnit')

describe('AboutWelcome component', function () {
before(function () {
mockery.enable({
warnOnReplace: false,
warnOnUnregistered: false,
useCleanCache: true
})
AboutWelcome = require('../../../app/renderer/about/welcome')
mockery.registerMock('../../../less/about/common.less', {})
})

after(function () {
mockery.disable()
})

describe('Rendering', function () {
it('renders an iframe', function () {
const wrapper = shallow(
AboutWelcome
)
assert.equal(wrapper.find('[data-test-id="welcomeIframe"]').length, 1)
})
})
})

0 comments on commit 4235b50

Please sign in to comment.