зеркало из https://github.com/mozilla/pjs.git
Hookup mozilla pref about re-using the window on a GURL event
This commit is contained in:
Родитель
2ab04a2ac9
Коммит
b3b8884b90
|
@ -108,6 +108,7 @@ class nsIDOMNode;
|
|||
-(CHBrowserWrapper*)getBrowserWrapper;
|
||||
|
||||
- (void)loadURL:(NSURL*)aURL;
|
||||
- (void)loadURLString:(NSString*)aStr;
|
||||
- (void)updateLocationFields:(NSString *)locationString;
|
||||
- (void)updateToolbarItems;
|
||||
- (void)focusURLBar;
|
||||
|
|
|
@ -564,6 +564,12 @@ static NSString *PrintToolbarItemIdentifier = @"Print Toolbar Item";
|
|||
}
|
||||
|
||||
|
||||
-(void)loadURLString:(NSString*)aStr
|
||||
{
|
||||
[self loadURL:[NSURL URLWithString:aStr]];
|
||||
}
|
||||
|
||||
|
||||
-(void)loadURL:(NSURL*)aURL
|
||||
{
|
||||
if (mInitialized) {
|
||||
|
|
|
@ -24,11 +24,34 @@
|
|||
#import "CHGetURLCommand.h"
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
#import "BrowserWindowController.h"
|
||||
|
||||
#include "nsIPref.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
|
||||
@implementation CHGetURLCommand
|
||||
|
||||
- (id)performDefaultImplementation {
|
||||
id controller = [[NSApp delegate] openBrowserWindowWithURLString: [self directParameter]];
|
||||
- (id)performDefaultImplementation
|
||||
{
|
||||
// get the pref that specifies if we want to re-use the existing window or
|
||||
// open a new one. There's really no point caching this pref.
|
||||
PRBool reuseWindow = PR_FALSE;
|
||||
nsCOMPtr<nsIPref> prefService ( do_GetService(NS_PREF_CONTRACTID) );
|
||||
if ( prefService )
|
||||
prefService->GetBoolPref("browser.always_reuse_window", &reuseWindow);
|
||||
|
||||
BrowserWindowController* controller = nsnull;
|
||||
if ( reuseWindow ) {
|
||||
controller = [[NSApp mainWindow] windowController];
|
||||
[controller loadURLString:[self directParameter]];
|
||||
[[[controller getBrowserWrapper] getBrowserView] setActive: YES];
|
||||
}
|
||||
else
|
||||
controller = [[NSApp delegate] openBrowserWindowWithURLString: [self directParameter]];
|
||||
|
||||
[[[controller getBrowserWrapper] getBrowserView] setActive: YES];
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -24,11 +24,34 @@
|
|||
#import "CHGetURLCommand.h"
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
#import "BrowserWindowController.h"
|
||||
|
||||
#include "nsIPref.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
|
||||
@implementation CHGetURLCommand
|
||||
|
||||
- (id)performDefaultImplementation {
|
||||
id controller = [[NSApp delegate] openBrowserWindowWithURLString: [self directParameter]];
|
||||
- (id)performDefaultImplementation
|
||||
{
|
||||
// get the pref that specifies if we want to re-use the existing window or
|
||||
// open a new one. There's really no point caching this pref.
|
||||
PRBool reuseWindow = PR_FALSE;
|
||||
nsCOMPtr<nsIPref> prefService ( do_GetService(NS_PREF_CONTRACTID) );
|
||||
if ( prefService )
|
||||
prefService->GetBoolPref("browser.always_reuse_window", &reuseWindow);
|
||||
|
||||
BrowserWindowController* controller = nsnull;
|
||||
if ( reuseWindow ) {
|
||||
controller = [[NSApp mainWindow] windowController];
|
||||
[controller loadURLString:[self directParameter]];
|
||||
[[[controller getBrowserWrapper] getBrowserView] setActive: YES];
|
||||
}
|
||||
else
|
||||
controller = [[NSApp delegate] openBrowserWindowWithURLString: [self directParameter]];
|
||||
|
||||
[[[controller getBrowserWrapper] getBrowserView] setActive: YES];
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -108,6 +108,7 @@ class nsIDOMNode;
|
|||
-(CHBrowserWrapper*)getBrowserWrapper;
|
||||
|
||||
- (void)loadURL:(NSURL*)aURL;
|
||||
- (void)loadURLString:(NSString*)aStr;
|
||||
- (void)updateLocationFields:(NSString *)locationString;
|
||||
- (void)updateToolbarItems;
|
||||
- (void)focusURLBar;
|
||||
|
|
|
@ -564,6 +564,12 @@ static NSString *PrintToolbarItemIdentifier = @"Print Toolbar Item";
|
|||
}
|
||||
|
||||
|
||||
-(void)loadURLString:(NSString*)aStr
|
||||
{
|
||||
[self loadURL:[NSURL URLWithString:aStr]];
|
||||
}
|
||||
|
||||
|
||||
-(void)loadURL:(NSURL*)aURL
|
||||
{
|
||||
if (mInitialized) {
|
||||
|
|
|
@ -108,6 +108,7 @@ class nsIDOMNode;
|
|||
-(CHBrowserWrapper*)getBrowserWrapper;
|
||||
|
||||
- (void)loadURL:(NSURL*)aURL;
|
||||
- (void)loadURLString:(NSString*)aStr;
|
||||
- (void)updateLocationFields:(NSString *)locationString;
|
||||
- (void)updateToolbarItems;
|
||||
- (void)focusURLBar;
|
||||
|
|
|
@ -564,6 +564,12 @@ static NSString *PrintToolbarItemIdentifier = @"Print Toolbar Item";
|
|||
}
|
||||
|
||||
|
||||
-(void)loadURLString:(NSString*)aStr
|
||||
{
|
||||
[self loadURL:[NSURL URLWithString:aStr]];
|
||||
}
|
||||
|
||||
|
||||
-(void)loadURL:(NSURL*)aURL
|
||||
{
|
||||
if (mInitialized) {
|
||||
|
|
|
@ -24,11 +24,34 @@
|
|||
#import "CHGetURLCommand.h"
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
#import "BrowserWindowController.h"
|
||||
|
||||
#include "nsIPref.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
|
||||
@implementation CHGetURLCommand
|
||||
|
||||
- (id)performDefaultImplementation {
|
||||
id controller = [[NSApp delegate] openBrowserWindowWithURLString: [self directParameter]];
|
||||
- (id)performDefaultImplementation
|
||||
{
|
||||
// get the pref that specifies if we want to re-use the existing window or
|
||||
// open a new one. There's really no point caching this pref.
|
||||
PRBool reuseWindow = PR_FALSE;
|
||||
nsCOMPtr<nsIPref> prefService ( do_GetService(NS_PREF_CONTRACTID) );
|
||||
if ( prefService )
|
||||
prefService->GetBoolPref("browser.always_reuse_window", &reuseWindow);
|
||||
|
||||
BrowserWindowController* controller = nsnull;
|
||||
if ( reuseWindow ) {
|
||||
controller = [[NSApp mainWindow] windowController];
|
||||
[controller loadURLString:[self directParameter]];
|
||||
[[[controller getBrowserWrapper] getBrowserView] setActive: YES];
|
||||
}
|
||||
else
|
||||
controller = [[NSApp delegate] openBrowserWindowWithURLString: [self directParameter]];
|
||||
|
||||
[[[controller getBrowserWrapper] getBrowserView] setActive: YES];
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -24,11 +24,34 @@
|
|||
#import "CHGetURLCommand.h"
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
#import "BrowserWindowController.h"
|
||||
|
||||
#include "nsIPref.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
|
||||
@implementation CHGetURLCommand
|
||||
|
||||
- (id)performDefaultImplementation {
|
||||
id controller = [[NSApp delegate] openBrowserWindowWithURLString: [self directParameter]];
|
||||
- (id)performDefaultImplementation
|
||||
{
|
||||
// get the pref that specifies if we want to re-use the existing window or
|
||||
// open a new one. There's really no point caching this pref.
|
||||
PRBool reuseWindow = PR_FALSE;
|
||||
nsCOMPtr<nsIPref> prefService ( do_GetService(NS_PREF_CONTRACTID) );
|
||||
if ( prefService )
|
||||
prefService->GetBoolPref("browser.always_reuse_window", &reuseWindow);
|
||||
|
||||
BrowserWindowController* controller = nsnull;
|
||||
if ( reuseWindow ) {
|
||||
controller = [[NSApp mainWindow] windowController];
|
||||
[controller loadURLString:[self directParameter]];
|
||||
[[[controller getBrowserWrapper] getBrowserView] setActive: YES];
|
||||
}
|
||||
else
|
||||
controller = [[NSApp delegate] openBrowserWindowWithURLString: [self directParameter]];
|
||||
|
||||
[[[controller getBrowserWrapper] getBrowserView] setActive: YES];
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -108,6 +108,7 @@ class nsIDOMNode;
|
|||
-(CHBrowserWrapper*)getBrowserWrapper;
|
||||
|
||||
- (void)loadURL:(NSURL*)aURL;
|
||||
- (void)loadURLString:(NSString*)aStr;
|
||||
- (void)updateLocationFields:(NSString *)locationString;
|
||||
- (void)updateToolbarItems;
|
||||
- (void)focusURLBar;
|
||||
|
|
|
@ -564,6 +564,12 @@ static NSString *PrintToolbarItemIdentifier = @"Print Toolbar Item";
|
|||
}
|
||||
|
||||
|
||||
-(void)loadURLString:(NSString*)aStr
|
||||
{
|
||||
[self loadURL:[NSURL URLWithString:aStr]];
|
||||
}
|
||||
|
||||
|
||||
-(void)loadURL:(NSURL*)aURL
|
||||
{
|
||||
if (mInitialized) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче