summaryrefslogtreecommitdiffstats
path: root/webkit/glue
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-16 19:50:56 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-16 19:50:56 +0000
commited3fb034eb4b7da69bbc4f3e3da47093dabc481e (patch)
treed08b2837ab8b05b98fef6990edd26a9d00465589 /webkit/glue
parent5eb55c2f42f70fe544a04d200cdd059377d310f7 (diff)
downloadchromium_src-ed3fb034eb4b7da69bbc4f3e3da47093dabc481e.zip
chromium_src-ed3fb034eb4b7da69bbc4f3e3da47093dabc481e.tar.gz
chromium_src-ed3fb034eb4b7da69bbc4f3e3da47093dabc481e.tar.bz2
Extract load times from WebDataSource. Move them to NavigationState.
Move PasswordForm into the webkit_glue namespace. TEST=none BUG=10041 R=brettw Review URL: http://codereview.chromium.org/126190 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18515 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r--webkit/glue/password_form.h4
-rw-r--r--webkit/glue/webdatasource.h28
-rw-r--r--webkit/glue/webdatasource_impl.cc31
-rw-r--r--webkit/glue/webdatasource_impl.h36
-rw-r--r--webkit/glue/webframeloaderclient_impl.cc30
-rw-r--r--webkit/glue/webview_delegate.h5
6 files changed, 22 insertions, 112 deletions
diff --git a/webkit/glue/password_form.h b/webkit/glue/password_form.h
index 2d88343..df41be8 100644
--- a/webkit/glue/password_form.h
+++ b/webkit/glue/password_form.h
@@ -11,6 +11,8 @@
#include "base/time.h"
#include "googleurl/src/gurl.h"
+namespace webkit_glue {
+
// The PasswordForm struct encapsulates information about a login form,
// which can be an HTML form or a dialog with username/password text fields.
//
@@ -143,4 +145,6 @@ struct PasswordForm {
// Map username to PasswordForm* for convenience. See password_form_manager.h.
typedef std::map<std::wstring, PasswordForm*> PasswordFormMap;
+} // namespace webkit_glue
+
#endif // WEBKIT_GLUE_PASSWORD_FORM_H__
diff --git a/webkit/glue/webdatasource.h b/webkit/glue/webdatasource.h
index 5885db7..4625508 100644
--- a/webkit/glue/webdatasource.h
+++ b/webkit/glue/webdatasource.h
@@ -18,8 +18,6 @@ namespace base {
class Time;
}
-struct PasswordForm;
-
enum WebNavigationType {
WebNavigationTypeLinkClicked,
WebNavigationTypeFormSubmitted,
@@ -84,29 +82,9 @@ class WebDataSource {
// Returns the page title.
virtual string16 GetPageTitle() const = 0;
- // Returns the time the document was request by the user.
- virtual base::Time GetRequestTime() const = 0;
-
- // Sets the request time. This is used to override the default behavior
- // if the client knows more about the origination of the request than the
- // underlying mechanism could.
- virtual void SetRequestTime(base::Time time) = 0;
-
- // Returns the time we started loading the page. This corresponds to
- // the DidStartProvisionalLoadForFrame delegate notification.
- virtual base::Time GetStartLoadTime() const = 0;
-
- // Returns the time the document itself was finished loading. This corresponds
- // to the DidFinishDocumentLoadForFrame delegate notification.
- virtual base::Time GetFinishDocumentLoadTime() const = 0;
-
- // Returns the time all dependent resources have been loaded and onload()
- // has been called. This corresponds to the DidFinishLoadForFrame delegate
- // notification.
- virtual base::Time GetFinishLoadTime() const = 0;
-
- // Returns the first time a layout was performed
- virtual base::Time GetFirstLayoutTime() const = 0;
+ // The time in seconds (since the epoch) of the event if any that triggered
+ // this navigation. Returns 0 if unknown.
+ virtual double GetTriggeringEventTime() const = 0;
// Returns the reason the document was loaded.
virtual WebNavigationType GetNavigationType() const = 0;
diff --git a/webkit/glue/webdatasource_impl.cc b/webkit/glue/webdatasource_impl.cc
index c0ace9b..01e174b 100644
--- a/webkit/glue/webdatasource_impl.cc
+++ b/webkit/glue/webdatasource_impl.cc
@@ -11,8 +11,6 @@
#include "ResourceRequest.h"
#undef LOG
-#include "base/histogram.h"
-#include "base/string_util.h"
#include "webkit/glue/glue_util.h"
#include "webkit/glue/password_form.h"
#include "webkit/glue/webdatasource_impl.h"
@@ -20,9 +18,6 @@
#include "webkit/glue/weburlrequest_impl.h"
#include "webkit/glue/webview_delegate.h"
-using base::TimeDelta;
-using base::Time;
-
// static
PassRefPtr<WebDataSourceImpl> WebDataSourceImpl::Create(
const WebCore::ResourceRequest& request,
@@ -82,28 +77,12 @@ string16 WebDataSourceImpl::GetPageTitle() const {
return webkit_glue::StringToString16(title());
}
-base::Time WebDataSourceImpl::GetRequestTime() const {
- return request_time_;
-}
-
-void WebDataSourceImpl::SetRequestTime(base::Time time) {
- request_time_ = time;
-}
-
-base::Time WebDataSourceImpl::GetStartLoadTime() const {
- return start_load_time_;
-}
-
-base::Time WebDataSourceImpl::GetFinishDocumentLoadTime() const {
- return finish_document_load_time_;
-}
-
-base::Time WebDataSourceImpl::GetFinishLoadTime() const {
- return finish_load_time_;
-}
+double WebDataSourceImpl::GetTriggeringEventTime() const {
+ if (!triggeringAction().event())
+ return 0.0;
-base::Time WebDataSourceImpl::GetFirstLayoutTime() const {
- return first_layout_time_;
+ // DOMTimeStamp uses units of milliseconds.
+ return triggeringAction().event()->timeStamp() / 1000.0;
}
WebNavigationType WebDataSourceImpl::GetNavigationType() const {
diff --git a/webkit/glue/webdatasource_impl.h b/webkit/glue/webdatasource_impl.h
index d2e98bf..deecf64 100644
--- a/webkit/glue/webdatasource_impl.h
+++ b/webkit/glue/webdatasource_impl.h
@@ -7,8 +7,6 @@
#include "DocumentLoader.h"
-#include "base/scoped_ptr.h"
-#include "base/time.h"
#include "webkit/glue/webdatasource.h"
#include "webkit/glue/webresponse_impl.h"
#include "webkit/glue/weburlrequest_impl.h"
@@ -33,12 +31,7 @@ class WebDataSourceImpl : public WebCore::DocumentLoader, public WebDataSource {
virtual bool HasUnreachableURL() const;
virtual const std::vector<GURL>& GetRedirectChain() const;
virtual string16 GetPageTitle() const;
- virtual base::Time GetRequestTime() const;
- virtual void SetRequestTime(base::Time time);
- virtual base::Time GetStartLoadTime() const;
- virtual base::Time GetFinishDocumentLoadTime() const;
- virtual base::Time GetFinishLoadTime() const;
- virtual base::Time GetFirstLayoutTime() const;
+ virtual double GetTriggeringEventTime() const;
virtual WebNavigationType GetNavigationType() const;
virtual ExtraData* GetExtraData() const;
virtual void SetExtraData(ExtraData*);
@@ -49,26 +42,6 @@ class WebDataSourceImpl : public WebCore::DocumentLoader, public WebDataSource {
void ClearRedirectChain();
void AppendRedirect(const GURL& url);
- void set_request_time(base::Time request_time) {
- request_time_ = request_time;
- }
-
- void set_start_load_time(base::Time start_load_time) {
- start_load_time_ = start_load_time;
- }
-
- void set_finish_document_load_time(base::Time finish_document_load_time) {
- finish_document_load_time_ = finish_document_load_time;
- }
-
- void set_finish_load_time(base::Time finish_load_time) {
- finish_load_time_ = finish_load_time;
- }
-
- void set_first_layout_time(base::Time first_layout_time) {
- first_layout_time_ = first_layout_time;
- }
-
private:
WebDataSourceImpl(const WebCore::ResourceRequest&,
const WebCore::SubstituteData&);
@@ -88,13 +61,6 @@ class WebDataSourceImpl : public WebCore::DocumentLoader, public WebDataSource {
OwnPtr<ExtraData> extra_data_;
- // See webdatasource.h for a description of these time stamps.
- base::Time request_time_;
- base::Time start_load_time_;
- base::Time finish_document_load_time_;
- base::Time finish_load_time_;
- base::Time first_layout_time_;
-
DISALLOW_COPY_AND_ASSIGN(WebDataSourceImpl);
};
diff --git a/webkit/glue/webframeloaderclient_impl.cc b/webkit/glue/webframeloaderclient_impl.cc
index a4a77a9..5a31352 100644
--- a/webkit/glue/webframeloaderclient_impl.cc
+++ b/webkit/glue/webframeloaderclient_impl.cc
@@ -379,7 +379,6 @@ void WebFrameLoaderClient::dispatchDidFinishDocumentLoad() {
if (d)
d->DidFinishDocumentLoadForFrame(webview, webframe_);
- data_source->set_finish_document_load_time(base::Time::Now());
}
bool WebFrameLoaderClient::dispatchDidLoadResourceFromMemoryCache(
@@ -683,21 +682,6 @@ void WebFrameLoaderClient::dispatchDidStartProvisionalLoad() {
// 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_);
@@ -767,7 +751,6 @@ void WebFrameLoaderClient::dispatchDidFinishLoad() {
WebDataSourceImpl::FromLoader(documentLoader);
WebViewImpl* webview = webframe_->GetWebViewImpl();
WebViewDelegate* d = webview->delegate();
- dataSource->set_finish_load_time(base::Time::Now());
if (d)
d->DidFinishLoadForFrame(webview, webframe_);
WebPluginDelegate* plg_delegate = webframe_->plugin_delegate();
@@ -780,15 +763,10 @@ void WebFrameLoaderClient::dispatchDidFinishLoad() {
}
void WebFrameLoaderClient::dispatchDidFirstLayout() {
- // FIXME: called when webkit finished layout of page.
- // All resources have not necessarily finished loading.
- DocumentLoader* document_loader =
- webframe_->frame()->loader()->documentLoader();
- WebDataSourceImpl* ds =
- WebDataSourceImpl::FromLoader(document_loader);
- if (ds->GetFirstLayoutTime().ToInternalValue() == 0) {
- ds->set_first_layout_time(base::Time::Now());
- }
+ WebViewImpl* webview = webframe_->GetWebViewImpl();
+ WebViewDelegate* d = webview->delegate();
+ if (d)
+ d->DidFirstLayout(webview, webframe_);
}
void WebFrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout() {
diff --git a/webkit/glue/webview_delegate.h b/webkit/glue/webview_delegate.h
index 7002c57..2736103 100644
--- a/webkit/glue/webview_delegate.h
+++ b/webkit/glue/webview_delegate.h
@@ -350,6 +350,11 @@ class WebViewDelegate : virtual public WebWidgetDelegate {
virtual void DidFinishDocumentLoadForFrame(WebView* webview, WebFrame* frame) {
}
+ // Called after layout runs for the first time after a new document is loaded
+ // into a frame. All resources have not necessarily finished loading.
+ virtual void DidFirstLayout(WebView* webview, WebFrame* frame) {
+ }
+
// This method is called when we load a resource from an in-memory cache.
// A return value of |false| indicates the load should proceed, but WebCore
// appears to largely ignore the return value.