| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // TestWebViewDelegate class: | 5 // TestWebViewDelegate class: |
| 6 // This class implements the WebViewDelegate methods for the test shell. One | 6 // This class implements the WebViewDelegate methods for the test shell. One |
| 7 // instance is owned by each TestShell. | 7 // instance is owned by each TestShell. |
| 8 | 8 |
| 9 #ifndef WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H_ | 9 #ifndef WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H_ |
| 10 #define WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H_ | 10 #define WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H_ |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 } | 49 } |
| 50 | 50 |
| 51 ContextNode node; | 51 ContextNode node; |
| 52 int x; | 52 int x; |
| 53 int y; | 53 int y; |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 typedef std::vector<CapturedContextMenuEvent> CapturedContextMenuEvents; | 56 typedef std::vector<CapturedContextMenuEvent> CapturedContextMenuEvents; |
| 57 | 57 |
| 58 TestWebViewDelegate(TestShell* shell) | 58 TestWebViewDelegate(TestShell* shell) |
| 59 : is_custom_policy_delegate_(false), | 59 : policy_delegate_enabled_(false), |
| 60 policy_delegate_is_permissive_(false), |
| 61 policy_delegate_should_notify_done_(false), |
| 60 shell_(shell), | 62 shell_(shell), |
| 61 top_loading_frame_(NULL), | 63 top_loading_frame_(NULL), |
| 62 page_id_(-1), | 64 page_id_(-1), |
| 63 last_page_id_updated_(-1), | 65 last_page_id_updated_(-1), |
| 64 smart_insert_delete_enabled_(true) | 66 smart_insert_delete_enabled_(true) |
| 65 #if defined(OS_WIN) | 67 #if defined(OS_WIN) |
| 66 , select_trailing_whitespace_enabled_(true) | 68 , select_trailing_whitespace_enabled_(true) |
| 67 #else | 69 #else |
| 68 , select_trailing_whitespace_enabled_(false) | 70 , select_trailing_whitespace_enabled_(false) |
| 69 #endif | 71 #endif |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 virtual void DidStopLoading(WebView* webview); | 199 virtual void DidStopLoading(WebView* webview); |
| 198 | 200 |
| 199 virtual void WindowObjectCleared(WebFrame* webframe); | 201 virtual void WindowObjectCleared(WebFrame* webframe); |
| 200 virtual WindowOpenDisposition DispositionForNavigationAction( | 202 virtual WindowOpenDisposition DispositionForNavigationAction( |
| 201 WebView* webview, | 203 WebView* webview, |
| 202 WebFrame* frame, | 204 WebFrame* frame, |
| 203 const WebRequest* request, | 205 const WebRequest* request, |
| 204 WebNavigationType type, | 206 WebNavigationType type, |
| 205 WindowOpenDisposition disposition, | 207 WindowOpenDisposition disposition, |
| 206 bool is_redirect); | 208 bool is_redirect); |
| 207 void SetCustomPolicyDelegate(bool isCustom); | |
| 208 virtual WebHistoryItem* GetHistoryEntryAtOffset(int offset); | 209 virtual WebHistoryItem* GetHistoryEntryAtOffset(int offset); |
| 209 virtual int GetHistoryBackListCount(); | 210 virtual int GetHistoryBackListCount(); |
| 210 virtual int GetHistoryForwardListCount(); | 211 virtual int GetHistoryForwardListCount(); |
| 211 | 212 |
| 212 // WebWidgetDelegate | 213 // WebWidgetDelegate |
| 213 virtual gfx::NativeViewId GetContainingView(WebWidget* webwidget); | 214 virtual gfx::NativeViewId GetContainingView(WebWidget* webwidget); |
| 214 virtual void DidInvalidateRect(WebWidget* webwidget, const gfx::Rect& rect); | 215 virtual void DidInvalidateRect(WebWidget* webwidget, const gfx::Rect& rect); |
| 215 virtual void DidScrollRect(WebWidget* webwidget, int dx, int dy, | 216 virtual void DidScrollRect(WebWidget* webwidget, int dx, int dy, |
| 216 const gfx::Rect& clip_rect); | 217 const gfx::Rect& clip_rect); |
| 217 virtual void Show(WebWidget* webview, WindowOpenDisposition disposition); | 218 virtual void Show(WebWidget* webview, WindowOpenDisposition disposition); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 captured_context_menu_events_.clear(); | 254 captured_context_menu_events_.clear(); |
| 254 } | 255 } |
| 255 | 256 |
| 256 // Methods for modifying WebPreferences | 257 // Methods for modifying WebPreferences |
| 257 void SetUserStyleSheetEnabled(bool is_enabled); | 258 void SetUserStyleSheetEnabled(bool is_enabled); |
| 258 void SetUserStyleSheetLocation(const GURL& location); | 259 void SetUserStyleSheetLocation(const GURL& location); |
| 259 | 260 |
| 260 // Sets the webview as a drop target. | 261 // Sets the webview as a drop target. |
| 261 void RegisterDragDrop(); | 262 void RegisterDragDrop(); |
| 262 | 263 |
| 264 void SetCustomPolicyDelegate(bool is_custom, bool is_permissive); |
| 265 void WaitForPolicyDelegate(); |
| 266 |
| 263 protected: | 267 protected: |
| 264 // Called the title of the page changes. | 268 // Called the title of the page changes. |
| 265 // Can be used to update the title of the window. | 269 // Can be used to update the title of the window. |
| 266 void SetPageTitle(const std::wstring& title); | 270 void SetPageTitle(const std::wstring& title); |
| 267 | 271 |
| 268 // Called when the URL of the page changes. | 272 // Called when the URL of the page changes. |
| 269 // Extracts the URL and forwards on to SetAddressBarURL(). | 273 // Extracts the URL and forwards on to SetAddressBarURL(). |
| 270 void UpdateAddressBar(WebView* webView); | 274 void UpdateAddressBar(WebView* webView); |
| 271 | 275 |
| 272 // Called when the URL of the page changes. | 276 // Called when the URL of the page changes. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 290 void UpdateSessionHistory(WebFrame* frame); | 294 void UpdateSessionHistory(WebFrame* frame); |
| 291 void UpdateSelectionClipboard(bool is_empty_selection); | 295 void UpdateSelectionClipboard(bool is_empty_selection); |
| 292 | 296 |
| 293 // Get a string suitable for dumping a frame to the console. | 297 // Get a string suitable for dumping a frame to the console. |
| 294 std::wstring GetFrameDescription(WebFrame* webframe); | 298 std::wstring GetFrameDescription(WebFrame* webframe); |
| 295 | 299 |
| 296 private: | 300 private: |
| 297 // Causes navigation actions just printout the intended navigation instead | 301 // Causes navigation actions just printout the intended navigation instead |
| 298 // of taking you to the page. This is used for cases like mailto, where you | 302 // of taking you to the page. This is used for cases like mailto, where you |
| 299 // don't actually want to open the mail program. | 303 // don't actually want to open the mail program. |
| 300 bool is_custom_policy_delegate_; | 304 bool policy_delegate_enabled_; |
| 305 |
| 306 // Toggles the behavior of the policy delegate. If true, then navigations |
| 307 // will be allowed. Otherwise, they will be ignored (dropped). |
| 308 bool policy_delegate_is_permissive_; |
| 309 |
| 310 // If true, the policy delegate will signal layout test completion. |
| 311 bool policy_delegate_should_notify_done_; |
| 301 | 312 |
| 302 // Non-owning pointer. The delegate is owned by the host. | 313 // Non-owning pointer. The delegate is owned by the host. |
| 303 TestShell* shell_; | 314 TestShell* shell_; |
| 304 | 315 |
| 305 // This is non-NULL IFF a load is in progress. | 316 // This is non-NULL IFF a load is in progress. |
| 306 WebFrame* top_loading_frame_; | 317 WebFrame* top_loading_frame_; |
| 307 | 318 |
| 308 // For tracking session history. See RenderView. | 319 // For tracking session history. See RenderView. |
| 309 int page_id_; | 320 int page_id_; |
| 310 int last_page_id_updated_; | 321 int last_page_id_updated_; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 333 // cursor. | 344 // cursor. |
| 334 GdkCursorType cursor_type_; | 345 GdkCursorType cursor_type_; |
| 335 #endif | 346 #endif |
| 336 | 347 |
| 337 CapturedContextMenuEvents captured_context_menu_events_; | 348 CapturedContextMenuEvents captured_context_menu_events_; |
| 338 | 349 |
| 339 DISALLOW_COPY_AND_ASSIGN(TestWebViewDelegate); | 350 DISALLOW_COPY_AND_ASSIGN(TestWebViewDelegate); |
| 340 }; | 351 }; |
| 341 | 352 |
| 342 #endif // WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H_ | 353 #endif // WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H_ |
| OLD | NEW |