1 /* 2 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of 14 * its contributors may be used to endorse or promote products derived 15 * from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 #import <WebKit/WebUIDelegate.h> 30 31 #if !defined(ENABLE_DASHBOARD_SUPPORT) 32 #define ENABLE_DASHBOARD_SUPPORT 1 33 #endif 34 35 // Mail on Tiger expects the old value for WebMenuItemTagSearchInGoogle 36 #define WebMenuItemTagSearchInGoogle OldWebMenuItemTagSearchWeb 37 38 #define WEBMENUITEMTAG_WEBKIT_3_0_SPI_START 2000 39 enum { 40 // The next three values were used in WebKit 2.0 for SPI. In WebKit 3.0 these are API, with different values. 41 OldWebMenuItemTagSearchInSpotlight = 1000, 42 OldWebMenuItemTagSearchWeb, 43 OldWebMenuItemTagLookUpInDictionary, 44 // FIXME: These should move to WebUIDelegate.h as part of the WebMenuItemTag enum there, when we're not in API freeze 45 // Note that these values must be kept aligned with values in WebCore/ContextMenuItem.h 46 WebMenuItemTagOpenLink = WEBMENUITEMTAG_WEBKIT_3_0_SPI_START, 47 WebMenuItemTagIgnoreGrammar, 48 WebMenuItemTagSpellingMenu, 49 WebMenuItemTagShowSpellingPanel, 50 WebMenuItemTagCheckSpelling, 51 WebMenuItemTagCheckSpellingWhileTyping, 52 WebMenuItemTagCheckGrammarWithSpelling, 53 WebMenuItemTagFontMenu, 54 WebMenuItemTagShowFonts, 55 WebMenuItemTagBold, 56 WebMenuItemTagItalic, 57 WebMenuItemTagUnderline, 58 WebMenuItemTagOutline, 59 WebMenuItemTagStyles, 60 WebMenuItemTagShowColors, 61 WebMenuItemTagSpeechMenu, 62 WebMenuItemTagStartSpeaking, 63 WebMenuItemTagStopSpeaking, 64 WebMenuItemTagWritingDirectionMenu, 65 WebMenuItemTagDefaultDirection, 66 WebMenuItemTagLeftToRight, 67 WebMenuItemTagRightToLeft, 68 WebMenuItemPDFSinglePageScrolling, 69 WebMenuItemPDFFacingPagesScrolling, 70 WebMenuItemTagInspectElement, 71 WebMenuItemTagTextDirectionMenu, 72 WebMenuItemTagTextDirectionDefault, 73 WebMenuItemTagTextDirectionLeftToRight, 74 WebMenuItemTagTextDirectionRightToLeft, 75 WebMenuItemTagCorrectSpellingAutomatically, 76 WebMenuItemTagSubstitutionsMenu, 77 WebMenuItemTagShowSubstitutions, 78 WebMenuItemTagSmartCopyPaste, 79 WebMenuItemTagSmartQuotes, 80 WebMenuItemTagSmartDashes, 81 WebMenuItemTagSmartLinks, 82 WebMenuItemTagTextReplacement, 83 WebMenuItemTagTransformationsMenu, 84 WebMenuItemTagMakeUpperCase, 85 WebMenuItemTagMakeLowerCase, 86 WebMenuItemTagCapitalize, 87 WebMenuItemTagChangeBack, 88 WebMenuItemTagBaseApplication = 10000 89 }; 90 @class WebGeolocation; 91 @class WebSecurityOrigin; 92 93 @interface NSObject (WebUIDelegatePrivate) 94 95 - (void)webView:(WebView *)webView addMessageToConsole:(NSDictionary *)message; 96 97 - (NSView *)webView:(WebView *)webView plugInViewWithArguments:(NSDictionary *)arguments; 98 99 #if ENABLE_DASHBOARD_SUPPORT 100 // regions is an dictionary whose keys are regions label and values are arrays of WebDashboardRegions. 101 - (void)webView:(WebView *)webView dashboardRegionsChanged:(NSDictionary *)regions; 102 #endif 103 104 - (void)webView:(WebView *)sender dragImage:(NSImage *)anImage at:(NSPoint)viewLocation offset:(NSSize)initialOffset event:(NSEvent *)event pasteboard:(NSPasteboard *)pboard source:(id)sourceObj slideBack:(BOOL)slideFlag forView:(NSView *)view; 105 - (void)webView:(WebView *)sender didDrawRect:(NSRect)rect; 106 - (void)webView:(WebView *)sender didScrollDocumentInFrameView:(WebFrameView *)frameView; 107 // FIXME: If we ever make this method public, it should include a WebFrame parameter. 108 - (BOOL)webViewShouldInterruptJavaScript:(WebView *)sender; 109 - (void)webView:(WebView *)sender willPopupMenu:(NSMenu *)menu; 110 - (void)webView:(WebView *)sender contextMenuItemSelected:(NSMenuItem *)item forElement:(NSDictionary *)element; 111 - (void)webView:(WebView *)sender saveFrameView:(WebFrameView *)frameView showingPanel:(BOOL)showingPanel; 112 113 /*! 114 @method webView:frame:exceededDatabaseQuotaForSecurityOrigin:database: 115 @param sender The WebView sending the delegate method. 116 @param frame The WebFrame whose JavaScript initiated this call. 117 @param origin The security origin that needs a larger quota. 118 @param databaseIdentifier The identifier of the database involved. 119 */ 120 - (void)webView:(WebView *)sender frame:(WebFrame *)frame exceededDatabaseQuotaForSecurityOrigin:(WebSecurityOrigin *)origin database:(NSString *)databaseIdentifier; 121 122 - (WebView *)webView:(WebView *)sender createWebViewWithRequest:(NSURLRequest *)request windowFeatures:(NSDictionary *)features; 123 124 - (BOOL)webView:(WebView *)sender shouldReplaceUploadFile:(NSString *)path usingGeneratedFilename:(NSString **)filename; 125 - (NSString *)webView:(WebView *)sender generateReplacementFile:(NSString *)path; 126 127 - (BOOL)webView:(WebView *)sender frame:(WebFrame *)frame requestGeolocationPermission:(WebGeolocation *)geolocation securityOrigin:(WebSecurityOrigin *)origin; 128 129 - (void)webView:(WebView *)sender formStateDidChangeForNode:(DOMNode *)node; 130 - (void)webView:(WebView *)sender formStateDidFocusNode:(DOMNode *)node; 131 - (void)webView:(WebView *)sender formStateDidBlurNode:(DOMNode *)node; 132 133 /*! 134 @method webView:printFrame: 135 @abstract Informs that a WebFrame needs to be printed 136 @param webView The WebView sending the delegate method 137 @param frameView The WebFrame needing to be printed 138 @discussion This method is called when a script or user requests the page to be printed. 139 */ 140 - (void)webView:(WebView *)sender printFrame:(WebFrame *)frame; 141 142 @end 143