summaryrefslogtreecommitdiffstats
path: root/webkit/tools/test_shell/test_shell.cc
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-11 19:36:56 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-11 19:36:56 +0000
commit99519dc7184abc349683c092a292923604ba9f5b (patch)
tree4c103ff4ee68bd0d4e1d39d3b88c6d7e582a949c /webkit/tools/test_shell/test_shell.cc
parent0b2765e449455ccd543d829df055a61fb3001108 (diff)
downloadchromium_src-99519dc7184abc349683c092a292923604ba9f5b.zip
chromium_src-99519dc7184abc349683c092a292923604ba9f5b.tar.gz
chromium_src-99519dc7184abc349683c092a292923604ba9f5b.tar.bz2
Remove WebView::SetDelegate because I'd like to avoid having a method like this
in the WebKit API. The only consumer was TestShell. It was using this method to replace its TestWebViewDelegate instance. Instead, with this change, it has a manual Reset method. To avoid duplication with the constructor, Reset uses operator=(). This required a couple changes: 1- Remove DISALLOW_COPY_AND_ASSIGN from WebViewDelegate. Anyways, that didn't make sense since you cannot 'copy' a class with pure virtual methods. 2- Change scoped_ptr members of TestWebViewDelegate to linked_ptr. The extra overhead of the linked_ptr seems warranted in this case. I also changed TestWebViewDelegate to not be reference counted since it wasn't necessary. R=tony BUG=none TEST=none Review URL: http://codereview.chromium.org/164308 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23068 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools/test_shell/test_shell.cc')
-rw-r--r--webkit/tools/test_shell/test_shell.cc17
1 files changed, 9 insertions, 8 deletions
diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc
index 1d296bf..df1f953 100644
--- a/webkit/tools/test_shell/test_shell.cc
+++ b/webkit/tools/test_shell/test_shell.cc
@@ -112,8 +112,8 @@ TestShell::TestShell()
test_is_pending_(false),
is_modal_(false),
dump_stats_table_on_exit_(false) {
- delegate_ = new TestWebViewDelegate(this);
- popup_delegate_ = new TestWebViewDelegate(this);
+ delegate_.reset(new TestWebViewDelegate(this));
+ popup_delegate_.reset(new TestWebViewDelegate(this));
layout_test_controller_.reset(new LayoutTestController(this));
event_sending_controller_.reset(new EventSendingController(this));
text_input_controller_.reset(new TextInputController(this));
@@ -126,6 +126,8 @@ TestShell::TestShell()
}
TestShell::~TestShell() {
+ delegate_->RevokeDragDrop();
+
// Navigate to an empty page to fire all the destruction logic for the
// current page.
LoadURL(L"about:blank");
@@ -134,7 +136,9 @@ TestShell::~TestShell() {
CallJSGC();
CallJSGC();
- webView()->SetDelegate(NULL);
+ // Destroy the WebView before the TestWebViewDelegate.
+ m_webViewHost.reset();
+
PlatformCleanUp();
StatsTable *table = StatsTable::current();
@@ -502,14 +506,11 @@ void TestShell::SizeToDefault() {
void TestShell::ResetTestController() {
layout_test_controller_->Reset();
event_sending_controller_->Reset();
-
- // Reset state in the test webview delegate.
- delegate_ = new TestWebViewDelegate(this);
- webView()->SetDelegate(delegate_);
+ delegate_->Reset();
}
void TestShell::LoadURL(const wchar_t* url) {
- LoadURLForFrame(url, NULL);
+ LoadURLForFrame(url, NULL);
}
bool TestShell::Navigate(const TestNavigationEntry& entry, bool reload) {