Changeset 109795 in webkit


Ignore:
Timestamp:
Mar 5, 2012 1:45:32 PM (12 years ago)
Author:
timothy@apple.com
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.
Location:
trunk/Source/WebKit2
Files:
3 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r109766 r109795  
     12012-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
    1162012-03-02  Jon Lee  <jonlee@apple.com>
    217
  • trunk/Source/WebKit2/UIProcess/API/C/mac/WKInspectorPrivateMac.h

    r109793 r109795  
    2424 */
    2525
    26 #ifndef WKInspectorMac_h
    27 #define WKInspectorMac_h
     26#ifndef WKInspectorPrivateMac_h
     27#define WKInspectorPrivateMac_h
    2828
    2929#ifdef __cplusplus
     
    3333const NSInteger WKInspectorViewTag = 1000;
    3434
     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.
     37WK_EXPORT @interface WKWebInspectorProxyObjCAdapter : NSObject <NSWindowDelegate>
     38@property (readonly) WKInspectorRef inspectorRef;
     39@end
     40
    3541#ifdef __cplusplus
    3642}
    3743#endif
    3844
    39 #endif // WKInspectorMac_h
     45#endif // WKInspectorPrivateMac_h
  • trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm

    r109002 r109795  
    3131#import "WKAPICast.h"
    3232#import "WebContext.h"
    33 #import "WKInspectorMac.h"
     33#import "WKInspectorPrivateMac.h"
    3434#import "WKViewPrivate.h"
    3535#import "WebPageGroup.h"
     
    5252// for the sole purpose of getting back into the C++ code from an ObjC caller.
    5353
    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
    5757
    5858- (id)initWithWebInspectorProxy:(WebInspectorProxy*)inspectorProxy;
     
    6161
    6262@implementation WKWebInspectorProxyObjCAdapter
     63
     64@synthesize _inspectorProxy;
     65
     66- (WKInspectorRef)inspectorRef
     67{
     68    return toAPI(_inspectorProxy);
     69}
    6370
    6471- (id)initWithWebInspectorProxy:(WebInspectorProxy*)inspectorProxy
     
    8289{
    8390    _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)sender
    90 {
    91     // This method is a toggle, so it will close the Web Inspector if it is already front. Since the window delegate is handling
    92     // the action, we know it is already showing, so we only need to support close here. To keep this working with older Safari
    93     // 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)sender
    99 {
    100     _inspectorProxy->showConsole();
    101 }
    102 
    103 - (void)showResources:(id)sender
    104 {
    105     _inspectorProxy->showResources();
    106 }
    107 
    108 - (void)viewSource:(id)sender
    109 {
    110     _inspectorProxy->showMainResourceForFrame(_inspectorProxy->page()->mainFrame());
    111 }
    112 
    113 - (void)toggleDebuggingJavaScript:(id)sender
    114 {
    115     _inspectorProxy->toggleJavaScriptDebugging();
    116 }
    117 
    118 - (void)toggleProfilingJavaScript:(id)sender
    119 {
    120     _inspectorProxy->toggleJavaScriptProfiling();
    121 }
    122 
    123 - (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item
    124 {
    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 handling
    129         // 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         else
    136             [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         else
    141             [menuItem setTitle:WEB_UI_STRING("Start Profiling JavaScript", "title for Start Profiling JavaScript menu item")];
    142     }
    143 
    144     return YES;
    14591}
    14692
  • trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj

    r109750 r109795  
    437437                65B86F1E12F11DE300B7DD8A /* WKBundleInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 65B86F1812F11D7B00B7DD8A /* WKBundleInspector.h */; settings = {ATTRIBUTES = (Private, ); }; };
    438438                6D8A91A611F0EFD100DD01FE /* com.apple.WebProcess.sb in Resources */ = {isa = PBXBuildFile; fileRef = 6D8A91A511F0EFD100DD01FE /* com.apple.WebProcess.sb */; };
    439                 6EE849C81368D9390038D481 /* WKInspectorMac.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, ); }; };
    440440                762B748D120BC75C00819339 /* WKPreferencesPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 762B7484120BBA2D00819339 /* WKPreferencesPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
    441441                7801C099142290C400FAF9AF /* WebHitTestResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7801C095142290C400FAF9AF /* WebHitTestResult.cpp */; };
     
    14551455                65B86F1812F11D7B00B7DD8A /* WKBundleInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleInspector.h; sourceTree = "<group>"; };
    14561456                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 /* WKInspectorMac.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>"; };
    14581458                762B7481120BBA0100819339 /* FontSmoothingLevel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontSmoothingLevel.h; sourceTree = "<group>"; };
    14591459                762B7484120BBA2D00819339 /* WKPreferencesPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPreferencesPrivate.h; sourceTree = "<group>"; };
     
    27082708                        isa = PBXGroup;
    27092709                        children = (
    2710                                 6EE849C61368D92D0038D481 /* WKInspectorMac.h */,
     2710                                6EE849C61368D92D0038D481 /* WKInspectorPrivateMac.h */,
    27112711                                BCE17B7B1381F1170012A641 /* WKPagePrivateMac.cpp */,
    27122712                                BCE17B7C1381F1170012A641 /* WKPagePrivateMac.h */,
     
    40994099                                BCCF6ACA12C91F59008F9C35 /* WKImageCG.h in Headers */,
    41004100                                1C8E293912761E5B00BC7BD0 /* WKInspector.h in Headers */,
    4101                                 6EE849C81368D9390038D481 /* WKInspectorMac.h in Headers */,
     4101                                6EE849C81368D9390038D481 /* WKInspectorPrivateMac.h in Headers */,
    41024102                                51A9E10B1315CD18009E7031 /* WKKeyValueStorageManager.h in Headers */,
    41034103                                33D3A3B61339600B00709BE4 /* WKMediaCacheManager.h in Headers */,
Note: See TracChangeset for help on using the changeset viewer.