This repository was archived by the owner on Dec 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 969
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 #9154 from brave/navigation-state2
Navigation state
- Loading branch information
Showing
32 changed files
with
846 additions
and
385 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
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,40 @@ | ||
/* 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 dispatchAction = require('../../common/dispatcher/dispatchAction') | ||
|
||
const tabActions = { | ||
// TODO(bridiver) - this is an action anti-pattern and the code that uses it should be refactored | ||
// to be declarative | ||
reload: function tabActionsReload (tabId, ignoreCache) { | ||
dispatchAction(tabActions.reload.name, { | ||
tabId, | ||
ignoreCache | ||
}) | ||
}, | ||
|
||
didFinishNavigation: function tabActionsDidFinishNavigation (tabId, navigationState, windowId) { | ||
dispatchAction(tabActions.didFinishNavigation.name, { | ||
tabId, | ||
navigationState, | ||
queryInfo: { | ||
windowId | ||
} | ||
}) | ||
}, | ||
|
||
didStartNavigation: function tabActionsDidStartNavigation (tabId, navigationState, windowId) { | ||
dispatchAction(tabActions.didFinishNavigation.name, { | ||
tabId, | ||
navigationState, | ||
queryInfo: { | ||
windowId | ||
} | ||
}) | ||
} | ||
} | ||
|
||
module.exports = tabActions |
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,17 @@ | ||
module.exports = function (name, action) { | ||
action = Object.assign({ | ||
actionType: name | ||
}, action) | ||
|
||
if (typeof chrome !== 'undefined' && typeof chrome.ipcRenderer === 'object') { | ||
chrome.ipcRenderer.send('dispatch-action', JSON.stringify(action)) | ||
} else if (typeof process !== 'undefined') { | ||
if (process.type === 'browser' && typeof process.emit === 'function') { | ||
process.emit('dispatch-action', action) | ||
} else if (process.type === 'worker' && typeof postMessage === 'function') { | ||
postMessage({message: 'dispatch-action', action}) | ||
} | ||
} else { | ||
throw new Error('Unsupported environment for dispatch') | ||
} | ||
} |
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.