blob: 4585a657a45b76b11b7b71c78d005a4844c4d490 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef WEBKIT_GLUE_WEBDATASOURCE_IMPL_H_
#define WEBKIT_GLUE_WEBDATASOURCE_IMPL_H_
#include "DocumentLoader.h"
#include "base/scoped_ptr.h"
#include "webkit/glue/searchable_form_data.h"
#include "webkit/glue/webdatasource.h"
#include "webkit/glue/webresponse_impl.h"
#include "webkit/glue/weburlrequest_impl.h"
class WebFrameImpl;
class WebDocumentLoaderImpl;
class WebDataSourceImpl : public WebCore::DocumentLoader, public WebDataSource {
public:
static PassRefPtr<WebDataSourceImpl> Create(const WebCore::ResourceRequest&,
const WebCore::SubstituteData&);
static WebDataSourceImpl* FromLoader(WebCore::DocumentLoader* loader) {
return static_cast<WebDataSourceImpl*>(loader);
}
// WebDataSource methods:
virtual WebFrame* GetWebFrame();
virtual const WebRequest& GetInitialRequest() const;
virtual const WebRequest& GetRequest() const;
virtual const WebResponse& GetResponse() const;
virtual GURL GetUnreachableURL() const;
virtual bool HasUnreachableURL() const;
virtual const std::vector<GURL>& GetRedirectChain() const;
virtual const SearchableFormData* GetSearchableFormData() const;
virtual const PasswordForm* GetPasswordFormData() const;
virtual bool IsFormSubmit() const;
virtual string16 GetPageTitle() const;
// Called after creating a new data source if there is request info
// available. Since we store copies of the WebRequests, the original
// WebRequest that the embedder created was lost, and the exra data would
// go with it. This preserves the request info so retrieving the requests
// later will have the same data.
void SetExtraData(WebRequest::ExtraData* extra);
void ClearRedirectChain();
void AppendRedirect(const GURL& url);
// Sets the SearchableFormData for this DocumentLoader.
// WebDocumentLoaderImpl will own the SearchableFormData.
void set_searchable_form_data(SearchableFormData* searchable_form_data) {
searchable_form_data_.reset(searchable_form_data);
}
// Returns the SearchableFormData for this DocumentLoader.
// WebDocumentLoaderImpl owns the returned SearchableFormData.
const SearchableFormData* searchable_form_data() const {
return searchable_form_data_.get();
}
// Sets the PasswordFormData for this DocumentLoader.
// WebDocumentLoaderImpl will own the PasswordFormData.
void set_password_form_data(PasswordForm* password_form_data) {
password_form_data_.reset(password_form_data);
}
// Returns the PasswordFormData for this DocumentLoader.
// WebDocumentLoaderImpl owns the returned PasswordFormData.
const PasswordForm* password_form_data() const {
return password_form_data_.get();
}
void set_form_submit(bool value) {
form_submit_ = value;
}
bool is_form_submit() const {
return form_submit_;
}
private:
WebDataSourceImpl(const WebCore::ResourceRequest&,
const WebCore::SubstituteData&);
~WebDataSourceImpl();
// Mutable because the const getters will magically sync these to the
// latest version from WebKit.
mutable WebRequestImpl initial_request_;
mutable WebRequestImpl request_;
mutable WebResponseImpl response_;
// Lists all intermediate URLs that have redirected for the current
// provisional load. See WebFrameLoaderClient::
// dispatchDidReceiveServerRedirectForProvisionalLoad for a description of
// who modifies this when to keep it up to date.
std::vector<GURL> redirect_chain_;
scoped_ptr<const SearchableFormData> searchable_form_data_;
scoped_ptr<const PasswordForm> password_form_data_;
bool form_submit_;
DISALLOW_COPY_AND_ASSIGN(WebDataSourceImpl);
};
#endif // WEBKIT_GLUE_WEBDATASOURCE_IMPL_H_
|