refactor: move IPC handlers from navigation-controller to rpc-server (#26846)
This commit is contained in:
		
					parent
					
						
							
								7677576da8
							
						
					
				
			
			
				commit
				
					
						c41b8d536b
					
				
			
		
					 2 changed files with 16 additions and 19 deletions
				
			
		|  | @ -1,24 +1,5 @@ | ||||||
| import { ipcMainInternal } from '@electron/internal/browser/ipc-main-internal'; |  | ||||||
| import type { WebContents, LoadURLOptions } from 'electron/main'; | import type { WebContents, LoadURLOptions } from 'electron/main'; | ||||||
| import { EventEmitter } from 'events'; | import { EventEmitter } from 'events'; | ||||||
| import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages'; |  | ||||||
| 
 |  | ||||||
| // The history operation in renderer is redirected to browser.
 |  | ||||||
| ipcMainInternal.on(IPC_MESSAGES.NAVIGATION_CONTROLLER_GO_BACK, function (event) { |  | ||||||
|   event.sender.goBack(); |  | ||||||
| }); |  | ||||||
| 
 |  | ||||||
| ipcMainInternal.on(IPC_MESSAGES.NAVIGATION_CONTROLLER_GO_FORWARD, function (event) { |  | ||||||
|   event.sender.goForward(); |  | ||||||
| }); |  | ||||||
| 
 |  | ||||||
| ipcMainInternal.on(IPC_MESSAGES.NAVIGATION_CONTROLLER_GO_TO_OFFSET, function (event, offset) { |  | ||||||
|   event.sender.goToOffset(offset); |  | ||||||
| }); |  | ||||||
| 
 |  | ||||||
| ipcMainInternal.on(IPC_MESSAGES.NAVIGATION_CONTROLLER_LENGTH, function (event) { |  | ||||||
|   event.returnValue = event.sender.length(); |  | ||||||
| }); |  | ||||||
| 
 | 
 | ||||||
| // JavaScript implementation of Chromium's NavigationController.
 | // JavaScript implementation of Chromium's NavigationController.
 | ||||||
| // Instead of relying on Chromium for history control, we completely do history
 | // Instead of relying on Chromium for history control, we completely do history
 | ||||||
|  |  | ||||||
|  | @ -100,6 +100,22 @@ ipcMainUtils.handleSync(IPC_MESSAGES.BROWSER_SANDBOX_LOAD, async function (event | ||||||
|   }; |   }; | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
|  | ipcMainInternal.on(IPC_MESSAGES.NAVIGATION_CONTROLLER_GO_BACK, function (event) { | ||||||
|  |   event.sender.goBack(); | ||||||
|  | }); | ||||||
|  | 
 | ||||||
|  | ipcMainInternal.on(IPC_MESSAGES.NAVIGATION_CONTROLLER_GO_FORWARD, function (event) { | ||||||
|  |   event.sender.goForward(); | ||||||
|  | }); | ||||||
|  | 
 | ||||||
|  | ipcMainInternal.on(IPC_MESSAGES.NAVIGATION_CONTROLLER_GO_TO_OFFSET, function (event, offset) { | ||||||
|  |   event.sender.goToOffset(offset); | ||||||
|  | }); | ||||||
|  | 
 | ||||||
|  | ipcMainInternal.on(IPC_MESSAGES.NAVIGATION_CONTROLLER_LENGTH, function (event) { | ||||||
|  |   event.returnValue = event.sender.length(); | ||||||
|  | }); | ||||||
|  | 
 | ||||||
| ipcMainInternal.on(IPC_MESSAGES.BROWSER_PRELOAD_ERROR, function (event, preloadPath: string, error: Error) { | ipcMainInternal.on(IPC_MESSAGES.BROWSER_PRELOAD_ERROR, function (event, preloadPath: string, error: Error) { | ||||||
|   event.sender.emit('preload-error', event, preloadPath, error); |   event.sender.emit('preload-error', event, preloadPath, error); | ||||||
| }); | }); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Milan Burda
				Milan Burda