| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // This file contains the implementation of TestWebViewDelegate, which serves | 5 // This file contains the implementation of TestWebViewDelegate, which serves |
| 6 // as the WebViewDelegate for the TestShellWebHost. The host is expected to | 6 // as the WebViewDelegate for the TestShellWebHost. The host is expected to |
| 7 // have initialized a MessageLoop before these methods are called. | 7 // have initialized a MessageLoop before these methods are called. |
| 8 | 8 |
| 9 #include "webkit/tools/test_shell/test_webview_delegate.h" | 9 #include "webkit/tools/test_shell/test_webview_delegate.h" |
| 10 | 10 |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 WebFrame* frame, const WebString& message) { | 569 WebFrame* frame, const WebString& message) { |
| 570 return true; // Allow window closure. | 570 return true; // Allow window closure. |
| 571 } | 571 } |
| 572 | 572 |
| 573 void TestWebViewDelegate::showContextMenu( | 573 void TestWebViewDelegate::showContextMenu( |
| 574 WebFrame* frame, const WebContextMenuData& data) { | 574 WebFrame* frame, const WebContextMenuData& data) { |
| 575 CapturedContextMenuEvent context(data.mediaType, | 575 CapturedContextMenuEvent context(data.mediaType, |
| 576 data.mousePosition.x, | 576 data.mousePosition.x, |
| 577 data.mousePosition.y); | 577 data.mousePosition.y); |
| 578 captured_context_menu_events_.push_back(context); | 578 captured_context_menu_events_.push_back(context); |
| 579 last_context_menu_data_.reset(new WebContextMenuData(data)); |
| 579 } | 580 } |
| 580 | 581 |
| 582 void TestWebViewDelegate::ClearContextMenuData() { |
| 583 last_context_menu_data_.reset(); |
| 584 } |
| 585 |
| 586 |
| 587 |
| 581 | 588 |
| 582 void TestWebViewDelegate::setStatusText(const WebString& text) { | 589 void TestWebViewDelegate::setStatusText(const WebString& text) { |
| 583 if (WebKit::layoutTestMode() && | 590 if (WebKit::layoutTestMode() && |
| 584 shell_->layout_test_controller()->ShouldDumpStatusCallbacks()) { | 591 shell_->layout_test_controller()->ShouldDumpStatusCallbacks()) { |
| 585 // When running tests, write to stdout. | 592 // When running tests, write to stdout. |
| 586 printf("UI DELEGATE STATUS CALLBACK: setStatusText:%s\n", | 593 printf("UI DELEGATE STATUS CALLBACK: setStatusText:%s\n", |
| 587 text.utf8().data()); | 594 text.utf8().data()); |
| 588 } | 595 } |
| 589 } | 596 } |
| 590 | 597 |
| (...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1347 } | 1354 } |
| 1348 | 1355 |
| 1349 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { | 1356 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { |
| 1350 fake_rect_ = rect; | 1357 fake_rect_ = rect; |
| 1351 using_fake_rect_ = true; | 1358 using_fake_rect_ = true; |
| 1352 } | 1359 } |
| 1353 | 1360 |
| 1354 WebRect TestWebViewDelegate::fake_window_rect() { | 1361 WebRect TestWebViewDelegate::fake_window_rect() { |
| 1355 return fake_rect_; | 1362 return fake_rect_; |
| 1356 } | 1363 } |
| OLD | NEW |