Title: [109795] trunk/Source/WebKit2
Revision
109795
Author
timo...@apple.com
Date
2012-03-05 13:45:32 -0800 (Mon, 05 Mar 2012)

Log Message

Change how the Web Inspector Develop menu actions work.

This removes the methods used by Safari's Develop menu. They can now be implemented in Safari.

https://webkit.org/b/80308

Reviewed by John Sullivan.

* UIProcess/API/C/mac/WKInspectorPrivateMac.h: Renamed from Source/WebKit2/UIProcess/API/C/mac/WKInspectorMac.h.
* UIProcess/mac/WebInspectorProxyMac.mm:
(-[WKWebInspectorProxyObjCAdapter inspectorRef]): Added.
* WebKit2.xcodeproj/project.pbxproj: Renamed WKInspectorPrivateMac.h to better reflect its private nature.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (109794 => 109795)


--- trunk/Source/WebKit2/ChangeLog	2012-03-05 21:44:05 UTC (rev 109794)
+++ trunk/Source/WebKit2/ChangeLog	2012-03-05 21:45:32 UTC (rev 109795)
@@ -1,3 +1,18 @@
+2012-03-05  Timothy Hatcher  <timo...@apple.com>
+
+        Change how the Web Inspector Develop menu actions work.
+
+        This removes the methods used by Safari's Develop menu. They can now be implemented in Safari.
+
+        https://webkit.org/b/80308
+
+        Reviewed by John Sullivan.
+
+        * UIProcess/API/C/mac/WKInspectorPrivateMac.h: Renamed from Source/WebKit2/UIProcess/API/C/mac/WKInspectorMac.h.
+        * UIProcess/mac/WebInspectorProxyMac.mm:
+        (-[WKWebInspectorProxyObjCAdapter inspectorRef]): Added.
+        * WebKit2.xcodeproj/project.pbxproj: Renamed WKInspectorPrivateMac.h to better reflect its private nature.
+
 2012-03-02  Jon Lee  <jon...@apple.com>
 
         Add support for notification replaceId in Mac WebKit and WK2

Deleted: trunk/Source/WebKit2/UIProcess/API/C/mac/WKInspectorMac.h (109794 => 109795)


--- trunk/Source/WebKit2/UIProcess/API/C/mac/WKInspectorMac.h	2012-03-05 21:44:05 UTC (rev 109794)
+++ trunk/Source/WebKit2/UIProcess/API/C/mac/WKInspectorMac.h	2012-03-05 21:45:32 UTC (rev 109795)
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef WKInspectorMac_h
-#define WKInspectorMac_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-const NSInteger WKInspectorViewTag = 1000;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // WKInspectorMac_h

Copied: trunk/Source/WebKit2/UIProcess/API/C/mac/WKInspectorPrivateMac.h (from rev 109793, trunk/Source/WebKit2/UIProcess/API/C/mac/WKInspectorMac.h) (0 => 109795)


--- trunk/Source/WebKit2/UIProcess/API/C/mac/WKInspectorPrivateMac.h	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/C/mac/WKInspectorPrivateMac.h	2012-03-05 21:45:32 UTC (rev 109795)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WKInspectorPrivateMac_h
+#define WKInspectorPrivateMac_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+const NSInteger WKInspectorViewTag = 1000;
+
+// This class is the Web Inspector window delegate. It can be used to add interface
+// actions that need to work when the Web Inspector window is key.
+WK_EXPORT @interface WKWebInspectorProxyObjCAdapter : NSObject <NSWindowDelegate>
+@property (readonly) WKInspectorRef inspectorRef;
+@end
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // WKInspectorPrivateMac_h

Modified: trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm (109794 => 109795)


--- trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm	2012-03-05 21:44:05 UTC (rev 109794)
+++ trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm	2012-03-05 21:45:32 UTC (rev 109795)
@@ -30,7 +30,7 @@
 
 #import "WKAPICast.h"
 #import "WebContext.h"
-#import "WKInspectorMac.h"
+#import "WKInspectorPrivateMac.h"
 #import "WKViewPrivate.h"
 #import "WebPageGroup.h"
 #import "WebPageProxy.h"
@@ -51,16 +51,23 @@
 // WKWebInspectorProxyObjCAdapter is a helper ObjC object used as a delegate or notification observer
 // for the sole purpose of getting back into the C++ code from an ObjC caller.
 
-@interface WKWebInspectorProxyObjCAdapter : NSObject <NSWindowDelegate> {
-    WebInspectorProxy* _inspectorProxy; // Not retained to prevent cycles
-}
+@interface WKWebInspectorProxyObjCAdapter ()
 
+@property (assign) WebInspectorProxy* _inspectorProxy; // Not retained to prevent cycles
+
 - (id)initWithWebInspectorProxy:(WebInspectorProxy*)inspectorProxy;
 
 @end
 
 @implementation WKWebInspectorProxyObjCAdapter
 
+@synthesize _inspectorProxy;
+
+- (WKInspectorRef)inspectorRef
+{
+    return toAPI(_inspectorProxy);
+}
+
 - (id)initWithWebInspectorProxy:(WebInspectorProxy*)inspectorProxy
 {
     ASSERT_ARG(inspectorProxy, inspectorProxy);
@@ -83,67 +90,6 @@
     _inspectorProxy->inspectedViewFrameDidChange();
 }
 
-// These methods can be used by UI elements such as menu items and toolbar buttons when the inspector is the main/key window.
-// These methods are really only implemented to keep  UI elements enabled and working.
-
-- (void)showWebInspector:(id)sender
-{
-    // This method is a toggle, so it will close the Web Inspector if it is already front. Since the window delegate is handling
-    // the action, we know it is already showing, so we only need to support close here. To keep this working with older Safari
-    // builds the method name is still just "showWebInspector:" instead of something like "toggleWebInspector:".
-    ASSERT(_inspectorProxy->isFront());
-    _inspectorProxy->close();
-}
-
-- (void)showErrorConsole:(id)sender
-{
-    _inspectorProxy->showConsole();
-}
-
-- (void)showResources:(id)sender
-{
-    _inspectorProxy->showResources();
-}
-
-- (void)viewSource:(id)sender
-{
-    _inspectorProxy->showMainResourceForFrame(_inspectorProxy->page()->mainFrame());
-}
-
-- (void)toggleDebuggingJavaScript:(id)sender
-{
-    _inspectorProxy->toggleJavaScriptDebugging();
-}
-
-- (void)toggleProfilingJavaScript:(id)sender
-{
-    _inspectorProxy->toggleJavaScriptProfiling();
-}
-
-- (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item
-{
-    BOOL isMenuItem = [(id)item isKindOfClass:[NSMenuItem class]];
-    NSMenuItem *menuItem = (NSMenuItem *)item;
-    if ([item action] == @selector(showWebInspector:) && isMenuItem) {
-        // This action is a toggle, so it will close the Web Inspector if it is already front. Since the window delegate is handling
-        // the action, we know it is already showing, so we only need to update the title to mention hide.
-        ASSERT(_inspectorProxy->isFront());
-        [menuItem setTitle:WEB_UI_STRING("Hide Web Inspector", "title for Hide Web Inspector menu item")];
-    } else if ([item action] == @selector(toggleDebuggingJavaScript:) && isMenuItem) {
-        if (_inspectorProxy->isDebuggingJavaScript())
-            [menuItem setTitle:WEB_UI_STRING("Stop Debugging _javascript_", "title for Stop Debugging _javascript_ menu item")];
-        else
-            [menuItem setTitle:WEB_UI_STRING("Start Debugging _javascript_", "title for Start Debugging _javascript_ menu item")];
-    } else if ([item action] == @selector(toggleProfilingJavaScript:) && isMenuItem) {
-        if (_inspectorProxy->isProfilingJavaScript())
-            [menuItem setTitle:WEB_UI_STRING("Stop Profiling _javascript_", "title for Stop Profiling _javascript_ menu item")];
-        else
-            [menuItem setTitle:WEB_UI_STRING("Start Profiling _javascript_", "title for Start Profiling _javascript_ menu item")];
-    }
-
-    return YES;
-}
-
 @end
 
 @interface WKWebInspectorWKView : WKView

Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (109794 => 109795)


--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2012-03-05 21:44:05 UTC (rev 109794)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2012-03-05 21:45:32 UTC (rev 109795)
@@ -436,7 +436,7 @@
 		659C551E130006410025C0C2 /* InjectedBundlePageResourceLoadClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6546A82913000164000CEB1C /* InjectedBundlePageResourceLoadClient.cpp */; };
 		65B86F1E12F11DE300B7DD8A /* WKBundleInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 65B86F1812F11D7B00B7DD8A /* WKBundleInspector.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		6D8A91A611F0EFD100DD01FE /* com.apple.WebProcess.sb in Resources */ = {isa = PBXBuildFile; fileRef = 6D8A91A511F0EFD100DD01FE /* com.apple.WebProcess.sb */; };
-		6EE849C81368D9390038D481 /* WKInspectorMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EE849C61368D92D0038D481 /* WKInspectorMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		6EE849C81368D9390038D481 /* WKInspectorPrivateMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EE849C61368D92D0038D481 /* WKInspectorPrivateMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		762B748D120BC75C00819339 /* WKPreferencesPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 762B7484120BBA2D00819339 /* WKPreferencesPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		7801C099142290C400FAF9AF /* WebHitTestResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7801C095142290C400FAF9AF /* WebHitTestResult.cpp */; };
 		7801C09A142290C400FAF9AF /* WebHitTestResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 7801C096142290C400FAF9AF /* WebHitTestResult.h */; };
@@ -1454,7 +1454,7 @@
 		65B86F1712F11D7B00B7DD8A /* WKBundleInspector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundleInspector.cpp; sourceTree = "<group>"; };
 		65B86F1812F11D7B00B7DD8A /* WKBundleInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleInspector.h; sourceTree = "<group>"; };
 		6D8A91A511F0EFD100DD01FE /* com.apple.WebProcess.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = com.apple.WebProcess.sb; path = WebProcess/com.apple.WebProcess.sb; sourceTree = "<group>"; };
-		6EE849C61368D92D0038D481 /* WKInspectorMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKInspectorMac.h; path = mac/WKInspectorMac.h; sourceTree = "<group>"; };
+		6EE849C61368D92D0038D481 /* WKInspectorPrivateMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKInspectorPrivateMac.h; path = mac/WKInspectorPrivateMac.h; sourceTree = "<group>"; };
 		762B7481120BBA0100819339 /* FontSmoothingLevel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontSmoothingLevel.h; sourceTree = "<group>"; };
 		762B7484120BBA2D00819339 /* WKPreferencesPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPreferencesPrivate.h; sourceTree = "<group>"; };
 		7801C095142290C400FAF9AF /* WebHitTestResult.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebHitTestResult.cpp; sourceTree = "<group>"; };
@@ -2707,7 +2707,7 @@
 		6EE849C41368D9040038D481 /* mac */ = {
 			isa = PBXGroup;
 			children = (
-				6EE849C61368D92D0038D481 /* WKInspectorMac.h */,
+				6EE849C61368D92D0038D481 /* WKInspectorPrivateMac.h */,
 				BCE17B7B1381F1170012A641 /* WKPagePrivateMac.cpp */,
 				BCE17B7C1381F1170012A641 /* WKPagePrivateMac.h */,
 			);
@@ -4098,7 +4098,7 @@
 				BCCF6AC312C91F34008F9C35 /* WKImage.h in Headers */,
 				BCCF6ACA12C91F59008F9C35 /* WKImageCG.h in Headers */,
 				1C8E293912761E5B00BC7BD0 /* WKInspector.h in Headers */,
-				6EE849C81368D9390038D481 /* WKInspectorMac.h in Headers */,
+				6EE849C81368D9390038D481 /* WKInspectorPrivateMac.h in Headers */,
 				51A9E10B1315CD18009E7031 /* WKKeyValueStorageManager.h in Headers */,
 				33D3A3B61339600B00709BE4 /* WKMediaCacheManager.h in Headers */,
 				BC4075FE124FF0270068F20A /* WKMutableArray.h in Headers */,
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to