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 91 @class WebSecurityOrigin; 92 93 @protocol WebGeolocationPolicyListener <NSObject> 94 - (void)allow; 95 - (void)deny; 96 @end 97 98 @interface NSObject (WebUIDelegatePrivate) 99 100 - (void)webView:(WebView *)webView addMessageToConsole:(NSDictionary *)message; 101 102 - (NSView *)webView:(WebView *)webView plugInViewWithArguments:(NSDictionary *)arguments; 103 104 #if ENABLE_DASHBOARD_SUPPORT 105 // regions is an dictionary whose keys are regions label and values are arrays of WebDashboardRegions. 106 - (void)webView:(WebView *)webView dashboardRegionsChanged:(NSDictionary *)regions; 107 #endif 108 109 - (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; 110 - (void)webView:(WebView *)sender didDrawRect:(NSRect)rect; 111 - (void)webView:(WebView *)sender didScrollDocumentInFrameView:(WebFrameView *)frameView; 112 // FIXME: If we ever make this method public, it should include a WebFrame parameter. 113 - (BOOL)webViewShouldInterruptJavaScript:(WebView *)sender; 114 - (void)webView:(WebView *)sender willPopupMenu:(NSMenu *)menu; 115 - (void)webView:(WebView *)sender contextMenuItemSelected:(NSMenuItem *)item forElement:(NSDictionary *)element; 116 - (void)webView:(WebView *)sender saveFrameView:(WebFrameView *)frameView showingPanel:(BOOL)showingPanel; 117 - (BOOL)webView:(WebView *)sender shouldHaltPlugin:(DOMNode *)pluginNode isWindowed:(BOOL)isWindowed pluginName:(NSString *)pluginName; 118 /*! 119 @method webView:frame:exceededDatabaseQuotaForSecurityOrigin:database: 120 @param sender The WebView sending the delegate method. 121 @param frame The WebFrame whose JavaScript initiated this call. 122 @param origin The security origin that needs a larger quota. 123 @param databaseIdentifier The identifier of the database involved. 124 */ 125 - (void)webView:(WebView *)sender frame:(WebFrame *)frame exceededDatabaseQuotaForSecurityOrigin:(WebSecurityOrigin *)origin database:(NSString *)databaseIdentifier; 126 127 - (WebView *)webView:(WebView *)sender createWebViewWithRequest:(NSURLRequest *)request windowFeatures:(NSDictionary *)features; 128 129 - (BOOL)webView:(WebView *)sender shouldReplaceUploadFile:(NSString *)path usingGeneratedFilename:(NSString **)filename; 130 - (NSString *)webView:(WebView *)sender generateReplacementFile:(NSString *)path; 131 132 /*! 133 @method webView:decidePolicyForGeolocationRequestFromOrigin:frame:listener: 134 @abstract 135 @param webView The WebView sending the delegate method. 136 @param origin The security origin that would like to use Geolocation. 137 @param frame The WebFrame whose JavaScript initiated this call. 138 @param listener The object to call when the decision is made 139 */ 140 - (void)webView:(WebView *)webView decidePolicyForGeolocationRequestFromOrigin:(WebSecurityOrigin *)origin 141 frame:(WebFrame *)frame 142 listener:(id<WebGeolocationPolicyListener>)listener; 143 144 - (void)webView:(WebView *)sender formStateDidChangeForNode:(DOMNode *)node; 145 - (void)webView:(WebView *)sender formDidFocusNode:(DOMNode *)node; 146 - (void)webView:(WebView *)sender formDidBlurNode:(DOMNode *)node; 147 148 /*! 149 @method webView:printFrame: 150 @abstract Informs that a WebFrame needs to be printed 151 @param webView The WebView sending the delegate method 152 @param frameView The WebFrame needing to be printed 153 @discussion This method is called when a script or user requests the page to be printed. 154 */ 155 - (void)webView:(WebView *)sender printFrame:(WebFrame *)frame; 156 157 @end 158