diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-13 21:12:03 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-13 21:12:03 +0000 |
commit | f6e59a6f478826a9a1d75b18f10f285487f18fac (patch) | |
tree | 0336e7be11b059b8e3cec7a2eef273fa0ef0994d /chrome/renderer | |
parent | 7502d0224e51f54f1d65fbfce6d100e99dc819dc (diff) | |
download | chromium_src-f6e59a6f478826a9a1d75b18f10f285487f18fac.zip chromium_src-f6e59a6f478826a9a1d75b18f10f285487f18fac.tar.gz chromium_src-f6e59a6f478826a9a1d75b18f10f285487f18fac.tar.bz2 |
Re-do r15244 again.
Originally reviewed at http://codereview.chromium.org/100353
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.
In this version of the CL, TestWebViewDelegate performs the
back/forward navigation directly in NavigateBackForwardSoon
instead of using PostTask to delay it. I'm doing this to
minimize regressions so that I can hopefully get the rest of
this CL landed.
I also already made the changes to WebKit to force history.
{back,forward,go} to be processed asynchronously.
Finally, it was necessary to move DumpBackForwardList out of
webkit_glue.cc since it was using itemAtIndex to generate
those results, and now that we return synthetic URLs for
that function, the results were very wrong. The fix is to
move DumpBackForwardList into TestShell so that it can more
directly inspect the TestNavigationController. Now, it is
necessary for webkit_glue.h to expose a function to dump
a content state string (aka a WebCore::HistoryItem).
BUG=11423
R=mpcomplete
Review URL: http://codereview.chromium.org/113328
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15997 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/render_view.cc | 23 | ||||
-rw-r--r-- | chrome/renderer/render_view.h | 11 |
2 files changed, 2 insertions, 32 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index a38a710..1907c80 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -68,7 +68,6 @@ #include "webkit/glue/webdropdata.h" #include "webkit/glue/weberror.h" #include "webkit/glue/webframe.h" -#include "webkit/glue/webhistoryitem.h" #include "webkit/glue/webkit_glue.h" #include "webkit/glue/webpreferences.h" #include "webkit/glue/webplugin_delegate.h" @@ -1565,13 +1564,6 @@ WindowOpenDisposition RenderView::DispositionForNavigationAction( url.SchemeIs(chrome::kViewSourceScheme)) { OpenURL(webview, url, GURL(), disposition); return IGNORE_ACTION; // Suppress the load here. - } else if (url.SchemeIs(kBackForwardNavigationScheme)) { - std::string offset_str = url.ExtractFileName(); - int offset; - if (StringToInt(offset_str, &offset)) { - GoToEntryAtOffset(offset); - return IGNORE_ACTION; // The browser process handles this one. - } } } } @@ -2459,20 +2451,7 @@ void RenderView::OnAutofillFormSubmitted(WebView* webview, Send(new ViewHostMsg_AutofillFormSubmitted(routing_id_, form)); } -WebHistoryItem* RenderView::GetHistoryEntryAtOffset(int offset) { - // Our history list is kept in the browser process on the UI thread. Since - // we can't make a sync IPC call to that thread without risking deadlock, - // we use a trick: construct a fake history item of the form: - // history://go/OFFSET - // When WebCore tells us to navigate to it, we tell the browser process to - // do a back/forward navigation instead. - - GURL url(StringPrintf("%s://go/%d", kBackForwardNavigationScheme, offset)); - history_navigation_item_ = WebHistoryItem::Create(url, L"", "", NULL); - return history_navigation_item_.get(); -} - -void RenderView::GoToEntryAtOffset(int offset) { +void RenderView::NavigateBackForwardSoon(int offset) { history_back_list_count_ += offset; history_forward_list_count_ -= offset; diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h index e58a641..ee03c7a 100644 --- a/chrome/renderer/render_view.h +++ b/chrome/renderer/render_view.h @@ -279,7 +279,7 @@ class RenderView : public RenderWidget, virtual void TakeFocus(WebView* webview, bool reverse); virtual void JSOutOfMemory(); - virtual WebHistoryItem* GetHistoryEntryAtOffset(int offset); + virtual void NavigateBackForwardSoon(int offset); virtual int GetHistoryBackListCount(); virtual int GetHistoryForwardListCount(); virtual void OnNavStateChanged(WebView* webview); @@ -463,10 +463,6 @@ class RenderView : public RenderWidget, // keyword search. void AddGURLSearchProvider(const GURL& osd_url, bool autodetected); - // Tells the browser process to navigate to a back/forward entry at the given - // offset from current. - void GoToEntryAtOffset(int offset); - // RenderView IPC message handlers void SendThumbnail(); void OnPrintPages(); @@ -771,11 +767,6 @@ class RenderView : public RenderWidget, // out of date responses. int form_field_autofill_request_id_; - // A cached WebHistoryItem used for back/forward navigations initiated by - // WebCore (via the window.history.go API). We only have one such navigation - // pending at a time. - scoped_refptr<WebHistoryItem> history_navigation_item_; - // We need to prevent windows from closing themselves with a window.close() // call while a blocked popup notification is being displayed. We cannot // synchronously query the Browser process. We cannot wait for the Browser |