| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // WebCore provides hooks for several kinds of functionality, allowing separate | 5 // WebCore provides hooks for several kinds of functionality, allowing separate |
| 6 // classes termed "delegates" to receive notifications (in the form of direct | 6 // classes termed "delegates" to receive notifications (in the form of direct |
| 7 // function calls) when certain events are about to occur or have just occurred. | 7 // function calls) when certain events are about to occur or have just occurred. |
| 8 // In some cases, the delegate implements the needed functionality; in others, | 8 // In some cases, the delegate implements the needed functionality; in others, |
| 9 // the delegate has some control over the behavior but doesn't actually | 9 // the delegate has some control over the behavior but doesn't actually |
| 10 // implement it. For example, the UI delegate is responsible for showing a | 10 // implement it. For example, the UI delegate is responsible for showing a |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 const GURL& page_url, | 188 const GURL& page_url, |
| 189 const GURL& frame_url, | 189 const GURL& frame_url, |
| 190 const ContextMenuMediaParams& media_params, | 190 const ContextMenuMediaParams& media_params, |
| 191 const std::wstring& selection_text, | 191 const std::wstring& selection_text, |
| 192 const std::wstring& misspelled_word, | 192 const std::wstring& misspelled_word, |
| 193 int edit_flags, | 193 int edit_flags, |
| 194 const std::string& security_info, | 194 const std::string& security_info, |
| 195 const std::string& frame_charset) { | 195 const std::string& frame_charset) { |
| 196 } | 196 } |
| 197 | 197 |
| 198 // Notification that a user metric has occurred. | |
| 199 virtual void UserMetricsRecordAction(const std::wstring& action) { } | |
| 200 | |
| 201 // ------------------------------------------------------------------------- | 198 // ------------------------------------------------------------------------- |
| 202 | 199 |
| 203 // Notification that a request to download an image has completed. |errored| | 200 // Notification that a request to download an image has completed. |errored| |
| 204 // indicates if there was a network error. The image is empty if there was | 201 // indicates if there was a network error. The image is empty if there was |
| 205 // a network error, the contents of the page couldn't by converted to an | 202 // a network error, the contents of the page couldn't by converted to an |
| 206 // image, or the response from the host was not 200. | 203 // image, or the response from the host was not 200. |
| 207 // NOTE: image is empty if the response didn't contain image data. | 204 // NOTE: image is empty if the response didn't contain image data. |
| 208 virtual void DidDownloadImage(int id, | 205 virtual void DidDownloadImage(int id, |
| 209 const GURL& image_url, | 206 const GURL& image_url, |
| 210 bool errored, | 207 bool errored, |
| 211 const SkBitmap& image) { | 208 const SkBitmap& image) { |
| 212 } | 209 } |
| 213 | 210 |
| 214 // History Related --------------------------------------------------------- | 211 // History Related --------------------------------------------------------- |
| 215 | 212 |
| 216 // InspectorClient --------------------------------------------------------- | 213 // InspectorClient --------------------------------------------------------- |
| 217 | 214 |
| 218 virtual void UpdateInspectorSettings(const std::wstring& raw_settings) { } | 215 virtual void UpdateInspectorSettings(const std::wstring& raw_settings) { } |
| 219 | 216 |
| 220 // DevTools ---------------------------------------------------------------- | 217 // DevTools ---------------------------------------------------------------- |
| 221 | 218 |
| 222 virtual WebDevToolsAgentDelegate* GetWebDevToolsAgentDelegate() { | 219 virtual WebDevToolsAgentDelegate* GetWebDevToolsAgentDelegate() { |
| 223 return NULL; | 220 return NULL; |
| 224 } | 221 } |
| 225 | 222 |
| 226 // Editor Client ----------------------------------------------------------- | 223 // Editor Client ----------------------------------------------------------- |
| 227 | 224 |
| 228 // Returns true if the word is spelled correctly. The word may begin or end | |
| 229 // with whitespace or punctuation, so the implementor should be sure to handle | |
| 230 // these cases. | |
| 231 // | |
| 232 // If the word is misspelled (returns false), the given first and last | |
| 233 // indices (inclusive) will be filled with the offsets of the boundary of the | |
| 234 // word within the given buffer. The out pointers must be specified. If the | |
| 235 // word is correctly spelled (returns true), they will be set to (0,0). | |
| 236 virtual void SpellCheck(const std::wstring& word, | |
| 237 int* misspell_location, | |
| 238 int* misspell_length) { | |
| 239 *misspell_location = *misspell_length = 0; | |
| 240 } | |
| 241 | |
| 242 // Computes an auto correct word for a misspelled word. If no word is found, | |
| 243 // empty string is computed. | |
| 244 virtual std::wstring GetAutoCorrectWord(const std::wstring& misspelled_word) { | |
| 245 return std::wstring(); | |
| 246 } | |
| 247 | |
| 248 // Switches the spelling panel to be displayed or not based on |show|. | |
| 249 virtual void ShowSpellingUI(bool show) { } | |
| 250 | |
| 251 // Update the spelling panel with the |word|. | |
| 252 virtual void UpdateSpellingUIWithMisspelledWord(const std::wstring& word) { } | |
| 253 | |
| 254 // The "CurrentKeyboardEvent" refers to the keyboard event passed to | 225 // The "CurrentKeyboardEvent" refers to the keyboard event passed to |
| 255 // WebView's handleInputEvent method. | 226 // WebView's handleInputEvent method. |
| 256 // | 227 // |
| 257 // This method is called in response to WebView's handleInputEvent() when | 228 // This method is called in response to WebView's handleInputEvent() when |
| 258 // the default action for the current keyboard event is not suppressed by the | 229 // the default action for the current keyboard event is not suppressed by the |
| 259 // page, to give WebViewDelegate a chance to handle the keyboard event | 230 // page, to give WebViewDelegate a chance to handle the keyboard event |
| 260 // specially. | 231 // specially. |
| 261 // | 232 // |
| 262 // Returns true if the keyboard event was handled by WebViewDelegate. | 233 // Returns true if the keyboard event was handled by WebViewDelegate. |
| 263 virtual bool HandleCurrentKeyboardEvent() { | 234 virtual bool HandleCurrentKeyboardEvent() { |
| 264 return false; | 235 return false; |
| 265 } | 236 } |
| 266 | 237 |
| 267 protected: | 238 protected: |
| 268 ~WebViewDelegate() { } | 239 ~WebViewDelegate() { } |
| 269 }; | 240 }; |
| 270 | 241 |
| 271 #endif // WEBKIT_GLUE_WEBVIEW_DELEGATE_H_ | 242 #endif // WEBKIT_GLUE_WEBVIEW_DELEGATE_H_ |
| OLD | NEW |