summaryrefslogtreecommitdiffstats
path: root/webkit/tools
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-04 21:28:48 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-04 21:28:48 +0000
commit8ee37f03d400794478584634d3d493a12f6b989d (patch)
treec6418a199d69b13bf0e05e558da2bcd60e971850 /webkit/tools
parent8165dcf042237c13d41aaad2a9c654c64bc4cb35 (diff)
downloadchromium_src-8ee37f03d400794478584634d3d493a12f6b989d.zip
chromium_src-8ee37f03d400794478584634d3d493a12f6b989d.tar.gz
chromium_src-8ee37f03d400794478584634d3d493a12f6b989d.tar.bz2
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/100353 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15244 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools')
-rw-r--r--webkit/tools/test_shell/test_navigation_controller.cc13
-rw-r--r--webkit/tools/test_shell/test_navigation_controller.h4
-rwxr-xr-xwebkit/tools/test_shell/test_shell.cc1
-rwxr-xr-xwebkit/tools/test_shell/test_webview_delegate.cc29
-rw-r--r--webkit/tools/test_shell/test_webview_delegate.h6
5 files changed, 22 insertions, 31 deletions
diff --git a/webkit/tools/test_shell/test_navigation_controller.cc b/webkit/tools/test_shell/test_navigation_controller.cc
index ff4a753..cf26baf 100644
--- a/webkit/tools/test_shell/test_navigation_controller.cc
+++ b/webkit/tools/test_shell/test_navigation_controller.cc
@@ -5,7 +5,6 @@
#include "webkit/tools/test_shell/test_navigation_controller.h"
#include "base/logging.h"
-#include "webkit/glue/webhistoryitem.h"
#include "webkit/tools/test_shell/test_shell.h"
// ----------------------------------------------------------------------------
@@ -29,21 +28,9 @@ TestNavigationEntry::~TestNavigationEntry() {
}
void TestNavigationEntry::SetContentState(const std::string& state) {
- cached_history_item_ = NULL; // invalidate our cached item
state_ = state;
}
-WebHistoryItem* TestNavigationEntry::GetHistoryItem() const {
- if (!cached_history_item_) {
- TestShellExtraRequestData* extra_data =
- new TestShellExtraRequestData(GetPageID());
- cached_history_item_ =
- WebHistoryItem::Create(GetURL(), GetTitle(), GetContentState(),
- extra_data);
- }
- return cached_history_item_;
-}
-
// ----------------------------------------------------------------------------
// TestNavigationController
diff --git a/webkit/tools/test_shell/test_navigation_controller.h b/webkit/tools/test_shell/test_navigation_controller.h
index 07f42f8..e24fff30 100644
--- a/webkit/tools/test_shell/test_navigation_controller.h
+++ b/webkit/tools/test_shell/test_navigation_controller.h
@@ -16,7 +16,6 @@
class GURL;
class TestShell;
-class WebHistoryItem;
// Associated with browser-initated navigations to hold tracking data.
class TestShellExtraRequestData : public WebRequest::ExtraData {
@@ -67,7 +66,6 @@ class TestNavigationEntry {
void SetPageID(int page_id) { page_id_ = page_id; }
int32 GetPageID() const { return page_id_; }
- WebHistoryItem* GetHistoryItem() const;
const std::wstring& GetTargetFrame() const { return target_frame_; }
private:
@@ -79,8 +77,6 @@ class TestNavigationEntry {
std::wstring title_;
std::string state_;
- mutable scoped_refptr<WebHistoryItem> cached_history_item_;
-
std::wstring target_frame_;
DISALLOW_COPY_AND_ASSIGN(TestNavigationEntry);
diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc
index 96a5ca5..3f88d26 100755
--- a/webkit/tools/test_shell/test_shell.cc
+++ b/webkit/tools/test_shell/test_shell.cc
@@ -125,6 +125,7 @@ TestShell::~TestShell() {
CallJSGC();
CallJSGC();
+ delegate_->clear_test_shell();
webView()->SetDelegate(NULL);
PlatformCleanUp();
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);
}
diff --git a/webkit/tools/test_shell/test_webview_delegate.h b/webkit/tools/test_shell/test_webview_delegate.h
index 79fd25d..d6e1001 100644
--- a/webkit/tools/test_shell/test_webview_delegate.h
+++ b/webkit/tools/test_shell/test_webview_delegate.h
@@ -205,7 +205,7 @@ class TestWebViewDelegate : public base::RefCounted<TestWebViewDelegate>,
WebNavigationType type,
WindowOpenDisposition disposition,
bool is_redirect);
- virtual WebHistoryItem* GetHistoryEntryAtOffset(int offset);
+ virtual void NavigateBackForwardSoon(int offset);
virtual int GetHistoryBackListCount();
virtual int GetHistoryForwardListCount();
@@ -269,6 +269,8 @@ class TestWebViewDelegate : public base::RefCounted<TestWebViewDelegate>,
void SetCustomPolicyDelegate(bool is_custom, bool is_permissive);
void WaitForPolicyDelegate();
+ void clear_test_shell() { shell_ = NULL; }
+
protected:
// Called the title of the page changes.
// Can be used to update the title of the window.
@@ -302,6 +304,8 @@ class TestWebViewDelegate : public base::RefCounted<TestWebViewDelegate>,
// Get a string suitable for dumping a frame to the console.
std::wstring GetFrameDescription(WebFrame* webframe);
+ void NavigateBackForward(int offset);
+
private:
// Causes navigation actions just printout the intended navigation instead
// of taking you to the page. This is used for cases like mailto, where you