Camino only - Bug 344982: Fix and expose 'Enable plug-ins' preference. Patch by Chris Lawson <bugzilla@chrislawson.net> r=kreeger sr=smorgan

This commit is contained in:
stridey%gmail.com 2007-01-26 20:09:47 +00:00
Родитель a029c42b33
Коммит 1c0aaf9c4c
6 изменённых файлов: 61 добавлений и 20 удалений

Просмотреть файл

@ -21,6 +21,7 @@
clickEnableImageResizing = id;
clickEnableJS = id;
clickEnableJava = id;
clickEnablePlugins = id;
clickEnablePopupBlocking = id;
clickPreventAnimation = id;
clickTabFocusCheckboxes = id;
@ -38,6 +39,7 @@
mEnableAnnoyanceBlocker = NSButton;
mEnableJS = NSButton;
mEnableJava = NSButton;
mEnablePlugins = NSButton;
mEnablePopupBlocking = NSButton;
mImageResize = NSButton;
mPreventAnimation = NSButton;

Просмотреть файл

@ -3,14 +3,13 @@
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
<string>41 6 356 240 0 0 1024 746 </string>
<string>2 4 356 240 0 0 1024 746 </string>
<key>IBFramework Version</key>
<string>446.1</string>
<key>IBOldestOS</key>
<integer>2</integer>
<key>IBOpenObjects</key>
<array>
<integer>312</integer>
<integer>5</integer>
</array>
<key>IBSystem Version</key>

Двоичные данные
camino/PreferencePanes/WebFeatures/English.lproj/WebFeatures.nib/keyedobjects.nib сгенерированный

Двоичный файл не отображается.

Просмотреть файл

@ -51,6 +51,7 @@ class nsISupportsArray;
{
IBOutlet NSButton* mEnableJS;
IBOutlet NSButton* mEnableJava;
IBOutlet NSButton* mEnablePlugins;
IBOutlet NSButton *mEnablePopupBlocking;
IBOutlet NSButton *mEnableAdBlocking;
@ -74,6 +75,7 @@ class nsISupportsArray;
-(IBAction) clickEnableJS:(id)sender;
-(IBAction) clickEnableJava:(id)sender;
-(IBAction) clickEnablePlugins:(id)sender;
-(IBAction) clickEnablePopupBlocking:(id)sender;
-(IBAction) clickEnableAdBlocking:(id)sender;

Просмотреть файл

@ -59,6 +59,9 @@ static NSString* XPCOMShutDownNotificationName = @"XPCOMShutDown";
// needs to match the string in PreferenceManager.mm
static NSString* const AdBlockingChangedNotificationName = @"AdBlockingChanged";
// for camino.enable_plugins; needs to match string in BrowserWrapper.mm
static NSString* const kEnablePluginsChangedNotificationName = @"EnablePluginsChanged";
// for accessibility.tabfocus
const int kFocusLinks = (1 << 2);
const int kFocusForms = (1 << 1);
@ -113,6 +116,11 @@ const int kAnnoyancePrefSome = 3;
BOOL javaEnabled = [self getBooleanPref:"security.enable_java" withSuccess:&gotPref] && gotPref;
[mEnableJava setState:javaEnabled];
// Set initial value on Plug-ins checkbox.
// If we fail to get the pref, ensure we leave plugins enabled by default.
BOOL pluginsEnabled = [self getBooleanPref:"camino.enable_plugins" withSuccess:&gotPref] || !gotPref;
[mEnablePlugins setState:pluginsEnabled];
// set initial value on popup blocking checkbox and disable the whitelist
// button if it's off
BOOL enablePopupBlocking = [self getBooleanPref:"dom.disable_open_during_load" withSuccess:&gotPref] && gotPref;
@ -152,23 +160,34 @@ const int kAnnoyancePrefSome = 3;
//
// clickEnableJS
// -clickEnableJS:
//
// Set pref if JavaScript is enabled
// Enable and disable JavaScript
//
-(IBAction) clickEnableJS:(id)sender
{
[self setPref:"javascript.enabled" toBoolean:[sender state] == NSOnState];
[self setPref:"javascript.enabled" toBoolean:([sender state] == NSOnState)];
}
//
// clickEnableJava
// -clickEnableJava:
//
// Set pref if Java is enabled
// Enable and disable Java
//
-(IBAction) clickEnableJava:(id)sender
{
[self setPref:"security.enable_java" toBoolean:[sender state] == NSOnState];
[self setPref:"security.enable_java" toBoolean:([sender state] == NSOnState)];
}
//
// -clickEnablePlugins:
//
// Enable and disable plugins
//
-(IBAction) clickEnablePlugins:(id)sender
{
[self setPref:"camino.enable_plugins" toBoolean:([sender state] == NSOnState)];
[[NSNotificationCenter defaultCenter] postNotificationName:kEnablePluginsChangedNotificationName object:nil];
}
//
@ -179,7 +198,7 @@ const int kAnnoyancePrefSome = 3;
//
- (IBAction)clickEnableAdBlocking:(id)sender
{
[self setPref:"camino.enable_ad_blocking" toBoolean:[sender state] == NSOnState];
[self setPref:"camino.enable_ad_blocking" toBoolean:([sender state] == NSOnState)];
[[NSNotificationCenter defaultCenter] postNotificationName:AdBlockingChangedNotificationName object:nil];
}
@ -191,7 +210,7 @@ const int kAnnoyancePrefSome = 3;
//
- (IBAction)clickEnablePopupBlocking:(id)sender
{
[self setPref:"dom.disable_open_during_load" toBoolean:[sender state] == NSOnState];
[self setPref:"dom.disable_open_during_load" toBoolean:([sender state] == NSOnState)];
[mEditWhitelist setEnabled:[sender state]];
}
@ -202,7 +221,7 @@ const int kAnnoyancePrefSome = 3;
//
-(IBAction) clickEnableImageResizing:(id)sender
{
[self setPref:"browser.enable_automatic_image_resizing" toBoolean:[sender state] == NSOnState];
[self setPref:"browser.enable_automatic_image_resizing" toBoolean:([sender state] == NSOnState)];
}
//

Просмотреть файл

@ -86,6 +86,9 @@ class nsIDOMPopupBlockedEvent;
static NSString* const kOfflineNotificationName = @"offlineModeChanged";
// for camino.enable_plugins; needs to match string in WebFeatures.mm
static NSString* const kEnablePluginsChangedNotificationName = @"EnablePluginsChanged";
// types of status bar messages, in order of priority for showing to the user
enum {
eStatusLinkTarget = 0, // link mouseover info
@ -112,6 +115,7 @@ enum {
- (NSString*)displayTitleForPageURL:(NSString*)inURL title:(NSString*)inTitle;
- (void)updateOfflineStatus;
- (void)updatePluginsEnabledState;
- (void)checkForCustomViewOnLoad:(NSString*)inURL;
@ -159,11 +163,8 @@ enum {
mProgress = 0.0;
mFeedList = nil;
BOOL gotPref;
BOOL pluginsEnabled = [[PreferenceManager sharedInstance] getBooleanPref:"camino.enable_plugins" withSuccess:&gotPref];
if (gotPref && !pluginsEnabled)
[mBrowserView setProperty:nsIWebBrowserSetup::SETUP_ALLOW_PLUGINS toValue:PR_FALSE];
[self updatePluginsEnabledState];
mToolTip = [[ToolTip alloc] init];
//[self setSiteIconImage:[NSImage imageNamed:@"globe_ico"]];
@ -710,6 +711,15 @@ enum {
mOffline = offline;
}
- (void)updatePluginsEnabledState
{
BOOL gotPref;
BOOL pluginsEnabled = [[PreferenceManager sharedInstance] getBooleanPref:"camino.enable_plugins" withSuccess:&gotPref];
// If we can't get the pref, ensure we leave plugins enabled.
[mBrowserView setProperty:nsIWebBrowserSetup::SETUP_ALLOW_PLUGINS toValue:(gotPref ? pluginsEnabled : YES)];
}
//
// onShowTooltip:where:withText
//
@ -866,6 +876,11 @@ enum {
[mDelegate updateWindowTitle:newWindowTitle];
}
- (void)enablePluginsChanged:(NSNotification*)aNote
{
[self updatePluginsEnabledState];
}
//
// sizeBrowserTo
//
@ -1009,11 +1024,15 @@ enum {
- (void)registerNotificationListener
{
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(imageLoadedNotification:)
name: SiteIconLoadNotificationName
object: self];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(imageLoadedNotification:)
name:SiteIconLoadNotificationName
object:self];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(enablePluginsChanged:)
name:kEnablePluginsChangedNotificationName
object:nil];
}
// called when [[SiteIconProvider sharedFavoriteIconProvider] fetchFavoriteIconForPage:...] completes