Reviewed by John Sullivan.
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Oct 2007 23:12:35 +0000 (23:12 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Oct 2007 23:12:35 +0000 (23:12 +0000)
        Move the developer extras preference to WebPreferences.

        * WebView/WebPreferenceKeysPrivate.h: Add WebKitDeveloperExtrasEnabledPreferenceKey
        * WebView/WebPreferences.m:
        (+[WebPreferences initialize]): Initialize WebKitDeveloperExtrasEnabledPreferenceKey to NO.
        (-[WebPreferences developerExtrasEnabled]): Check DisableWebKitDeveloperExtras, WebKitDeveloperExtras
          and IncludeDebugMenu in addition to WebKitDeveloperExtrasEnabledPreferenceKey.
        (-[WebPreferences setDeveloperExtrasEnabled:]): Set WebKitDeveloperExtrasEnabledPreferenceKey.
        * WebView/WebPreferencesPrivate.h: Add developerExtrasEnabled and setDeveloperExtrasEnabled:.
        * WebView/WebView.mm:
        (+[WebView _developerExtrasEnabled]): Removed.
        (-[WebView _preferencesChangedNotification:]): Check the WebPreferences object for developerExtrasEnabled.
        * WebView/WebViewPrivate.h: Removed _developerExtrasEnabled.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27332 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/ChangeLog
WebKit/WebView/WebPreferenceKeysPrivate.h
WebKit/WebView/WebPreferences.m
WebKit/WebView/WebPreferencesPrivate.h
WebKit/WebView/WebView.mm
WebKit/WebView/WebViewPrivate.h

index 78a3a1f7931aeaa7135853b61ad1c56fe9e76fa0..b1ddd3ced05cf0e7124a95d7c1080368784d27f9 100644 (file)
@@ -1,3 +1,21 @@
+2007-10-31  Timothy Hatcher  <timothy@apple.com>
+
+        Reviewed by John Sullivan.
+
+        Move the developer extras preference to WebPreferences.
+
+        * WebView/WebPreferenceKeysPrivate.h: Add WebKitDeveloperExtrasEnabledPreferenceKey
+        * WebView/WebPreferences.m:
+        (+[WebPreferences initialize]): Initialize WebKitDeveloperExtrasEnabledPreferenceKey to NO.
+        (-[WebPreferences developerExtrasEnabled]): Check DisableWebKitDeveloperExtras, WebKitDeveloperExtras
+          and IncludeDebugMenu in addition to WebKitDeveloperExtrasEnabledPreferenceKey.
+        (-[WebPreferences setDeveloperExtrasEnabled:]): Set WebKitDeveloperExtrasEnabledPreferenceKey.
+        * WebView/WebPreferencesPrivate.h: Add developerExtrasEnabled and setDeveloperExtrasEnabled:.
+        * WebView/WebView.mm:
+        (+[WebView _developerExtrasEnabled]): Removed.
+        (-[WebView _preferencesChangedNotification:]): Check the WebPreferences object for developerExtrasEnabled.
+        * WebView/WebViewPrivate.h: Removed _developerExtrasEnabled.
+
 2007-10-30  David D. Kilzer  <ddkilzer@webkit.org>
 
         Generated files missing from WebCore's Xcode project file
index eee51377e2ca334a2ebf1cbcd875e5b01ebe84af..bb4882e6a388c01b857ae6dc810b1729f0a28ba4 100644 (file)
@@ -62,6 +62,7 @@
 #define WebKitUsesPageCachePreferenceKey @"WebKitUsesPageCachePreferenceKey"
 #define WebKitFTPDirectoryTemplatePath @"WebKitFTPDirectoryTemplatePath"
 #define WebKitForceFTPDirectoryListings @"WebKitForceFTPDirectoryListings"
+#define WebKitDeveloperExtrasEnabledPreferenceKey @"WebKitDeveloperExtrasEnabledPreferenceKey"
 
 // These are private both because callers should be using the cover methods and because the
 // cover methods themselves are private.
index 32de498c6351ba366a1f0bb364cf047717eafd88..dda288e1dca851842f8c3e6177d6b00069309307 100644 (file)
@@ -328,6 +328,7 @@ static WebCacheModel cacheModelForMainBundle(void)
         [NSNumber numberWithBool:NO],   WebKitDOMPasteAllowedPreferenceKey,
         [NSNumber numberWithBool:YES],  WebKitUsesPageCachePreferenceKey,
         [NSNumber numberWithInt:cacheModelForMainBundle()], WebKitCacheModelPreferenceKey,
+        [NSNumber numberWithBool:NO],  WebKitDeveloperExtrasEnabledPreferenceKey,
         nil];
 
     // This value shouldn't ever change, which is assumed in the initialization of WebKitPDFDisplayModePreferenceKey above
@@ -705,6 +706,25 @@ static WebCacheModel cacheModelForMainBundle(void)
 
 @implementation WebPreferences (WebPrivate)
 
+- (BOOL)developerExtrasEnabled
+{
+    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+    if ([defaults boolForKey:@"DisableWebKitDeveloperExtras"])
+        return NO;
+#ifdef NDEBUG
+    if ([defaults boolForKey:@"WebKitDeveloperExtras"] || [defaults boolForKey:@"IncludeDebugMenu"])
+        return YES;
+    return [self _boolValueForKey:WebKitDeveloperExtrasEnabledPreferenceKey];
+#else
+    return YES; // always enable in debug builds
+#endif
+}
+
+- (void)setDeveloperExtrasEnabled:(BOOL)flag
+{
+    [self _setBoolValue:flag forKey:WebKitDeveloperExtrasEnabledPreferenceKey];
+}
+
 - (BOOL)respectStandardStyleKeyEquivalents
 {
     return [self _boolValueForKey:WebKitRespectStandardStyleKeyEquivalentsPreferenceKey];
index 4401d62b83505d55726a0fb0c08eda659812094b..37701d9a9956a1522ce068e623999f637d5fc526 100644 (file)
@@ -44,6 +44,10 @@ extern NSString *WebPreferencesRemovedNotification;
 @interface WebPreferences (WebPrivate)
 
 // Preferences that might be public in a future release
+
+- (BOOL)developerExtrasEnabled;
+- (void)setDeveloperExtrasEnabled:(BOOL)flag;
+
 - (BOOL)respectStandardStyleKeyEquivalents;
 - (void)setRespectStandardStyleKeyEquivalents:(BOOL)flag;
 
index 081c5be9a494cfac35789083c7ebcecaf78f73e6..614d917b30b200ea8c5f567dd04d5d473112de6e 100644 (file)
@@ -558,21 +558,6 @@ static bool debugWidget = true;
 }
 #endif
 
-+ (BOOL)_developerExtrasEnabled
-{
-    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-    if ([defaults boolForKey:@"DisableWebKitDeveloperExtras"])
-        return NO;
-#ifdef NDEBUG
-    BOOL enableDebugger = [defaults boolForKey:@"WebKitDeveloperExtras"];
-    if (!enableDebugger)
-        enableDebugger = [defaults boolForKey:@"IncludeDebugMenu"];
-    return enableDebugger;
-#else
-    return YES; // always enable in debug builds
-#endif
-}
-
 + (BOOL)_scriptDebuggerEnabled
 {
 #ifdef NDEBUG
@@ -949,7 +934,7 @@ static bool debugWidget = true;
     settings->setDOMPasteAllowed([preferences isDOMPasteAllowed]);
     settings->setUsesPageCache([self usesPageCache]);
     settings->setShowsURLsInToolTips([preferences showsURLsInToolTips]);
-    settings->setDeveloperExtrasEnabled([WebView _developerExtrasEnabled]);
+    settings->setDeveloperExtrasEnabled([preferences developerExtrasEnabled]);
     if ([preferences userStyleSheetEnabled]) {
         NSString* location = [[preferences userStyleSheetLocation] _web_originalDataAsString];
         settings->setUserStyleSheetLocation([NSURL URLWithString:(location ? location : @"")]);
index 9885097dbb6ba73645602ca80bca34489c213006..6c4babb8e213aa1ef029e2db8ce1b7dc4c51aeae 100644 (file)
@@ -150,7 +150,6 @@ typedef enum {
 
 @interface WebView (WebPrivate)
 
-+ (BOOL)_developerExtrasEnabled;
 + (BOOL)_scriptDebuggerEnabled;
 
 - (WebInspector *)inspector;