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

Commit

Permalink
Reformat prefs
Browse files Browse the repository at this point in the history
This does various visual tweaks for prefs, string changes, and adds a few prefs for controlling shutdown behavior.

The actual functionality for these prefs will come in a later commit

Auditors: @aekeus
  • Loading branch information
bbondy committed Jul 14, 2016
1 parent d82c6bf commit 7fea211
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 69 deletions.
47 changes: 28 additions & 19 deletions app/extensions/brave/locales/en-US/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -36,33 +36,31 @@ hintsTitle=Helpful hints
hint0=The Bravery panel allows you turn HTTPS Everywhere on or off. HTTPS Everywhere automatically rewrites your HTTP traffic to HTTPS for supported sites to keep you more secure.
hint1=Brave will always auto-update for you, but you can check for an update on demand in the menu.
hint2=The File menu allows you to create a New Session Tab. Session tabs are like any other tab but they run in a different user profile. This allows you to login to the same sites multiple times with the same browser.
prefAsideTitle=Browser Settings
sendUsFeedback=Send us feedback...
loveToHear=We'd love to hear from you.
startsWith=Brave starts with:
startsWithOptionLastTime=Show my windows / tabs from last time
startsWithOptionHomePage=Show my home page
startsWithOptionNewTabPage=Show the new tab page
myHomepage=My homepage is:
startsWith=Brave starts with
startsWithOptionLastTime=my windows / tabs from last time
startsWithOptionHomePage=my home page
startsWithOptionNewTabPage=the new tab page
myHomepage=My homepage is
defaultSearchEngine=Default search engine:
switchToNewTabs=Switch to new tabs immediately
paintTabs=Show tabs in page theme color
tabsPerTabPage=Tabs per tab page:
tabsPerTabPage=Number of tabs per tab set:
showTabPreviews=Show tab previews on hover
suggestionTypes=When using the location bar, suggest:
history=History
bookmarks=Bookmarks
openedTabs=Open tabs
offerSearchSuggestions=Use a prediction service to help complete searches and URLs typed in the address bar.
showHistoryMatches=Show history matches
showBookmarkMatches=Show bookmark matches
showOpenedTabMatches=Show opened tab matches
offerSearchSuggestions=Offer search suggestions
doNotTrack=Send a 'Do Not Track' header with browsing requests (requires browser restart)
blockCanvasFingerprinting=Block HTML canvas, WebGL, and AudioContext fingerprinting (may break some websites)
advancedPrivacySettings=Advanced Privacy Settings:
braveryDefaults=Bravery Defaults:
braveryDefaults=Bravery Defaults
blockAttackSites=Block reported attack sites (not available yet)
passwordSettings=Password Settings:
passwordManager=Password Manager
searchSettings=Search Settings
suggestionTypes=Search Bar Options
pluginSettings=Plugin settings:
locationBarSettings=Location Bar Settings
pluginSettings=Plugin Settings
usePasswordManager=Use Brave's password manager
useOnePassword=Use 1Password (requires 1Password Application)
useDashlane=Use Dashlane (requires Dashlane Application)
Expand All @@ -72,13 +70,13 @@ enableFlash=Enable Adobe Flash support (requires browser restart)
enableFlashSubtext=Flash support is experimental and requires Pepper Flash to be installed from
enableFlashSubtextLinux=Flash support is experimental and requires the pepperflashplugin-nonfree package.
managePasswords=Manage passwords...
sitePermissions=Saved site permissions
sitePermissions=Saved Site Permissions
selectedLanguage=Language:
bookmarkToolbarSettings=Bookmarks bar:
bookmarkToolbar=Always show the bookmarks bar
bookmarkToolbarShowFavicon=Favicons
bookmarkToolbarShowOnlyFavicon=Show only favicon
contentRenderingOptions=Content Rendering Options:
contentSettings=Content Settings
useHardwareAcceleration=Use hardware acceleration when available (requires browser restart)
defaultZoomLevel=Default zoom level
en-US=English (U.S.)
Expand Down Expand Up @@ -135,13 +133,24 @@ flashAllowOnce=Allow once
flashAllowAlways=Allow until {{time}}
alwaysAllow=Always allow
alwaysDeny=Always deny
appearanceSettings=Appearance settings:
appearanceSettings=Appearance Settings
autoHideMenuBar=Hide the menu bar by default
disableTitleMode=Disable auto title bar
loveToHear=We'd love to hear from you.
tabsSettings=Tabs Settings
showTabPreviews=Show tab previews on hover
offerSearchSuggestions=Use a prediction service to help complete searches and URLs typed in the address bar.
doNotTrackTitle=Do Not Track
doNotTrack=Send a 'Do Not Track' header with browsing requests (requires browser restart)
useHardwareAcceleration=Use hardware acceleration when available (requires browser restart)
braveStaysUpdated=Brave always stays updated.
generalSettings=General Settings
privateData=Private Data
privateDataMessage=Clear the following data types when I close Brave
browsingHistory=Browsing history
downloadHistory=Download history
cachedImagesAndFiles=Cached images and files
allSiteCookies=All site cookies
passwordsAndForms=Passwords and Forms
tabSettings=Tab Settings
bokmarksBarSettings=Bookmarks Bar Settings
6 changes: 6 additions & 0 deletions docs/state.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ AppStore
'bookmarks.toolbar.showOnlyFavicon': boolean, // true if only favicons should be shown on the bookmarks toolbar
'general.language': string, // The language code to use for localization and spell check or null to use the system default
'advanced.hardware-acceleration-enabled': boolean, // false if hardware acceleration should be explicitly disabled
'advanced.default-zoom-level': number, // the default zoom level for sites that have no specific setting
'advanced.pdfjs-enabled': boolean, // Whether or not to render PDF documents in the browser
'shutdown.clear-history': boolean, // true to clear history on shutdown
'shutdown.clear-downloads': boolean, // true to clear downloads on shutdown
'shutdown.clear-cache': boolean, // true to clear cache on shutdown
'shutdown.all-site-cookies': boolean, // true to clear all site cookies on shutdown
}],
dictionary: {
locale: string, // en_US, en, or any other locale string
Expand Down
108 changes: 64 additions & 44 deletions js/about/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const changeSetting = (cb, key, e) => {

class SettingsList extends ImmutableComponent {
render () {
return <div>
return <div className='settingsListContainer'>
{
this.props.dataL10nId
? <div className='settingsListTitle' data-l10n-id={this.props.dataL10nId} />
Expand Down Expand Up @@ -120,13 +120,8 @@ class GeneralTab extends ImmutableComponent {
})
const defaultLanguage = this.props.languageCodes.find((lang) => lang.includes(navigator.language)) || 'en-US'
return <SettingsList>
<div className='sectionTitle' data-l10n-id='generalSettings' />
<SettingsList>
<SettingItem dataL10nId='selectedLanguage'>
<select value={getSetting(settings.LANGUAGE, this.props.settings) || defaultLanguage}
onChange={changeSetting.bind(null, this.props.onChangeSetting, settings.LANGUAGE)} >
{languageOptions}
</select>
</SettingItem>
<SettingItem dataL10nId='startsWith'>
<select value={getSetting(settings.STARTUP_MODE, this.props.settings)}
onChange={changeSetting.bind(null, this.props.onChangeSetting, settings.STARTUP_MODE)} >
Expand All @@ -141,13 +136,21 @@ class GeneralTab extends ImmutableComponent {
value={getSetting(settings.HOMEPAGE, this.props.settings)}
onChange={changeSetting.bind(null, this.props.onChangeSetting, settings.HOMEPAGE)} />
</SettingItem>
<SettingItem dataL10nId='selectedLanguage'>
<select value={getSetting(settings.LANGUAGE, this.props.settings) || defaultLanguage}
onChange={changeSetting.bind(null, this.props.onChangeSetting, settings.LANGUAGE)} >
{languageOptions}
</select>
</SettingItem>
</SettingsList>
<SettingsList dataL10nId='bookmarkToolbarSettings'>
<div className='sectionTitle' data-l10n-id='bokmarksBarSettings' />
<SettingsList>
<SettingCheckbox dataL10nId='bookmarkToolbar' prefKey={settings.SHOW_BOOKMARKS_TOOLBAR} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} />
<SettingCheckbox dataL10nId='bookmarkToolbarShowFavicon' prefKey={settings.SHOW_BOOKMARKS_TOOLBAR_FAVICON} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} />
<SettingCheckbox dataL10nId='bookmarkToolbarShowOnlyFavicon' style={{ visibility: (getSetting(settings.SHOW_BOOKMARKS_TOOLBAR_FAVICON, this.props.settings) === true ? 'visible' : 'hidden') }} prefKey={settings.SHOW_BOOKMARKS_TOOLBAR_ONLY_FAVICON} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} />
<SettingCheckbox dataL10nId='bookmarkToolbarShowOnlyFavicon' style={{ display: (getSetting(settings.SHOW_BOOKMARKS_TOOLBAR_FAVICON, this.props.settings) === true ? 'block' : 'none') }} prefKey={settings.SHOW_BOOKMARKS_TOOLBAR_ONLY_FAVICON} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} />
</SettingsList>
<SettingsList dataL10nId='appearanceSettings'>
<div className='sectionTitle' data-l10n-id='appearanceSettings' />
<SettingsList>
<SettingCheckbox dataL10nId='showHomeButton' prefKey={settings.SHOW_HOME_BUTTON} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} />
{
isDarwin ? null : <SettingCheckbox dataL10nId='autoHideMenuBar' prefKey={settings.AUTO_HIDE_MENU} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} />
Expand All @@ -161,6 +164,7 @@ class GeneralTab extends ImmutableComponent {
class SearchTab extends ImmutableComponent {
render () {
return <div>
<div className='sectionTitle' data-l10n-id='searchSettings' />
<SettingsList>
<SettingItem dataL10nId='defaultSearchEngine'>
<select value={getSetting(settings.DEFAULT_SEARCH_ENGINE, this.props.settings)}
Expand All @@ -170,10 +174,11 @@ class SearchTab extends ImmutableComponent {
</select>
</SettingItem>
</SettingsList>
<SettingsList dataL10nId='suggestionTypes'>
<SettingCheckbox dataL10nId='history' prefKey={settings.HISTORY_SUGGESTIONS} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} />
<SettingCheckbox dataL10nId='bookmarks' prefKey={settings.BOOKMARK_SUGGESTIONS} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} />
<SettingCheckbox dataL10nId='openedTabs' prefKey={settings.OPENED_TAB_SUGGESTIONS} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} />
<div className='sectionTitle' data-l10n-id='locationBarSettings' />
<SettingsList>
<SettingCheckbox dataL10nId='showHistoryMatches' prefKey={settings.HISTORY_SUGGESTIONS} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} />
<SettingCheckbox dataL10nId='showBookmarkMatches' prefKey={settings.BOOKMARK_SUGGESTIONS} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} />
<SettingCheckbox dataL10nId='showOpenedTabMatches' prefKey={settings.OPENED_TAB_SUGGESTIONS} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} />
<SettingCheckbox dataL10nId='offerSearchSuggestions' prefKey={settings.OFFER_SEARCH_SUGGESTIONS} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} />
</SettingsList>
</div>
Expand All @@ -182,23 +187,26 @@ class SearchTab extends ImmutableComponent {

class TabsTab extends ImmutableComponent {
render () {
return <SettingsList>
<SettingItem dataL10nId='tabsPerTabPage'>
<select
value={getSetting(settings.TABS_PER_PAGE, this.props.settings)}
data-type='number'
onChange={changeSetting.bind(null, this.props.onChangeSetting, settings.TABS_PER_PAGE)}>
{
// Sorry, Brad says he hates primes :'(
[6, 8, 10, 20].map((x) =>
<option value={x} key={x}>{x}</option>)
}
</select>
</SettingItem>
<SettingCheckbox dataL10nId='switchToNewTabs' prefKey={settings.SWITCH_TO_NEW_TABS} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} />
<SettingCheckbox dataL10nId='paintTabs' prefKey={settings.PAINT_TABS} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} />
<SettingCheckbox dataL10nId='showTabPreviews' prefKey={settings.SHOW_TAB_PREVIEWS} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} />
</SettingsList>
return <div>
<div className='sectionTitle' data-l10n-id='tabSettings' />
<SettingsList>
<SettingItem dataL10nId='tabsPerTabPage'>
<select
value={getSetting(settings.TABS_PER_PAGE, this.props.settings)}
data-type='number'
onChange={changeSetting.bind(null, this.props.onChangeSetting, settings.TABS_PER_PAGE)}>
{
// Sorry, Brad says he hates primes :'(
[6, 8, 10, 20].map((x) =>
<option value={x} key={x}>{x}</option>)
}
</select>
</SettingItem>
<SettingCheckbox dataL10nId='switchToNewTabs' prefKey={settings.SWITCH_TO_NEW_TABS} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} />
<SettingCheckbox dataL10nId='paintTabs' prefKey={settings.PAINT_TABS} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} />
<SettingCheckbox dataL10nId='showTabPreviews' prefKey={settings.SHOW_TAB_PREVIEWS} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} />
</SettingsList>
</div>
}
}

Expand Down Expand Up @@ -238,7 +246,7 @@ class SitePermissionsPage extends React.Component {
render () {
return this.isPermissionsNonEmpty()
? <div id='sitePermissionsPage'>
<div data-l10n-id='sitePermissions'></div>
<div className='sectionTitle' data-l10n-id='sitePermissions' />
<ul className='sitePermissions'>
{
Object.keys(permissionNames).map((name) =>
Expand Down Expand Up @@ -322,7 +330,8 @@ class ShieldsTab extends ImmutableComponent {
}
render () {
return <div id='shieldsContainer'>
<SettingsList dataL10nId='braveryDefaults'>
<div className='sectionTitle' data-l10n-id='braveryDefaults' />
<SettingsList>
<SettingItem dataL10nId='adControl'>
<select value={this.props.braveryDefaults.get('adControl')} onChange={this.onChangeAdControl}>
<option data-l10n-id='showBraveAds' value='showBraveAds' />
Expand All @@ -341,9 +350,6 @@ class ShieldsTab extends ImmutableComponent {
<SettingCheckbox checked={this.props.braveryDefaults.get('noScript')} dataL10nId='noScript' onChange={this.onToggleNoScript} />
<SettingCheckbox dataL10nId='blockCanvasFingerprinting' prefKey={settings.BLOCK_CANVAS_FINGERPRINTING} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} />
</SettingsList>
<SettingsList dataL10nId='advancedPrivacySettings'>
<SettingCheckbox dataL10nId='doNotTrack' prefKey={settings.DO_NOT_TRACK} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} />
</SettingsList>
</div>
}
}
Expand All @@ -354,7 +360,15 @@ class SecurityTab extends ImmutableComponent {
}
render () {
return <div>
<SettingsList dataL10nId='passwordSettings'>
<div className='sectionTitle' data-l10n-id='privateData' />
<SettingsList dataL10nId='privateDataMessage'>
<SettingCheckbox dataL10nId='browsingHistory' prefKey={settings.SHUTDOWN_CLEAR_HISTORY} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} />
<SettingCheckbox dataL10nId='downloadHistory' prefKey={settings.SHUTDOWN_CLEAR_DOWNLOADS} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} />
<SettingCheckbox dataL10nId='cachedImagesAndFiles' prefKey={settings.SHUTDOWN_CLEAR_CACHE} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} />
<SettingCheckbox dataL10nId='allSiteCookies' prefKey={settings.SHUTDOWN_ALL_SITE_COOKIES} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} />
</SettingsList>
<div className='sectionTitle' data-l10n-id='passwordsAndForms' />
<SettingsList dataL10nId='passwordManager'>
<SettingCheckbox dataL10nId='usePasswordManager' prefKey={settings.PASSWORD_MANAGER_ENABLED} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting}
options={
getSetting(settings.PASSWORD_MANAGER_ENABLED, this.props.settings)
Expand All @@ -376,11 +390,15 @@ class SecurityTab extends ImmutableComponent {
} />
<SettingCheckbox dataL10nId='useDashlane' prefKey={settings.DASHLANE_ENABLED} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} />
</SettingsList>
<SettingsList dataL10nId='pluginSettings'>
<SettingCheckbox checked={this.props.flashInstalled ? this.props.braveryDefaults.get('flash') : false} dataL10nId='enableFlash' onChange={this.onToggleFlash} disabled={!this.props.flashInstalled} />
<div className='sectionTitle' data-l10n-id='doNotTrackTitle' />
<SettingsList>
<SettingCheckbox dataL10nId='doNotTrack' prefKey={settings.DO_NOT_TRACK} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} />
</SettingsList>
<div className='subtext'>
<span className='fa fa-info-circle' id='flashInfoIcon' />
<div className='sectionTitle' data-l10n-id='pluginSettings' />
<SettingsList>
<SettingCheckbox checked={this.props.flashInstalled ? this.props.braveryDefaults.get('flash') : false} dataL10nId='enableFlash' onChange={this.onToggleFlash} disabled={!this.props.flashInstalled} />
<span className='subtext'>
<span className='fa fa-info-circle' id='flashInfoIcon' />
{
isDarwin || isWindows
? <span><span data-l10n-id='enableFlashSubtext' />&nbsp;
Expand All @@ -389,7 +407,8 @@ class SecurityTab extends ImmutableComponent {
})}>{'Adobe'}</span>.</span>
: <span data-l10n-id='enableFlashSubtextLinux' />
}
</div>
</span>
</SettingsList>
<SitePermissionsPage siteSettings={this.props.siteSettings} />
</div>
}
Expand All @@ -399,7 +418,8 @@ class AdvancedTab extends ImmutableComponent {
render () {
const defaultZoomSetting = getSetting(settings.DEFAULT_ZOOM_LEVEL, this.props.settings)
return <div>
<SettingsList dataL10nId='contentRenderingOptions'>
<div className='sectionTitle' data-l10n-id='contentSettings' />
<SettingsList>
<SettingItem dataL10nId='defaultZoomLevel'>
<select
value={defaultZoomSetting === undefined || defaultZoomSetting === null ? config.zoom.defaultValue : defaultZoomSetting}
Expand Down Expand Up @@ -464,7 +484,7 @@ class HelpfulHints extends ImmutableComponent {
class PreferenceNavigation extends ImmutableComponent {
render () {
return <div className='prefAside'>
<div data-l10n-id='prefAsideTitle' />
<div />
<PreferenceNavigationButton icon='fa-list-alt'
dataL10nId='general'
onClick={this.props.changeTab.bind(null, preferenceTabs.GENERAL)}
Expand Down
6 changes: 5 additions & 1 deletion js/constants/appConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ module.exports = {
'general.disable-title-mode': process.platform === 'win32',
'advanced.hardware-acceleration-enabled': true,
'advanced.default-zoom-level': null,
'advanced.pdfjs-enabled': true
'advanced.pdfjs-enabled': true,
'shutdown.clear-history': false,
'shutdown.clear-downloads': false,
'shutdown.clear-cache': false,
'shutdown.all-site-cookies': false
},
uaExceptionHosts: [
'get.adobe.com', 'adobe.com', 'www.adobe.com', 'helpx.adobe.com'
Expand Down
4 changes: 4 additions & 0 deletions js/constants/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ const settings = {
ONE_PASSWORD_ENABLED: 'security.passwords.one-password-enabled',
LAST_PASS_ENABLED: 'security.passwords.last-pass-enabled',
DASHLANE_ENABLED: 'security.passwords.dashlane-enabled',
SHUTDOWN_CLEAR_HISTORY: 'shutdown.clear-history',
SHUTDOWN_CLEAR_DOWNLOADS: 'shutdown.clear-downloads',
SHUTDOWN_CLEAR_CACHE: 'shutdown.clear-cache',
SHUTDOWN_ALL_SITE_COOKIES: 'shutdown.all-site-cookies',
// Other settings
SHOW_BOOKMARKS_TOOLBAR: 'bookmarks.toolbar.show',
SHOW_BOOKMARKS_TOOLBAR_FAVICON: 'bookmarks.toolbar.showFavicon',
Expand Down
Loading

1 comment on commit 7fea211

@aekeus
Copy link
Member

@aekeus aekeus commented on 7fea211 Jul 14, 2016

Choose a reason for hiding this comment

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

++ preference changes look good

Please sign in to comment.