Changeset 109795 in webkit
- Timestamp:
- Mar 5, 2012 1:45:32 PM (12 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 3 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r109766 r109795 1 2012-03-05 Timothy Hatcher <timothy@apple.com> 2 3 Change how the Web Inspector Develop menu actions work. 4 5 This removes the methods used by Safari's Develop menu. They can now be implemented in Safari. 6 7 https://webkit.org/b/80308 8 9 Reviewed by John Sullivan. 10 11 * UIProcess/API/C/mac/WKInspectorPrivateMac.h: Renamed from Source/WebKit2/UIProcess/API/C/mac/WKInspectorMac.h. 12 * UIProcess/mac/WebInspectorProxyMac.mm: 13 (-[WKWebInspectorProxyObjCAdapter inspectorRef]): Added. 14 * WebKit2.xcodeproj/project.pbxproj: Renamed WKInspectorPrivateMac.h to better reflect its private nature. 15 1 16 2012-03-02 Jon Lee <jonlee@apple.com> 2 17 -
trunk/Source/WebKit2/UIProcess/API/C/mac/WKInspectorPrivateMac.h
r109793 r109795 24 24 */ 25 25 26 #ifndef WKInspector Mac_h27 #define WKInspector Mac_h26 #ifndef WKInspectorPrivateMac_h 27 #define WKInspectorPrivateMac_h 28 28 29 29 #ifdef __cplusplus … … 33 33 const NSInteger WKInspectorViewTag = 1000; 34 34 35 // This class is the Web Inspector window delegate. It can be used to add interface 36 // actions that need to work when the Web Inspector window is key. 37 WK_EXPORT @interface WKWebInspectorProxyObjCAdapter : NSObject <NSWindowDelegate> 38 @property (readonly) WKInspectorRef inspectorRef; 39 @end 40 35 41 #ifdef __cplusplus 36 42 } 37 43 #endif 38 44 39 #endif // WKInspector Mac_h45 #endif // WKInspectorPrivateMac_h -
trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm
r109002 r109795 31 31 #import "WKAPICast.h" 32 32 #import "WebContext.h" 33 #import "WKInspector Mac.h"33 #import "WKInspectorPrivateMac.h" 34 34 #import "WKViewPrivate.h" 35 35 #import "WebPageGroup.h" … … 52 52 // for the sole purpose of getting back into the C++ code from an ObjC caller. 53 53 54 @interface WKWebInspectorProxyObjCAdapter : NSObject <NSWindowDelegate> {55 WebInspectorProxy* _inspectorProxy; // Not retained to prevent cycles 56 } 54 @interface WKWebInspectorProxyObjCAdapter () 55 56 @property (assign) WebInspectorProxy* _inspectorProxy; // Not retained to prevent cycles 57 57 58 58 - (id)initWithWebInspectorProxy:(WebInspectorProxy*)inspectorProxy; … … 61 61 62 62 @implementation WKWebInspectorProxyObjCAdapter 63 64 @synthesize _inspectorProxy; 65 66 - (WKInspectorRef)inspectorRef 67 { 68 return toAPI(_inspectorProxy); 69 } 63 70 64 71 - (id)initWithWebInspectorProxy:(WebInspectorProxy*)inspectorProxy … … 82 89 { 83 90 _inspectorProxy->inspectedViewFrameDidChange(); 84 }85 86 // These methods can be used by UI elements such as menu items and toolbar buttons when the inspector is the main/key window.87 // These methods are really only implemented to keep UI elements enabled and working.88 89 - (void)showWebInspector:(id)sender90 {91 // This method is a toggle, so it will close the Web Inspector if it is already front. Since the window delegate is handling92 // the action, we know it is already showing, so we only need to support close here. To keep this working with older Safari93 // builds the method name is still just "showWebInspector:" instead of something like "toggleWebInspector:".94 ASSERT(_inspectorProxy->isFront());95 _inspectorProxy->close();96 }97 98 - (void)showErrorConsole:(id)sender99 {100 _inspectorProxy->showConsole();101 }102 103 - (void)showResources:(id)sender104 {105 _inspectorProxy->showResources();106 }107 108 - (void)viewSource:(id)sender109 {110 _inspectorProxy->showMainResourceForFrame(_inspectorProxy->page()->mainFrame());111 }112 113 - (void)toggleDebuggingJavaScript:(id)sender114 {115 _inspectorProxy->toggleJavaScriptDebugging();116 }117 118 - (void)toggleProfilingJavaScript:(id)sender119 {120 _inspectorProxy->toggleJavaScriptProfiling();121 }122 123 - (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item124 {125 BOOL isMenuItem = [(id)item isKindOfClass:[NSMenuItem class]];126 NSMenuItem *menuItem = (NSMenuItem *)item;127 if ([item action] == @selector(showWebInspector:) && isMenuItem) {128 // This action is a toggle, so it will close the Web Inspector if it is already front. Since the window delegate is handling129 // the action, we know it is already showing, so we only need to update the title to mention hide.130 ASSERT(_inspectorProxy->isFront());131 [menuItem setTitle:WEB_UI_STRING("Hide Web Inspector", "title for Hide Web Inspector menu item")];132 } else if ([item action] == @selector(toggleDebuggingJavaScript:) && isMenuItem) {133 if (_inspectorProxy->isDebuggingJavaScript())134 [menuItem setTitle:WEB_UI_STRING("Stop Debugging JavaScript", "title for Stop Debugging JavaScript menu item")];135 else136 [menuItem setTitle:WEB_UI_STRING("Start Debugging JavaScript", "title for Start Debugging JavaScript menu item")];137 } else if ([item action] == @selector(toggleProfilingJavaScript:) && isMenuItem) {138 if (_inspectorProxy->isProfilingJavaScript())139 [menuItem setTitle:WEB_UI_STRING("Stop Profiling JavaScript", "title for Stop Profiling JavaScript menu item")];140 else141 [menuItem setTitle:WEB_UI_STRING("Start Profiling JavaScript", "title for Start Profiling JavaScript menu item")];142 }143 144 return YES;145 91 } 146 92 -
trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
r109750 r109795 437 437 65B86F1E12F11DE300B7DD8A /* WKBundleInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 65B86F1812F11D7B00B7DD8A /* WKBundleInspector.h */; settings = {ATTRIBUTES = (Private, ); }; }; 438 438 6D8A91A611F0EFD100DD01FE /* com.apple.WebProcess.sb in Resources */ = {isa = PBXBuildFile; fileRef = 6D8A91A511F0EFD100DD01FE /* com.apple.WebProcess.sb */; }; 439 6EE849C81368D9390038D481 /* WKInspector Mac.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EE849C61368D92D0038D481 /* WKInspectorMac.h */; settings = {ATTRIBUTES = (Private, ); }; };439 6EE849C81368D9390038D481 /* WKInspectorPrivateMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EE849C61368D92D0038D481 /* WKInspectorPrivateMac.h */; settings = {ATTRIBUTES = (Private, ); }; }; 440 440 762B748D120BC75C00819339 /* WKPreferencesPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 762B7484120BBA2D00819339 /* WKPreferencesPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 441 441 7801C099142290C400FAF9AF /* WebHitTestResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7801C095142290C400FAF9AF /* WebHitTestResult.cpp */; }; … … 1455 1455 65B86F1812F11D7B00B7DD8A /* WKBundleInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleInspector.h; sourceTree = "<group>"; }; 1456 1456 6D8A91A511F0EFD100DD01FE /* com.apple.WebProcess.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = com.apple.WebProcess.sb; path = WebProcess/com.apple.WebProcess.sb; sourceTree = "<group>"; }; 1457 6EE849C61368D92D0038D481 /* WKInspector Mac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKInspectorMac.h; path = mac/WKInspectorMac.h; sourceTree = "<group>"; };1457 6EE849C61368D92D0038D481 /* WKInspectorPrivateMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKInspectorPrivateMac.h; path = mac/WKInspectorPrivateMac.h; sourceTree = "<group>"; }; 1458 1458 762B7481120BBA0100819339 /* FontSmoothingLevel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontSmoothingLevel.h; sourceTree = "<group>"; }; 1459 1459 762B7484120BBA2D00819339 /* WKPreferencesPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPreferencesPrivate.h; sourceTree = "<group>"; }; … … 2708 2708 isa = PBXGroup; 2709 2709 children = ( 2710 6EE849C61368D92D0038D481 /* WKInspector Mac.h */,2710 6EE849C61368D92D0038D481 /* WKInspectorPrivateMac.h */, 2711 2711 BCE17B7B1381F1170012A641 /* WKPagePrivateMac.cpp */, 2712 2712 BCE17B7C1381F1170012A641 /* WKPagePrivateMac.h */, … … 4099 4099 BCCF6ACA12C91F59008F9C35 /* WKImageCG.h in Headers */, 4100 4100 1C8E293912761E5B00BC7BD0 /* WKInspector.h in Headers */, 4101 6EE849C81368D9390038D481 /* WKInspector Mac.h in Headers */,4101 6EE849C81368D9390038D481 /* WKInspectorPrivateMac.h in Headers */, 4102 4102 51A9E10B1315CD18009E7031 /* WKKeyValueStorageManager.h in Headers */, 4103 4103 33D3A3B61339600B00709BE4 /* WKMediaCacheManager.h in Headers */,
Note: See TracChangeset
for help on using the changeset viewer.