Translate |disposition| to string
This commit is contained in:
		
					parent
					
						
							
								013593ccf8
							
						
					
				
			
			
				commit
				
					
						f29c7164f3
					
				
			
		
					 5 changed files with 16 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -91,7 +91,7 @@ bool WebContents::ShouldCreateWebContents(
 | 
			
		|||
  args.AppendString(target_url.spec());
 | 
			
		||||
  args.AppendString(frame_name);
 | 
			
		||||
  args.AppendInteger(CURRENT_TAB);
 | 
			
		||||
  Emit("new-window", args);
 | 
			
		||||
  Emit("-new-window", args);
 | 
			
		||||
  return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -107,7 +107,7 @@ content::WebContents* WebContents::OpenURLFromTab(
 | 
			
		|||
    args.AppendString(params.url.spec());
 | 
			
		||||
    args.AppendString("");
 | 
			
		||||
    args.AppendInteger(params.disposition);
 | 
			
		||||
    Emit("new-window", args);
 | 
			
		||||
    Emit("-new-window", args);
 | 
			
		||||
    return NULL;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -91,7 +91,7 @@ void Window::WillCreatePopupWindow(const base::string16& frame_name,
 | 
			
		|||
  args.AppendString(target_url.spec());
 | 
			
		||||
  args.AppendString(frame_name);
 | 
			
		||||
  args.AppendInteger(disposition);
 | 
			
		||||
  Emit("new-window", args);
 | 
			
		||||
  Emit("-new-window", args);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Window::WillCloseWindow(bool* prevent_default) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -25,7 +25,7 @@ BrowserWindow::_init = ->
 | 
			
		|||
    enumerable: true
 | 
			
		||||
 | 
			
		||||
  # Make new windows requested by links behave like "window.open"
 | 
			
		||||
  @on 'new-window', (event, url, frameName) =>
 | 
			
		||||
  @on '-new-window', (event, url, frameName) =>
 | 
			
		||||
    event.sender = @webContents
 | 
			
		||||
    options = show: true, width: 800, height: 600
 | 
			
		||||
    ipc.emit 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPEN', event, url, frameName, options
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,6 +26,17 @@ module.exports.wrap = (webContents) ->
 | 
			
		|||
  webContents.getId = -> "#{@getProcessId()}-#{@getRoutingId()}"
 | 
			
		||||
  webContents.equal = (other) -> @getId() is other.getId()
 | 
			
		||||
 | 
			
		||||
  # Translate |disposition| to string for 'new-window' event.
 | 
			
		||||
  webContents.on '-new-window', (args..., disposition) ->
 | 
			
		||||
    disposition =
 | 
			
		||||
      switch disposition
 | 
			
		||||
        when 2 then 'default'
 | 
			
		||||
        when 4 then 'foreground-tab'
 | 
			
		||||
        when 5 then 'background-tab'
 | 
			
		||||
        when 6, 7 then 'new-window'
 | 
			
		||||
        else 'other'
 | 
			
		||||
    @emit 'new-window', args..., disposition
 | 
			
		||||
 | 
			
		||||
  # Tell the rpc server that a render view has been deleted and we need to
 | 
			
		||||
  # release all objects owned by it.
 | 
			
		||||
  webContents.on 'render-view-deleted', (event, processId, routingId) ->
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -34,7 +34,7 @@ createGuest = (embedder, url, frameName, options) ->
 | 
			
		|||
 | 
			
		||||
# Routed window.open messages.
 | 
			
		||||
ipc.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPEN', (event, args...) ->
 | 
			
		||||
  event.sender.emit 'new-window', event, args...
 | 
			
		||||
  event.sender.emit '-new-window', event, args...
 | 
			
		||||
  if event.sender.isGuest() or event.defaultPrevented
 | 
			
		||||
    event.returnValue = null
 | 
			
		||||
  else
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue