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.
- Loading branch information
Showing
308 changed files
with
6,738 additions
and
5,016 deletions.
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 |
---|---|---|
@@ -1,6 +1,19 @@ | ||
Submitter Checklist: | ||
|
||
- [ ] Submitted a [ticket](https://github.com/brave/browser-laptop/issues) for my issue if one did not already exist. | ||
- [ ] Used Github [auto-closing keywords](https://help.github.com/articles/closing-issues-via-commit-messages/) in the commit message. | ||
- [ ] Added/updated tests for this change (for new code or code which already has tests). | ||
- [ ] Ran `git rebase -i` to squash commits (if needed). | ||
|
||
Test Plan: | ||
|
||
|
||
Reviewer Checklist: | ||
|
||
Tests | ||
|
||
|
||
- [ ] Adequate test coverage exists to prevent regressions | ||
- [ ] Tests should be independent and work correctly when run indivually or as a suite [ref](https://github.com/brave/browser-laptop/wiki/Code-Guidelines#test-dependencies) | ||
|
||
|
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
runtime = electron | ||
target_arch = x64 | ||
brave_electron_version = 2.58.8 | ||
brave_electron_version = 3.0.100 | ||
chromedriver_version = 2.27 | ||
target = v2.58.8 | ||
disturl=http://brave-laptop-binaries.s3.amazonaws.com/atom-shell/dist/ | ||
target = v3.0.1 | ||
disturl=https://brave-laptop-binaries.s3.amazonaws.com/atom-shell/dist/ | ||
build_from_source = true |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* 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/. */ | ||
|
||
'use strict' | ||
|
||
const appConstants = require('../../../js/constants/appConstants') | ||
const {makeImmutable} = require('../../common/state/immutableUtil') | ||
const {ipcMain, webContents} = require('electron') | ||
const AppStore = require('../../../js/stores/appStore') | ||
const siteSettings = require('../../../js/state/siteSettings') | ||
const appActions = require('../../../js/actions/appActions') | ||
const {getOrigin} = require('../../../js/state/siteUtil') | ||
const locale = require('../../locale') | ||
const messages = require('../../../js/constants/messages') | ||
const urlParse = require('../../common/urlParse') | ||
|
||
const showAutoplayMessageBox = (tabId) => { | ||
const tab = webContents.fromTabID(tabId) | ||
if (!tab || tab.isDestroyed()) { | ||
return | ||
} | ||
const location = tab.getURL() | ||
const origin = getOrigin(location) | ||
const originSettings = siteSettings.getSiteSettingsForURL(AppStore.getState().get('siteSettings'), origin) | ||
if (originSettings && originSettings.get('noAutoplay') === true) { | ||
return | ||
} | ||
const message = locale.translation('allowAutoplay', {origin}) | ||
|
||
appActions.showNotification({ | ||
buttons: [ | ||
{text: locale.translation('yes')}, | ||
{text: locale.translation('no')} | ||
], | ||
message, | ||
frameOrigin: origin, | ||
options: { | ||
persist: true | ||
} | ||
}) | ||
|
||
ipcMain.once(messages.NOTIFICATION_RESPONSE, (e, msg, buttonIndex, persist) => { | ||
if (msg === message) { | ||
appActions.hideNotification(message) | ||
let ruleKey = origin | ||
const parsedUrl = urlParse(location) | ||
if ((parsedUrl.protocol === 'https:' || parsedUrl.protocol === 'http:')) { | ||
ruleKey = `https?://${parsedUrl.host}` | ||
} | ||
if (buttonIndex === 0) { | ||
appActions.changeSiteSetting(ruleKey, 'noAutoplay', false) | ||
|
||
if (tab && !tab.isDestroyed()) { | ||
tab.reload() | ||
} | ||
} else { | ||
if (persist) { | ||
appActions.changeSiteSetting(ruleKey, 'noAutoplay', true) | ||
} | ||
} | ||
} | ||
}) | ||
} | ||
|
||
const autoplayReducer = (state, action, immutableAction) => { | ||
action = immutableAction || makeImmutable(action) | ||
switch (action.get('actionType')) { | ||
case appConstants.APP_AUTOPLAY_BLOCKED: | ||
showAutoplayMessageBox(action.get('tabId')) | ||
break | ||
} | ||
return state | ||
} | ||
|
||
module.exports = autoplayReducer |
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
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
Oops, something went wrong.