| Index: webkit/glue/webframeloaderclient_impl.cc
|
| ===================================================================
|
| --- webkit/glue/webframeloaderclient_impl.cc (revision 28523)
|
| +++ webkit/glue/webframeloaderclient_impl.cc (working copy)
|
| @@ -4,9 +4,6 @@
|
|
|
| #include "config.h"
|
|
|
| -#include <string>
|
| -#include <vector>
|
| -
|
| #include "Chrome.h"
|
| #include "CString.h"
|
| #include "Document.h"
|
| @@ -26,9 +23,6 @@
|
| #include "WindowFeatures.h"
|
| #undef LOG
|
|
|
| -#include "base/basictypes.h"
|
| -#include "base/logging.h"
|
| -#include "base/string_util.h"
|
| #include "net/base/mime_util.h"
|
| #include "net/base/net_errors.h"
|
| #include "webkit/api/public/WebForm.h"
|
| @@ -45,19 +39,14 @@
|
| #include "webkit/api/src/WrappedResourceRequest.h"
|
| #include "webkit/api/src/WrappedResourceResponse.h"
|
| #include "webkit/glue/glue_util.h"
|
| -#include "webkit/glue/plugins/plugin_list.h"
|
| #include "webkit/glue/webdevtoolsagent_impl.h"
|
| #include "webkit/glue/webframe_impl.h"
|
| #include "webkit/glue/webframeloaderclient_impl.h"
|
| #include "webkit/glue/webkit_glue.h"
|
| -#include "webkit/glue/webview_delegate.h"
|
| #include "webkit/glue/webview_impl.h"
|
|
|
| using namespace WebCore;
|
|
|
| -using base::Time;
|
| -using base::TimeDelta;
|
| -
|
| using WebKit::WebData;
|
| using WebKit::WebDataSourceImpl;
|
| using WebKit::WebNavigationType;
|
| @@ -426,7 +415,8 @@
|
| void WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad() {
|
| WebDataSourceImpl* ds = webframe_->GetProvisionalDataSourceImpl();
|
| if (!ds) {
|
| - NOTREACHED() << "Got a server redirect when there is no provisional DS";
|
| + // Got a server redirect when there is no provisional DS!
|
| + ASSERT_NOT_REACHED();
|
| return;
|
| }
|
|
|
| @@ -436,13 +426,13 @@
|
|
|
| // A provisional load should have started already, which should have put an
|
| // entry in our redirect chain.
|
| - DCHECK(ds->hasRedirectChain());
|
| + ASSERT(ds->hasRedirectChain());
|
|
|
| // The URL of the destination is on the provisional data source. We also need
|
| // to update the redirect chain to account for this addition (we do this
|
| // before the callback so the callback can look at the redirect chain to see
|
| // what happened).
|
| - ds->appendRedirect(ds->request().url());
|
| + ds->appendRedirect(webkit_glue::WebURLToKURL(ds->request().url()));
|
|
|
| if (webframe_->client())
|
| webframe_->client()->didReceiveServerRedirectForProvisionalLoad(webframe_);
|
| @@ -452,8 +442,8 @@
|
| void WebFrameLoaderClient::dispatchDidCancelClientRedirect() {
|
| // No longer expecting a client redirect.
|
| if (webframe_->client()) {
|
| - expected_client_redirect_src_ = GURL();
|
| - expected_client_redirect_dest_ = GURL();
|
| + expected_client_redirect_src_ = KURL();
|
| + expected_client_redirect_dest_ = KURL();
|
| webframe_->client()->didCancelClientRedirect(webframe_);
|
| }
|
|
|
| @@ -467,26 +457,25 @@
|
| double fire_date) {
|
| // Tells dispatchDidStartProvisionalLoad that if it sees this item it is a
|
| // redirect and the source item should be added as the start of the chain.
|
| - expected_client_redirect_src_ = webframe_->url();
|
| - expected_client_redirect_dest_ = webkit_glue::KURLToGURL(url);
|
| + expected_client_redirect_src_ = webkit_glue::WebURLToKURL(webframe_->url());
|
| + expected_client_redirect_dest_ = url;
|
|
|
| // TODO(timsteele): bug 1135512. Webkit does not properly notify us of
|
| // cancelling http > file client redirects. Since the FrameLoader's policy
|
| // is to never carry out such a navigation anyway, the best thing we can do
|
| // for now to not get confused is ignore this notification.
|
| - if (expected_client_redirect_dest_.SchemeIsFile() &&
|
| - (expected_client_redirect_src_.SchemeIs("http") ||
|
| - expected_client_redirect_src_.SchemeIsSecure())) {
|
| - expected_client_redirect_src_ = GURL();
|
| - expected_client_redirect_dest_ = GURL();
|
| + if (expected_client_redirect_dest_.isLocalFile() &&
|
| + expected_client_redirect_src_.protocolInHTTPFamily()) {
|
| + expected_client_redirect_src_ = KURL();
|
| + expected_client_redirect_dest_ = KURL();
|
| return;
|
| }
|
|
|
| if (webframe_->client()) {
|
| webframe_->client()->willPerformClientRedirect(
|
| webframe_,
|
| - expected_client_redirect_src_,
|
| - expected_client_redirect_dest_,
|
| + webkit_glue::KURLToWebURL(expected_client_redirect_src_),
|
| + webkit_glue::KURLToWebURL(expected_client_redirect_dest_),
|
| static_cast<unsigned int>(interval),
|
| static_cast<unsigned int>(fire_date));
|
| }
|
| @@ -500,10 +489,10 @@
|
| webview->client()->didStartLoading();
|
|
|
| WebDataSourceImpl* ds = webframe_->GetDataSourceImpl();
|
| - DCHECK(ds) << "DataSource NULL when navigating to reference fragment";
|
| + ASSERT(ds); // Should not be null when navigating to a reference fragment!
|
| if (ds) {
|
| - GURL url = ds->request().url();
|
| - GURL chain_end = ds->endOfRedirectChain();
|
| + KURL url = webkit_glue::WebURLToKURL(ds->request().url());
|
| + KURL chain_end = ds->endOfRedirectChain();
|
| ds->clearRedirectChain();
|
|
|
| // Figure out if this location change is because of a JS-initiated client
|
| @@ -520,13 +509,15 @@
|
| !webframe_->isProcessingUserGesture();
|
|
|
| if (was_client_redirect) {
|
| - if (webframe_->client())
|
| - webframe_->client()->didCompleteClientRedirect(webframe_, chain_end);
|
| + if (webframe_->client()) {
|
| + webframe_->client()->didCompleteClientRedirect(
|
| + webframe_, webkit_glue::KURLToWebURL(chain_end));
|
| + }
|
| ds->appendRedirect(chain_end);
|
| // Make sure we clear the expected redirect since we just effectively
|
| // completed it.
|
| - expected_client_redirect_src_ = GURL();
|
| - expected_client_redirect_dest_ = GURL();
|
| + expected_client_redirect_src_ = KURL();
|
| + expected_client_redirect_dest_ = KURL();
|
| }
|
|
|
| // Regardless of how we got here, we are navigating to a URL so we need to
|
| @@ -563,24 +554,24 @@
|
| // See dispatchDidReceiveServerRedirectForProvisionalLoad.
|
| WebDataSourceImpl* ds = webframe_->GetProvisionalDataSourceImpl();
|
| if (!ds) {
|
| - NOTREACHED() << "Attempting to provisional load but there isn't one";
|
| + ASSERT_NOT_REACHED();
|
| return;
|
| }
|
| - GURL url = ds->request().url();
|
| + KURL url = webkit_glue::WebURLToKURL(ds->request().url());
|
|
|
| // Since the provisional load just started, we should have not gotten
|
| // any redirects yet.
|
| - DCHECK(!ds->hasRedirectChain());
|
| + ASSERT(!ds->hasRedirectChain());
|
|
|
| // If this load is what we expected from a client redirect, treat it as a
|
| // redirect from that original page. The expected redirect urls will be
|
| // cleared by DidCancelClientRedirect.
|
| bool completing_client_redirect = false;
|
| - if (expected_client_redirect_src_.is_valid()) {
|
| + if (expected_client_redirect_src_.isValid()) {
|
| // expected_client_redirect_dest_ could be something like
|
| // "javascript:history.go(-1)" thus we need to exclude url starts with
|
| // "javascript:". See bug: 1080873
|
| - DCHECK(expected_client_redirect_dest_.SchemeIs("javascript") ||
|
| + ASSERT(expected_client_redirect_dest_.protocolIs("javascript") ||
|
| expected_client_redirect_dest_ == url);
|
| ds->appendRedirect(expected_client_redirect_src_);
|
| completing_client_redirect = true;
|
| @@ -596,7 +587,7 @@
|
| webframe_->client()->didStartProvisionalLoad(webframe_);
|
| if (completing_client_redirect)
|
| webframe_->client()->didCompleteClientRedirect(
|
| - webframe_, expected_client_redirect_src_);
|
| + webframe_, webkit_glue::KURLToWebURL(expected_client_redirect_src_));
|
| }
|
| }
|
|
|
| @@ -682,7 +673,7 @@
|
|
|
| // Make sure that we have a valid disposition. This should have been set in
|
| // the preceeding call to dispatchDecidePolicyForNewWindowAction.
|
| - DCHECK(next_navigation_policy_ != WebKit::WebNavigationPolicyIgnore);
|
| + ASSERT(next_navigation_policy_ != WebKit::WebNavigationPolicyIgnore);
|
| WebNavigationPolicy policy = next_navigation_policy_;
|
| next_navigation_policy_ = WebKit::WebNavigationPolicyIgnore;
|
|
|
| @@ -696,9 +687,8 @@
|
|
|
| void WebFrameLoaderClient::dispatchShow() {
|
| WebViewImpl* webview = webframe_->GetWebViewImpl();
|
| - WebViewDelegate* d = webview->delegate();
|
| - if (d)
|
| - d->show(webview->initial_navigation_policy());
|
| + if (webview && webview->client())
|
| + webview->client()->show(webview->initial_navigation_policy());
|
| }
|
|
|
| static bool TreatAsAttachment(const ResourceResponse& response) {
|
| @@ -806,8 +796,8 @@
|
| // Give the delegate a chance to change the navigation policy.
|
| const WebDataSourceImpl* ds = webframe_->GetProvisionalDataSourceImpl();
|
| if (ds) {
|
| - GURL url = ds->request().url();
|
| - if (url.SchemeIs(webkit_glue::kBackForwardNavigationScheme)) {
|
| + KURL url = webkit_glue::WebURLToKURL(ds->request().url());
|
| + if (url.protocolIs(webkit_glue::kBackForwardNavigationScheme)) {
|
| HandleBackForwardNavigation(url);
|
| navigation_policy = WebKit::WebNavigationPolicyIgnore;
|
| } else {
|
| @@ -1136,7 +1126,8 @@
|
| }
|
|
|
| void WebFrameLoaderClient::savePlatformDataToCachedFrame(WebCore::CachedFrame*) {
|
| - NOTREACHED() << "Page cache should be disabled";
|
| + // The page cache should be disabled.
|
| + ASSERT_NOT_REACHED();
|
| }
|
|
|
| void WebFrameLoaderClient::transitionToCommittedFromCachedFrame(WebCore::CachedFrame*) {
|
| @@ -1161,7 +1152,7 @@
|
| const ResourceRequest& request,
|
| const ResourceRequest& initialRequest,
|
| const ResourceResponse& response) {
|
| - NOTREACHED();
|
| + ASSERT_NOT_REACHED();
|
| }
|
|
|
| PassRefPtr<Frame> WebFrameLoaderClient::createFrame(
|
| @@ -1230,7 +1221,7 @@
|
| // (e.g., acrobat reader).
|
| void WebFrameLoaderClient::redirectDataToPlugin(Widget* pluginWidget) {
|
| plugin_widget_ = static_cast<WebPluginContainerImpl*>(pluginWidget);
|
| - DCHECK(plugin_widget_.get());
|
| + ASSERT(plugin_widget_.get());
|
| }
|
|
|
| PassRefPtr<Widget> WebFrameLoaderClient::createJavaAppletWidget(
|
| @@ -1277,8 +1268,7 @@
|
|
|
| String WebFrameLoaderClient::overrideMediaType() const {
|
| // FIXME
|
| - String rv;
|
| - return rv;
|
| + return String();
|
| }
|
|
|
| bool WebFrameLoaderClient::ActionSpecifiesNavigationPolicy(
|
| @@ -1294,12 +1284,12 @@
|
| policy);
|
| }
|
|
|
| -void WebFrameLoaderClient::HandleBackForwardNavigation(const GURL& url) {
|
| - DCHECK(url.SchemeIs(webkit_glue::kBackForwardNavigationScheme));
|
| +void WebFrameLoaderClient::HandleBackForwardNavigation(const KURL& url) {
|
| + ASSERT(url.protocolIs(webkit_glue::kBackForwardNavigationScheme));
|
|
|
| - std::string offset_str = url.ExtractFileName();
|
| - int offset;
|
| - if (!StringToInt(offset_str, &offset))
|
| + bool ok;
|
| + int offset = url.lastPathComponent().toIntStrict(&ok);
|
| + if (!ok)
|
| return;
|
|
|
| WebViewImpl* webview = webframe_->GetWebViewImpl();
|
|
|