| Index: webkit/glue/webframeloaderclient_impl.cc
|
| ===================================================================
|
| --- webkit/glue/webframeloaderclient_impl.cc (revision 13095)
|
| +++ webkit/glue/webframeloaderclient_impl.cc (working copy)
|
| @@ -29,6 +29,7 @@
|
| #include "PlatformString.h"
|
| #include "PluginData.h"
|
| #include "RefPtr.h"
|
| +#include "StringExtras.h"
|
| #include "WindowFeatures.h"
|
| MSVC_POP_WARNING();
|
|
|
| @@ -60,8 +61,11 @@
|
| #include "webkit/glue/webview_delegate.h"
|
| #include "webkit/glue/webview_impl.h"
|
| #include "webkit/glue/weburlrequest.h"
|
| +#include "webkit/glue/weburlrequest_impl.h"
|
|
|
| using namespace WebCore;
|
| +using base::Time;
|
| +using base::TimeDelta;
|
|
|
| // Domain for internal error codes.
|
| static const char kInternalErrorDomain[] = "webkit_glue";
|
| @@ -383,6 +387,10 @@
|
| void WebFrameLoaderClient::dispatchDidFinishDocumentLoad() {
|
| WebViewImpl* webview = webframe_->webview_impl();
|
| WebViewDelegate* d = webview->delegate();
|
| + DocumentLoader* documentLoader =
|
| + webframe_->frame()->loader()->activeDocumentLoader();
|
| + WebDataSourceImpl* data_source =
|
| + WebDataSourceImpl::FromLoader(documentLoader);
|
|
|
| // A frame may be reused. This call ensures we don't hold on to our password
|
| // listeners and their associated HTMLInputElements.
|
| @@ -419,6 +427,7 @@
|
| d->OnPasswordFormsSeen(webview, passwordForms);
|
| if (d)
|
| d->DidFinishDocumentLoadForFrame(webview, webframe_);
|
| + data_source->set_finish_document_load_time(base::Time::Now());
|
| }
|
|
|
| bool WebFrameLoaderClient::dispatchDidLoadResourceFromMemoryCache(
|
| @@ -731,6 +740,21 @@
|
| // about the client redirect the load is responsible for completing.
|
| d->DidStartProvisionalLoadForFrame(webview, webframe_,
|
| NavigationGestureForLastLoad());
|
| + DocumentLoader* documentLoader =
|
| + webframe_->frame()->loader()->activeDocumentLoader();
|
| + WebDataSourceImpl* dataSource =
|
| + WebDataSourceImpl::FromLoader(documentLoader);
|
| + if (dataSource->GetRequestTime().ToInternalValue() == 0) {
|
| + const Event *event = documentLoader->triggeringAction().event();
|
| + if (event) {
|
| + // If the request was generated by a click, we have to use the time
|
| + // from the event. Unfortunately this isn't tracked all the way from
|
| + // the platform event, but it will have to do
|
| + double eventTime = event->timeStamp() / 1000.0;
|
| + dataSource->set_request_time(Time::FromDoubleT(eventTime));
|
| + }
|
| + }
|
| + dataSource->set_start_load_time(base::Time::Now());
|
| if (completing_client_redirect)
|
| d->DidCompleteClientRedirect(webview, webframe_,
|
| expected_client_redirect_src_);
|
| @@ -803,8 +827,13 @@
|
| }
|
|
|
| void WebFrameLoaderClient::dispatchDidFinishLoad() {
|
| + DocumentLoader* documentLoader =
|
| + webframe_->frame()->loader()->activeDocumentLoader();
|
| + WebDataSourceImpl* dataSource =
|
| + WebDataSourceImpl::FromLoader(documentLoader);
|
| WebViewImpl* webview = webframe_->webview_impl();
|
| WebViewDelegate* d = webview->delegate();
|
| + dataSource->set_finish_load_time(base::Time::Now());
|
| if (d)
|
| d->DidFinishLoadForFrame(webview, webframe_);
|
| WebPluginDelegate* plg_delegate = webframe_->plugin_delegate();
|
| @@ -939,26 +968,6 @@
|
| (webframe_->frame()->loader()->*function)(policy_action);
|
| }
|
|
|
| -// Conversion.
|
| -static WebNavigationType NavigationTypeToWebNavigationType(
|
| - WebCore::NavigationType t) {
|
| - switch (t) {
|
| - case WebCore::NavigationTypeLinkClicked:
|
| - return WebNavigationTypeLinkClicked;
|
| - case WebCore::NavigationTypeFormSubmitted:
|
| - return WebNavigationTypeFormSubmitted;
|
| - case WebCore::NavigationTypeBackForward:
|
| - return WebNavigationTypeBackForward;
|
| - case WebCore::NavigationTypeReload:
|
| - return WebNavigationTypeReload;
|
| - case WebCore::NavigationTypeFormResubmitted:
|
| - return WebNavigationTypeFormResubmitted;
|
| - default:
|
| - case WebCore::NavigationTypeOther:
|
| - return WebNavigationTypeOther;
|
| - }
|
| -}
|
| -
|
| void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(
|
| WebCore::FramePolicyFunction function,
|
| const WebCore::NavigationAction& action,
|
| @@ -985,7 +994,7 @@
|
| bool is_redirect = !ds->GetRedirectChain().empty();
|
|
|
| WebNavigationType webnav_type =
|
| - NavigationTypeToWebNavigationType(action.type());
|
| + WebDataSourceImpl::NavigationTypeToWebNavigationType(action.type());
|
|
|
| disposition = d->DispositionForNavigationAction(
|
| wv, webframe_, &ds->GetRequest(), webnav_type, disposition, is_redirect);
|
|
|