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 971
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6247 from brave/chromium54
Chromium54
- Loading branch information
Showing
126 changed files
with
4,466 additions
and
1,998 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,5 +1,5 @@ | ||
runtime = electron | ||
target = 1.4.0 | ||
target = 2.0.4 | ||
target_arch = x64 | ||
brave_electron_version = 1.4.31 | ||
disturl = https://atom.io/download/atom-shell | ||
brave_electron_version = 2.0.4 | ||
disturl = http://brave-laptop-binaries.s3.amazonaws.com/atom-shell/dist |
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,33 @@ | ||
/* 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 { makeImmutable } = require('../../common/state/immutableUtil') | ||
|
||
let registeredSessions = {} | ||
|
||
module.exports.setContentSettings = (contentSettings) => { | ||
contentSettings = makeImmutable(contentSettings) | ||
contentSettings.forEach((settings, contentType) => { | ||
for (let partition in registeredSessions) { | ||
registeredSessions[partition].contentSettings.clearForOneType(contentType) | ||
} | ||
settings.forEach((setting) => { | ||
module.exports.setContentSetting(setting.get('primaryPattern'), setting.get('secondaryPattern'), | ||
contentType, setting.get('resourceId'), setting.get('setting')) | ||
}) | ||
for (let partition in registeredSessions) { | ||
registeredSessions[partition].webRequest.handleBehaviorChanged() | ||
} | ||
}) | ||
} | ||
|
||
module.exports.setContentSetting = (primaryUrl, secondaryUrl = '*', contentType, resourceId = '', setting) => { | ||
for (var partition in registeredSessions) { | ||
registeredSessions[partition].contentSettings.set(primaryUrl, secondaryUrl, contentType, resourceId, setting) | ||
} | ||
} | ||
|
||
module.exports.init = (ses, partition, isPrivate) => { | ||
registeredSessions[partition] = ses | ||
} |
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,27 @@ | ||
/* 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 downloadStates = require('../../js/constants/downloadStates') | ||
|
||
/** | ||
* Maps downloadId to an electron download-item | ||
*/ | ||
const downloadMap = {} | ||
|
||
module.exports.updateElectronDownloadItem = (downloadId, item, state) => { | ||
if (state === downloadStates.INTERRUPTED || state === downloadStates.CANCELLED || state === downloadStates.COMPLETED) { | ||
delete downloadMap[downloadId] | ||
} else { | ||
downloadMap[downloadId] = item | ||
} | ||
} | ||
|
||
module.exports.cancelDownload = (downloadId) => | ||
downloadMap[downloadId] && downloadMap[downloadId].cancel() | ||
|
||
module.exports.pauseDownload = (downloadId) => | ||
downloadMap[downloadId] && downloadMap[downloadId].pause() | ||
|
||
module.exports.resumeDownload = (downloadId) => | ||
downloadMap[downloadId] && downloadMap[downloadId].resume() |
This file was deleted.
Oops, something went wrong.
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,96 @@ | ||
/* 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 downloadStates = require('../../../js/constants/downloadStates') | ||
const {clipboard, BrowserWindow, shell} = require('electron') | ||
const fs = require('fs') | ||
const path = require('path') | ||
const {cancelDownload, pauseDownload, resumeDownload} = require('../electronDownloadItem') | ||
const {CANCEL, PAUSE, RESUME} = require('../../common/constants/electronDownloadItemActions') | ||
|
||
const downloadsReducer = (state, action) => { | ||
const download = action.downloadId ? state.getIn(['downloads', action.downloadId]) : undefined | ||
if (!download && | ||
![appConstants.APP_MERGE_DOWNLOAD_DETAIL, | ||
appConstants.APP_CLEAR_COMPLETED_DOWNLOADS].includes(action.actionType)) { | ||
return state | ||
} | ||
switch (action.actionType) { | ||
case appConstants.APP_DOWNLOAD_REVEALED: | ||
fs.exists(download.get('savePath'), (exists) => { | ||
if (exists) { | ||
shell.showItemInFolder(download.get('savePath')) | ||
} else { | ||
shell.openItem(path.dirname(download.get('savePath'))) | ||
} | ||
}) | ||
break | ||
case appConstants.APP_DOWNLOAD_OPENED: | ||
fs.exists(download.get('savePath'), (exists) => { | ||
if (exists) { | ||
shell.openItem(download.get('savePath')) | ||
} else { | ||
shell.beep() | ||
} | ||
}) | ||
break | ||
case appConstants.APP_DOWNLOAD_ACTION_PERFORMED: | ||
switch (action.downloadAction) { | ||
case CANCEL: | ||
// It's important to update state before the cancel since it'll remove the reference | ||
state = state.setIn(['downloads', action.downloadId, 'state'], downloadStates.CANCELLED) | ||
cancelDownload(action.downloadId) | ||
break | ||
case PAUSE: | ||
pauseDownload(action.downloadId) | ||
state = state.setIn(['downloads', action.downloadId, 'state'], downloadStates.PAUSED) | ||
break | ||
case RESUME: | ||
resumeDownload(action.downloadId) | ||
state = state.setIn(['downloads', action.downloadId, 'state'], downloadStates.IN_PROGRESS) | ||
break | ||
} | ||
break | ||
case appConstants.APP_DOWNLOAD_COPIED_TO_CLIPBOARD: | ||
clipboard.writeText(download.get('url')) | ||
break | ||
case appConstants.APP_DOWNLOAD_DELETED: | ||
shell.moveItemToTrash(download.get('savePath')) | ||
state = state.deleteIn(['downloads', action.downloadId]) | ||
break | ||
case appConstants.APP_DOWNLOAD_CLEARED: | ||
state = state.deleteIn(['downloads', action.downloadId]) | ||
break | ||
case appConstants.APP_DOWNLOAD_REDOWNLOADED: | ||
const win = BrowserWindow.getFocusedWindow() | ||
if (win) { | ||
win.webContents.downloadURL(download.get('url')) | ||
state = state.deleteIn(['downloads', action.downloadId]) | ||
} else { | ||
shell.beep() | ||
} | ||
break | ||
case appConstants.APP_MERGE_DOWNLOAD_DETAIL: | ||
if (action.downloadDetail) { | ||
state = state.mergeIn(['downloads', action.downloadId], action.downloadDetail) | ||
} else { | ||
state = state.deleteIn(['downloads', action.downloadId]) | ||
} | ||
break | ||
case appConstants.APP_CLEAR_COMPLETED_DOWNLOADS: | ||
if (state.get('downloads')) { | ||
const downloads = state.get('downloads') | ||
.filter((download) => | ||
![downloadStates.COMPLETED, downloadStates.INTERRUPTED, downloadStates.CANCELLED].includes(download.get('state'))) | ||
state = state.set('downloads', downloads) | ||
} | ||
break | ||
} | ||
return state | ||
} | ||
|
||
module.exports = downloadsReducer |
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,21 @@ | ||
/* 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 flash = require('../../../js/flash') | ||
const {makeImmutable} = require('../../common/state/immutableUtil') | ||
|
||
const flashReducer = (state, action) => { | ||
action = makeImmutable(action) | ||
switch (action.get('actionType')) { | ||
case appConstants.APP_SET_STATE: | ||
flash.init() | ||
break | ||
} | ||
return state | ||
} | ||
|
||
module.exports = flashReducer |
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,51 @@ | ||
/* 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 appConfig = require('../../../js/constants/appConfig') | ||
const appConstants = require('../../../js/constants/appConstants') | ||
const tabs = require('../tabs') | ||
const tabState = require('../../common/state/tabState') | ||
const windowConstants = require('../../../js/constants/windowConstants') | ||
const { makeImmutable } = require('../../common/state/immutableUtil') | ||
|
||
const tabsReducer = (state, action) => { | ||
action = makeImmutable(action) | ||
switch (action.get('actionType')) { | ||
case appConstants.APP_SET_STATE: | ||
state = tabs.init(state, action) | ||
break | ||
case appConstants.APP_TAB_CREATED: | ||
state = tabState.maybeCreateTab(state, action) | ||
break | ||
case appConstants.APP_TAB_UPDATED: | ||
state = tabState.maybeCreateTab(state, action) | ||
break | ||
case appConstants.APP_CLOSE_TAB: | ||
state = tabs.removeTab(state, action) | ||
break | ||
case appConstants.APP_TAB_CLOSED: | ||
state = tabState.removeTab(state, action) | ||
break | ||
case appConstants.APP_ALLOW_FLASH_ONCE: | ||
case appConstants.APP_ALLOW_FLASH_ALWAYS: | ||
{ | ||
const webContents = tabs.getWebContents(action.get('tabId')) | ||
if (webContents && !webContents.isDestroyed() && webContents.getURL() === action.get('url')) { | ||
webContents.authorizePlugin(appConfig.flash.resourceId) | ||
} | ||
break | ||
} | ||
case windowConstants.WINDOW_SET_AUDIO_MUTED: | ||
state = tabs.setAudioMuted(state, action) | ||
break | ||
case windowConstants.WINDOW_CLOSE_FRAME: | ||
state = tabState.closeFrame(state, action) | ||
break | ||
} | ||
return state | ||
} | ||
|
||
module.exports = tabsReducer |
Oops, something went wrong.