summaryrefslogtreecommitdiffstats
path: root/webkit/tools/test_shell/test_webview_delegate.cc
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-05 06:11:00 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-05 06:11:00 +0000
commit4d4a6356e8e1a6ac0b177cb6bd398148030cb320 (patch)
tree9b6856e1e8523dc782c08ae917882250c5ed0503 /webkit/tools/test_shell/test_webview_delegate.cc
parentca8de285102e2df854f56fce3c7163d5a8db7f5a (diff)
downloadchromium_src-4d4a6356e8e1a6ac0b177cb6bd398148030cb320.zip
chromium_src-4d4a6356e8e1a6ac0b177cb6bd398148030cb320.tar.gz
chromium_src-4d4a6356e8e1a6ac0b177cb6bd398148030cb320.tar.bz2
Re-do r15244: Fix crash in ~TestWebViewDelegate caused by
shell_ being null. Moved the RevokeDragDrop call to the TestShell destructor instead. Eliminate webkit/glue/webhistoryitem* in favor of adding a NavigateBackForwardSoon method WebViewDelegate. This moves all of the hacky details of how we intercept "history.{back, forward,go}" into the webkit layer. My eventual plan is to teach WebCore how to make this not hacky. BUG=11423 R=mpcomplete Review URL: http://codereview.chromium.org/108004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15278 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools/test_shell/test_webview_delegate.cc')
-rwxr-xr-xwebkit/tools/test_shell/test_webview_delegate.cc29
1 files changed, 16 insertions, 13 deletions
diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc
index 4bf5601..c891c79 100755
--- a/webkit/tools/test_shell/test_webview_delegate.cc
+++ b/webkit/tools/test_shell/test_webview_delegate.cc
@@ -114,6 +114,14 @@ WebWidget* TestWebViewDelegate::CreatePopupWidget(WebView* webview,
return shell_->CreatePopupWidget(webview);
}
+WebWorker* TestWebViewDelegate::CreateWebWorker(WebWorkerClient* client) {
+#if ENABLE(WORKERS)
+ return TestWebWorkerHelper::CreateWebWorker(client);
+#else
+ return NULL;
+#endif
+}
+
void TestWebViewDelegate::OpenURL(WebView* webview, const GURL& url,
const GURL& referrer,
WindowOpenDisposition disposition) {
@@ -660,13 +668,11 @@ void TestWebViewDelegate::DidEndEditing() {
}
}
-WebHistoryItem* TestWebViewDelegate::GetHistoryEntryAtOffset(int offset) {
- TestNavigationEntry* entry = static_cast<TestNavigationEntry*>(
- shell_->navigation_controller()->GetEntryAtOffset(offset));
- if (!entry)
- return NULL;
-
- return entry->GetHistoryItem();
+void TestWebViewDelegate::NavigateBackForwardSoon(int offset) {
+ // We start this navigation via a delayed task to match Chrome's asynchronous
+ // implementation of this method.
+ MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod(
+ this, &TestWebViewDelegate::NavigateBackForward, offset));
}
int TestWebViewDelegate::GetHistoryBackListCount() {
@@ -888,10 +894,7 @@ std::wstring TestWebViewDelegate::GetFrameDescription(WebFrame* webframe) {
}
}
-WebWorker* TestWebViewDelegate::CreateWebWorker(WebWorkerClient* client) {
-#if ENABLE(WORKERS)
- return TestWebWorkerHelper::CreateWebWorker(client);
-#else
- return NULL;
-#endif
+void TestWebViewDelegate::NavigateBackForward(int offset) {
+ if (shell_)
+ shell_->navigation_controller()->GoToOffset(offset);
}