OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_ |
11 | 11 |
12 #include <map> | 12 #include <map> |
13 #include <set> | 13 #include <set> |
14 #include <string> | 14 #include <string> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 #include "base/basictypes.h" | 17 #include "base/basictypes.h" |
18 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
20 #include "base/string16.h" | 20 #include "base/string16.h.h" |
21 #include "build/build_config.h" | 21 #include "build/build_config.h" |
22 #include "third_party/WebKit/Source/Platform/chromium/public/WebFileSystem.h" | 22 #include "third_party/WebKit/Source/Platform/chromium/public/WebFileSystem.h" |
23 #include "third_party/WebKit/Source/Platform/chromium/public/WebFileSystemType.h
" | 23 #include "third_party/WebKit/Source/Platform/chromium/public/WebFileSystemType.h
" |
24 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" | 24 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" |
25 #include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h" | 25 #include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h" |
26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" | 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" |
27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrameClient.h" | 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrameClient.h" |
28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h" | 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h" |
29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebViewClient.h" | 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebViewClient.h" |
30 #include "webkit/glue/webcursor.h" | 30 #include "webkit/glue/webcursor.h" |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 return last_context_menu_data_.get(); | 314 return last_context_menu_data_.get(); |
315 } | 315 } |
316 | 316 |
317 MockSpellCheck* mock_spellcheck() { | 317 MockSpellCheck* mock_spellcheck() { |
318 return &mock_spellcheck_; | 318 return &mock_spellcheck_; |
319 } | 319 } |
320 | 320 |
321 private: | 321 private: |
322 // Called the title of the page changes. | 322 // Called the title of the page changes. |
323 // Can be used to update the title of the window. | 323 // Can be used to update the title of the window. |
324 void SetPageTitle(const string16& title); | 324 void SetPageTitle(const base::string16& title); |
325 | 325 |
326 // Called when the URL of the page changes. | 326 // Called when the URL of the page changes. |
327 // Extracts the URL and forwards on to SetAddressBarURL(). | 327 // Extracts the URL and forwards on to SetAddressBarURL(). |
328 void UpdateAddressBar(WebKit::WebView* webView); | 328 void UpdateAddressBar(WebKit::WebView* webView); |
329 | 329 |
330 // Called when the URL of the page changes. | 330 // Called when the URL of the page changes. |
331 // Should be used to update the text of the URL bar. | 331 // Should be used to update the text of the URL bar. |
332 void SetAddressBarURL(const GURL& url); | 332 void SetAddressBarURL(const GURL& url); |
333 | 333 |
334 // Show a JavaScript alert as a popup message. | 334 // Show a JavaScript alert as a popup message. |
335 // The caller should test whether we're in layout test mode and only | 335 // The caller should test whether we're in layout test mode and only |
336 // call this function when we really want a message to pop up. | 336 // call this function when we really want a message to pop up. |
337 void ShowJavaScriptAlert(const string16& message); | 337 void ShowJavaScriptAlert(const base::string16& message); |
338 | 338 |
339 // In the Mac code, this is called to trigger the end of a test after the | 339 // In the Mac code, this is called to trigger the end of a test after the |
340 // page has finished loading. From here, we can generate the dump for the | 340 // page has finished loading. From here, we can generate the dump for the |
341 // test. | 341 // test. |
342 void LocationChangeDone(WebKit::WebFrame*); | 342 void LocationChangeDone(WebKit::WebFrame*); |
343 | 343 |
344 // Tests that require moving or resizing the main window (via resizeTo() or | 344 // Tests that require moving or resizing the main window (via resizeTo() or |
345 // moveTo()) pass in Chrome even though Chrome disregards move requests for | 345 // moveTo()) pass in Chrome even though Chrome disregards move requests for |
346 // non-popup windows (see TabContents::RequestMove()). These functions allow | 346 // non-popup windows (see TabContents::RequestMove()). These functions allow |
347 // the test shell to mimic its behavior. If setWindowRect() is called for | 347 // the test shell to mimic its behavior. If setWindowRect() is called for |
348 // the main window, the passed in WebRect is saved as fake_rect_ and we return | 348 // the main window, the passed in WebRect is saved as fake_rect_ and we return |
349 // it instead of the real window dimensions whenever rootWindowRect() is | 349 // it instead of the real window dimensions whenever rootWindowRect() is |
350 // called. | 350 // called. |
351 WebKit::WebRect fake_window_rect(); | 351 WebKit::WebRect fake_window_rect(); |
352 void set_fake_window_rect(const WebKit::WebRect&); | 352 void set_fake_window_rect(const WebKit::WebRect&); |
353 | 353 |
354 WebWidgetHost* GetWidgetHost(); | 354 WebWidgetHost* GetWidgetHost(); |
355 | 355 |
356 void UpdateForCommittedLoad(WebKit::WebFrame* frame, bool is_new_navigation); | 356 void UpdateForCommittedLoad(WebKit::WebFrame* frame, bool is_new_navigation); |
357 void UpdateURL(WebKit::WebFrame* frame); | 357 void UpdateURL(WebKit::WebFrame* frame); |
358 void UpdateSessionHistory(WebKit::WebFrame* frame); | 358 void UpdateSessionHistory(WebKit::WebFrame* frame); |
359 void UpdateSelectionClipboard(bool is_empty_selection); | 359 void UpdateSelectionClipboard(bool is_empty_selection); |
360 | 360 |
361 // Get a string suitable for dumping a frame to the console. | 361 // Get a string suitable for dumping a frame to the console. |
362 string16 GetFrameDescription(WebKit::WebFrame* webframe); | 362 base::string16 GetFrameDescription(WebKit::WebFrame* webframe); |
363 | 363 |
364 // Causes navigation actions just printout the intended navigation instead | 364 // Causes navigation actions just printout the intended navigation instead |
365 // of taking you to the page. This is used for cases like mailto, where you | 365 // of taking you to the page. This is used for cases like mailto, where you |
366 // don't actually want to open the mail program. | 366 // don't actually want to open the mail program. |
367 bool policy_delegate_enabled_; | 367 bool policy_delegate_enabled_; |
368 | 368 |
369 // Toggles the behavior of the policy delegate. If true, then navigations | 369 // Toggles the behavior of the policy delegate. If true, then navigations |
370 // will be allowed. Otherwise, they will be ignored (dropped). | 370 // will be allowed. Otherwise, they will be ignored (dropped). |
371 bool policy_delegate_is_permissive_; | 371 bool policy_delegate_is_permissive_; |
372 | 372 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 std::string edit_command_name_; | 427 std::string edit_command_name_; |
428 std::string edit_command_value_; | 428 std::string edit_command_value_; |
429 | 429 |
430 // The mock spellchecker used in TestWebViewDelegate::spellCheck(). | 430 // The mock spellchecker used in TestWebViewDelegate::spellCheck(). |
431 MockSpellCheck mock_spellcheck_; | 431 MockSpellCheck mock_spellcheck_; |
432 | 432 |
433 DISALLOW_COPY_AND_ASSIGN(TestWebViewDelegate); | 433 DISALLOW_COPY_AND_ASSIGN(TestWebViewDelegate); |
434 }; | 434 }; |
435 | 435 |
436 #endif // WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H_ | 436 #endif // WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H_ |
OLD | NEW |