| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 #ifndef WebView_h | 31 #ifndef WebView_h |
| 32 #define WebView_h | 32 #define WebView_h |
| 33 | 33 |
| 34 #include "WebDragOperation.h" | 34 #include "WebDragOperation.h" |
| 35 #include "WebWidget.h" | 35 #include "WebWidget.h" |
| 36 | 36 |
| 37 namespace WebKit { | 37 namespace WebKit { |
| 38 class WebDragData; | 38 class WebDragData; |
| 39 class WebFrame; | 39 class WebFrame; |
| 40 class WebFrameClient; |
| 40 class WebSettings; | 41 class WebSettings; |
| 41 class WebString; | 42 class WebString; |
| 42 class WebViewClient; | 43 class WebViewClient; |
| 43 struct WebPoint; | 44 struct WebPoint; |
| 44 | 45 |
| 45 class WebView : public WebWidget { | 46 class WebView : public WebWidget { |
| 46 public: | 47 public: |
| 47 WEBKIT_API WebView* create(WebViewClient*); | 48 // Initialization ------------------------------------------------------ |
| 49 |
| 50 // FIXME enable this once WebViewDelegate has been eliminated. |
| 51 //WEBKIT_API WebView* create(WebViewClient*); |
| 52 |
| 53 // After creating a WebView, you should immediately call this method. |
| 54 // You can optionally modify the settings before calling this method. |
| 55 // The WebFrameClient will receive events for the main frame and any |
| 56 // child frames. |
| 57 virtual void initializeMainFrame(WebFrameClient*) = 0; |
| 48 | 58 |
| 49 | 59 |
| 50 // Options ------------------------------------------------------------- | 60 // Options ------------------------------------------------------------- |
| 51 | 61 |
| 52 // The returned pointer is valid for the lifetime of the WebView. | 62 // The returned pointer is valid for the lifetime of the WebView. |
| 53 virtual WebSettings* settings() = 0; | 63 virtual WebSettings* settings() = 0; |
| 54 | 64 |
| 55 // Corresponds to the encoding of the main frame. Setting the page | 65 // Corresponds to the encoding of the main frame. Setting the page |
| 56 // encoding may cause the main frame to reload. | 66 // encoding may cause the main frame to reload. |
| 57 virtual WebString pageEncoding() const = 0; | 67 virtual WebString pageEncoding() const = 0; |
| 58 virtual void setPageEncoding(const WebString&) = 0; | 68 virtual void setPageEncoding(const WebString&) = 0; |
| 59 | 69 |
| 70 // Makes the WebView transparent. This is useful if you want to have |
| 71 // some custom background rendered behind it. |
| 72 virtual bool isTransparent() const = 0; |
| 73 virtual void setIsTransparent(bool) = 0; |
| 74 |
| 75 // Controls whether pressing Tab key advances focus to links. |
| 76 virtual bool tabsToLinks() const = 0; |
| 77 virtual void setTabsToLinks(bool) = 0; |
| 78 |
| 79 // Method that controls whether pressing Tab key cycles through page |
| 80 // elements or inserts a '\t' char in the focused text area. |
| 81 virtual bool tabKeyCyclesThroughElements() const = 0; |
| 82 virtual void setTabKeyCyclesThroughElements(bool) = 0; |
| 83 |
| 84 // Controls the WebView's active state, which may affect the rendering |
| 85 // of elements on the page (i.e., tinting of input elements). |
| 86 virtual bool isActive() const = 0; |
| 87 virtual void setIsActive(bool) = 0; |
| 88 |
| 60 | 89 |
| 61 // Closing ------------------------------------------------------------- | 90 // Closing ------------------------------------------------------------- |
| 62 | 91 |
| 63 // Runs beforeunload handlers for the current page, returning false if | 92 // Runs beforeunload handlers for the current page, returning false if |
| 64 // any handler suppressed unloading. | 93 // any handler suppressed unloading. |
| 65 virtual bool dispatchBeforeUnloadEvent() = 0; | 94 virtual bool dispatchBeforeUnloadEvent() = 0; |
| 66 | 95 |
| 67 // Runs unload handlers for the current page. | 96 // Runs unload handlers for the current page. |
| 68 virtual void dispatchUnloadEvent() = 0; | 97 virtual void dispatchUnloadEvent() = 0; |
| 69 | 98 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 WebDragOperationsMask operationsAllowed) = 0; | 168 WebDragOperationsMask operationsAllowed) = 0; |
| 140 virtual WebDragOperation dragTargetDragOver( | 169 virtual WebDragOperation dragTargetDragOver( |
| 141 const WebPoint& clientPoint, const WebPoint& screenPoint, | 170 const WebPoint& clientPoint, const WebPoint& screenPoint, |
| 142 WebDragOperationsMask operationsAllowed) = 0; | 171 WebDragOperationsMask operationsAllowed) = 0; |
| 143 virtual void dragTargetDragLeave() = 0; | 172 virtual void dragTargetDragLeave() = 0; |
| 144 virtual void dragTargetDrop( | 173 virtual void dragTargetDrop( |
| 145 const WebPoint& clientPoint, const WebPoint& screenPoint) = 0; | 174 const WebPoint& clientPoint, const WebPoint& screenPoint) = 0; |
| 146 | 175 |
| 147 virtual int dragIdentity() = 0; | 176 virtual int dragIdentity() = 0; |
| 148 | 177 |
| 178 // Helper method for drag and drop target operations: override the |
| 179 // default drop effect with either a "copy" (accept true) or "none" |
| 180 // (accept false) effect. Return true on success. |
| 181 virtual bool setDropEffect(bool accept) = 0; |
| 182 |
| 149 | 183 |
| 150 // Developer tools ----------------------------------------------------- | 184 // Developer tools ----------------------------------------------------- |
| 151 | 185 |
| 152 // Inspect a particular point in the WebView. (x = -1 || y = -1) is a | 186 // Inspect a particular point in the WebView. (x = -1 || y = -1) is a |
| 153 // special case, meaning inspect the current page and not a specific | 187 // special case, meaning inspect the current page and not a specific |
| 154 // point. | 188 // point. |
| 155 virtual void inspectElementAt(const WebPoint&) = 0; | 189 virtual void inspectElementAt(const WebPoint&) = 0; |
| 156 | 190 |
| 157 | 191 |
| 158 // FIXME what about: | 192 // FIXME what about: |
| 159 // StoreFocusForFrame | 193 // StoreFocusForFrame |
| 160 // DownloadImage | 194 // DownloadImage |
| 161 // Get/SetDelegate | 195 // Get/SetDelegate |
| 162 // InsertText -> should move to WebTextInput | 196 // InsertText -> should move to WebTextInput |
| 163 // AutofillSuggestionsForNode | 197 // AutofillSuggestionsForNode |
| 164 // HideAutofillPopup | 198 // HideAutofillPopup |
| 165 | 199 |
| 166 protected: | 200 protected: |
| 167 ~WebView() {} | 201 ~WebView() {} |
| 168 }; | 202 }; |
| 169 | 203 |
| 170 } // namespace WebKit | 204 } // namespace WebKit |
| 171 | 205 |
| 172 #endif | 206 #endif |
| OLD | NEW |