summaryrefslogtreecommitdiffstats
path: root/webkit/glue/webframeloaderclient_impl.cc
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-13 06:02:39 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-13 06:02:39 +0000
commitefdb3e59f68fe34ef19dd6e52a5555e19f9b26b4 (patch)
tree717f7caca9e5b8191c0f1ff4cb1f3b00c0281e75 /webkit/glue/webframeloaderclient_impl.cc
parent235df3ac876638d8f09eb62c6b8504446e19b63b (diff)
downloadchromium_src-efdb3e59f68fe34ef19dd6e52a5555e19f9b26b4.zip
chromium_src-efdb3e59f68fe34ef19dd6e52a5555e19f9b26b4.tar.gz
chromium_src-efdb3e59f68fe34ef19dd6e52a5555e19f9b26b4.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. BUG=11423 TBR=mpcomplete Review URL: http://codereview.chromium.org/115288 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15940 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webframeloaderclient_impl.cc')
-rw-r--r--webkit/glue/webframeloaderclient_impl.cc50
1 files changed, 34 insertions, 16 deletions
diff --git a/webkit/glue/webframeloaderclient_impl.cc b/webkit/glue/webframeloaderclient_impl.cc
index 0ed8a39..b401d15 100644
--- a/webkit/glue/webframeloaderclient_impl.cc
+++ b/webkit/glue/webframeloaderclient_impl.cc
@@ -56,7 +56,6 @@ MSVC_POP_WARNING();
#include "webkit/glue/webdevtoolsagent_impl.h"
#include "webkit/glue/weberror_impl.h"
#include "webkit/glue/webframeloaderclient_impl.h"
-#include "webkit/glue/webhistoryitem_impl.h"
#include "webkit/glue/webkit_glue.h"
#include "webkit/glue/webplugin_impl.h"
#include "webkit/glue/webresponse_impl.h"
@@ -787,16 +786,6 @@ void WebFrameLoaderClient::dispatchDidStartProvisionalLoad() {
alt_404_page_fetcher_->Cancel();
}
-NavigationGesture WebFrameLoaderClient::NavigationGestureForLastLoad() {
- // TODO(timsteele): userGestureHint returns too many false positives
- // (see bug 1051891) to trust it and assign NavigationGestureUser, so
- // for now we assign Unknown in those cases and Auto otherwise.
- // (Issue 874811 known false negative as well).
- return webframe_->frame()->loader()->userGestureHint() ?
- NavigationGestureUnknown :
- NavigationGestureAuto;
-}
-
void WebFrameLoaderClient::dispatchDidReceiveTitle(const String& title) {
WebViewImpl* webview = webframe_->GetWebViewImpl();
WebViewDelegate* d = webview->delegate();
@@ -1021,13 +1010,19 @@ void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(
// such navigations.
const WebDataSourceImpl* ds = webframe_->GetProvisionalDataSourceImpl();
if (ds) {
- bool is_redirect = !ds->GetRedirectChain().empty();
+ const GURL& url = ds->GetRequest().GetURL();
+ if (url.SchemeIs(webkit_glue::kBackForwardNavigationScheme)) {
+ HandleBackForwardNavigation(url);
+ disposition = IGNORE_ACTION;
+ } else {
+ bool is_redirect = !ds->GetRedirectChain().empty();
- WebNavigationType webnav_type =
- WebDataSourceImpl::NavigationTypeToWebNavigationType(action.type());
+ WebNavigationType webnav_type =
+ WebDataSourceImpl::NavigationTypeToWebNavigationType(action.type());
- disposition = d->DispositionForNavigationAction(
- wv, webframe_, &ds->GetRequest(), webnav_type, disposition, is_redirect);
+ disposition = d->DispositionForNavigationAction(
+ wv, webframe_, &ds->GetRequest(), webnav_type, disposition, is_redirect);
+ }
if (disposition != IGNORE_ACTION) {
if (disposition == CURRENT_TAB) {
@@ -1637,6 +1632,29 @@ bool WebFrameLoaderClient::ActionSpecifiesDisposition(
return true;
}
+NavigationGesture WebFrameLoaderClient::NavigationGestureForLastLoad() {
+ // TODO(timsteele): userGestureHint returns too many false positives
+ // (see bug 1051891) to trust it and assign NavigationGestureUser, so
+ // for now we assign Unknown in those cases and Auto otherwise.
+ // (Issue 874811 known false negative as well).
+ return webframe_->frame()->loader()->userGestureHint() ?
+ NavigationGestureUnknown :
+ NavigationGestureAuto;
+}
+
+void WebFrameLoaderClient::HandleBackForwardNavigation(const GURL& url) {
+ DCHECK(url.SchemeIs(webkit_glue::kBackForwardNavigationScheme));
+
+ std::string offset_str = url.ExtractFileName();
+ int offset;
+ if (!StringToInt(offset_str, &offset))
+ return;
+
+ WebViewDelegate* d = webframe_->GetWebViewImpl()->delegate();
+ if (d)
+ d->NavigateBackForwardSoon(offset);
+}
+
NetAgentImpl* WebFrameLoaderClient::GetNetAgentImpl() {
WebViewImpl* web_view = webframe_->GetWebViewImpl();
if (!web_view) {