| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef WEBKIT_GLUE_WEBDATASOURCE_IMPL_H_ | 5 #ifndef WEBKIT_GLUE_WEBDATASOURCE_IMPL_H_ |
| 6 #define WEBKIT_GLUE_WEBDATASOURCE_IMPL_H_ | 6 #define WEBKIT_GLUE_WEBDATASOURCE_IMPL_H_ |
| 7 | 7 |
| 8 #include "DocumentLoader.h" | 8 #include "DocumentLoader.h" |
| 9 | 9 |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| 11 #include "base/time.h" |
| 11 #include "webkit/glue/searchable_form_data.h" | 12 #include "webkit/glue/searchable_form_data.h" |
| 12 #include "webkit/glue/webdatasource.h" | 13 #include "webkit/glue/webdatasource.h" |
| 13 #include "webkit/glue/webresponse_impl.h" | 14 #include "webkit/glue/webresponse_impl.h" |
| 14 #include "webkit/glue/weburlrequest_impl.h" | 15 #include "webkit/glue/weburlrequest_impl.h" |
| 15 | 16 |
| 16 class WebFrameImpl; | 17 class WebFrameImpl; |
| 17 class WebDocumentLoaderImpl; | 18 class WebDocumentLoaderImpl; |
| 18 | 19 |
| 19 class WebDataSourceImpl : public WebCore::DocumentLoader, public WebDataSource { | 20 class WebDataSourceImpl : public WebCore::DocumentLoader, public WebDataSource { |
| 20 public: | 21 public: |
| 21 static PassRefPtr<WebDataSourceImpl> Create(const WebCore::ResourceRequest&, | 22 static PassRefPtr<WebDataSourceImpl> Create(const WebCore::ResourceRequest&, |
| 22 const WebCore::SubstituteData&); | 23 const WebCore::SubstituteData&); |
| 23 | 24 |
| 24 static WebDataSourceImpl* FromLoader(WebCore::DocumentLoader* loader) { | 25 static WebDataSourceImpl* FromLoader(WebCore::DocumentLoader* loader) { |
| 25 return static_cast<WebDataSourceImpl*>(loader); | 26 return static_cast<WebDataSourceImpl*>(loader); |
| 26 } | 27 } |
| 27 | 28 |
| 28 // WebDataSource methods: | 29 // WebDataSource methods: |
| 29 virtual WebFrame* GetWebFrame(); | 30 virtual WebFrame* GetWebFrame(); |
| 30 virtual const WebRequest& GetInitialRequest() const; | 31 virtual const WebRequest& GetInitialRequest() const; |
| 31 virtual const WebRequest& GetRequest() const; | 32 virtual const WebRequest& GetRequest() const; |
| 32 virtual const WebResponse& GetResponse() const; | 33 virtual const WebResponse& GetResponse() const; |
| 33 virtual GURL GetUnreachableURL() const; | 34 virtual GURL GetUnreachableURL() const; |
| 34 virtual bool HasUnreachableURL() const; | 35 virtual bool HasUnreachableURL() const; |
| 35 virtual const std::vector<GURL>& GetRedirectChain() const; | 36 virtual const std::vector<GURL>& GetRedirectChain() const; |
| 36 virtual const SearchableFormData* GetSearchableFormData() const; | 37 virtual const SearchableFormData* GetSearchableFormData() const; |
| 37 virtual const PasswordForm* GetPasswordFormData() const; | 38 virtual const PasswordForm* GetPasswordFormData() const; |
| 38 virtual bool IsFormSubmit() const; | 39 virtual bool IsFormSubmit() const; |
| 39 virtual string16 GetPageTitle() const; | 40 virtual string16 GetPageTitle() const; |
| 41 virtual base::Time GetRequestTime() const; |
| 42 virtual void SetRequestTime(base::Time time); |
| 43 virtual base::Time GetStartLoadTime() const; |
| 44 virtual base::Time GetFinishDocumentLoadTime() const; |
| 45 virtual base::Time GetFinishLoadTime() const; |
| 46 virtual WebNavigationType GetNavigationType() const; |
| 47 |
| 48 static WebNavigationType NavigationTypeToWebNavigationType( |
| 49 WebCore::NavigationType type); |
| 40 | 50 |
| 41 // Called after creating a new data source if there is request info | 51 // Called after creating a new data source if there is request info |
| 42 // available. Since we store copies of the WebRequests, the original | 52 // available. Since we store copies of the WebRequests, the original |
| 43 // WebRequest that the embedder created was lost, and the exra data would | 53 // WebRequest that the embedder created was lost, and the exra data would |
| 44 // go with it. This preserves the request info so retrieving the requests | 54 // go with it. This preserves the request info so retrieving the requests |
| 45 // later will have the same data. | 55 // later will have the same data. |
| 46 void SetExtraData(WebRequest::ExtraData* extra); | 56 void SetExtraData(WebRequest::ExtraData* extra); |
| 47 | 57 |
| 48 void ClearRedirectChain(); | 58 void ClearRedirectChain(); |
| 49 void AppendRedirect(const GURL& url); | 59 void AppendRedirect(const GURL& url); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 70 return password_form_data_.get(); | 80 return password_form_data_.get(); |
| 71 } | 81 } |
| 72 | 82 |
| 73 void set_form_submit(bool value) { | 83 void set_form_submit(bool value) { |
| 74 form_submit_ = value; | 84 form_submit_ = value; |
| 75 } | 85 } |
| 76 bool is_form_submit() const { | 86 bool is_form_submit() const { |
| 77 return form_submit_; | 87 return form_submit_; |
| 78 } | 88 } |
| 79 | 89 |
| 90 void set_request_time(base::Time request_time) { |
| 91 request_time_ = request_time; |
| 92 } |
| 93 |
| 94 void set_start_load_time(base::Time start_load_time) { |
| 95 start_load_time_ = start_load_time; |
| 96 } |
| 97 |
| 98 void set_finish_document_load_time(base::Time finish_document_load_time) { |
| 99 finish_document_load_time_ = finish_document_load_time; |
| 100 } |
| 101 |
| 102 void set_finish_load_time(base::Time finish_load_time) { |
| 103 finish_load_time_ = finish_load_time; |
| 104 } |
| 105 |
| 80 private: | 106 private: |
| 81 WebDataSourceImpl(const WebCore::ResourceRequest&, | 107 WebDataSourceImpl(const WebCore::ResourceRequest&, |
| 82 const WebCore::SubstituteData&); | 108 const WebCore::SubstituteData&); |
| 83 ~WebDataSourceImpl(); | 109 ~WebDataSourceImpl(); |
| 84 | 110 |
| 85 // Mutable because the const getters will magically sync these to the | 111 // Mutable because the const getters will magically sync these to the |
| 86 // latest version from WebKit. | 112 // latest version from WebKit. |
| 87 mutable WebRequestImpl initial_request_; | 113 mutable WebRequestImpl initial_request_; |
| 88 mutable WebRequestImpl request_; | 114 mutable WebRequestImpl request_; |
| 89 mutable WebResponseImpl response_; | 115 mutable WebResponseImpl response_; |
| 90 | 116 |
| 91 // Lists all intermediate URLs that have redirected for the current | 117 // Lists all intermediate URLs that have redirected for the current |
| 92 // provisional load. See WebFrameLoaderClient:: | 118 // provisional load. See WebFrameLoaderClient:: |
| 93 // dispatchDidReceiveServerRedirectForProvisionalLoad for a description of | 119 // dispatchDidReceiveServerRedirectForProvisionalLoad for a description of |
| 94 // who modifies this when to keep it up to date. | 120 // who modifies this when to keep it up to date. |
| 95 std::vector<GURL> redirect_chain_; | 121 std::vector<GURL> redirect_chain_; |
| 96 | 122 |
| 97 scoped_ptr<const SearchableFormData> searchable_form_data_; | 123 scoped_ptr<const SearchableFormData> searchable_form_data_; |
| 98 scoped_ptr<const PasswordForm> password_form_data_; | 124 scoped_ptr<const PasswordForm> password_form_data_; |
| 99 | 125 |
| 100 bool form_submit_; | 126 bool form_submit_; |
| 101 | 127 |
| 128 // See webdatasource.h for a description of these time stamps. |
| 129 base::Time request_time_; |
| 130 base::Time start_load_time_; |
| 131 base::Time finish_document_load_time_; |
| 132 base::Time finish_load_time_; |
| 133 |
| 102 DISALLOW_COPY_AND_ASSIGN(WebDataSourceImpl); | 134 DISALLOW_COPY_AND_ASSIGN(WebDataSourceImpl); |
| 103 }; | 135 }; |
| 104 | 136 |
| 105 #endif // WEBKIT_GLUE_WEBDATASOURCE_IMPL_H_ | 137 #endif // WEBKIT_GLUE_WEBDATASOURCE_IMPL_H_ |
| OLD | NEW |