Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: webkit/glue/webframeloaderclient_impl.cc

Issue 160578: Move alternate 404 error page loading out of WebFrame and into RenderView.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "config.h" 5 #include "config.h"
6
6 #include <string> 7 #include <string>
7 #include <vector> 8 #include <vector>
8 9
9 #include "base/compiler_specific.h"
10
11 MSVC_PUSH_WARNING_LEVEL(0);
12 #include "Chrome.h" 10 #include "Chrome.h"
13 #include "CString.h" 11 #include "CString.h"
14 #include "Document.h" 12 #include "Document.h"
15 #include "DocumentLoader.h" 13 #include "DocumentLoader.h"
16 #include "HistoryItem.h"
17 #include "HTMLAppletElement.h" 14 #include "HTMLAppletElement.h"
18 #include "HTMLCollection.h"
19 #include "HTMLFormElement.h" // needed by FormState.h 15 #include "HTMLFormElement.h" // needed by FormState.h
20 #include "HTMLFormControlElement.h"
21 #include "HTMLInputElement.h"
22 #include "HTMLNames.h" 16 #include "HTMLNames.h"
23 #include "FormState.h" 17 #include "FormState.h"
24 #include "FrameLoader.h" 18 #include "FrameLoader.h"
25 #include "FrameLoadRequest.h" 19 #include "FrameLoadRequest.h"
26 #include "FrameView.h"
27 #include "MIMETypeRegistry.h" 20 #include "MIMETypeRegistry.h"
28 #include "MouseEvent.h" 21 #include "MouseEvent.h"
29 #include "Page.h" 22 #include "Page.h"
30 #include "PlatformString.h" 23 #include "PlatformString.h"
31 #include "PluginData.h" 24 #include "PluginData.h"
32 #include "RefPtr.h"
33 #include "StringExtras.h" 25 #include "StringExtras.h"
34 #include "WindowFeatures.h" 26 #include "WindowFeatures.h"
35 MSVC_POP_WARNING(); 27 #undef LOG
36 28
37 #undef LOG
38 #include "base/basictypes.h" 29 #include "base/basictypes.h"
39 #include "base/command_line.h"
40 #include "base/logging.h" 30 #include "base/logging.h"
41 #include "base/string_util.h" 31 #include "base/string_util.h"
42 #include "net/base/mime_util.h" 32 #include "net/base/mime_util.h"
43 #include "net/base/net_errors.h" 33 #include "net/base/net_errors.h"
44 #if defined(OS_WIN) 34 #if defined(OS_WIN)
45 #include "webkit/activex_shim/activex_shared.h" 35 #include "webkit/activex_shim/activex_shared.h"
46 #endif 36 #endif
47 #include "webkit/api/public/WebForm.h" 37 #include "webkit/api/public/WebForm.h"
48 #include "webkit/api/public/WebURL.h" 38 #include "webkit/api/public/WebURL.h"
49 #include "webkit/api/public/WebURLError.h" 39 #include "webkit/api/public/WebURLError.h"
50 #include "webkit/api/public/WebVector.h" 40 #include "webkit/api/public/WebVector.h"
51 #include "webkit/api/src/WrappedResourceRequest.h" 41 #include "webkit/api/src/WrappedResourceRequest.h"
52 #include "webkit/api/src/WrappedResourceResponse.h" 42 #include "webkit/api/src/WrappedResourceResponse.h"
53 #include "webkit/glue/autofill_form.h"
54 #include "webkit/glue/alt_error_page_resource_fetcher.h"
55 #include "webkit/glue/glue_util.h" 43 #include "webkit/glue/glue_util.h"
56 #include "webkit/glue/password_form_dom_manager.h"
57 #include "webkit/glue/plugins/plugin_list.h" 44 #include "webkit/glue/plugins/plugin_list.h"
58 #include "webkit/glue/searchable_form_data.h"
59 #include "webkit/glue/webdatasource_impl.h" 45 #include "webkit/glue/webdatasource_impl.h"
60 #include "webkit/glue/webdevtoolsagent_impl.h" 46 #include "webkit/glue/webdevtoolsagent_impl.h"
61 #include "webkit/glue/webframeloaderclient_impl.h" 47 #include "webkit/glue/webframeloaderclient_impl.h"
62 #include "webkit/glue/webkit_glue.h" 48 #include "webkit/glue/webkit_glue.h"
63 #include "webkit/glue/webplugin_delegate.h" 49 #include "webkit/glue/webplugin_delegate.h"
64 #include "webkit/glue/webplugin_impl.h" 50 #include "webkit/glue/webplugin_impl.h"
65 #include "webkit/glue/webview_delegate.h" 51 #include "webkit/glue/webview_delegate.h"
66 #include "webkit/glue/webview_impl.h" 52 #include "webkit/glue/webview_impl.h"
67 53
68 using namespace WebCore; 54 using namespace WebCore;
69 55
70 using base::Time; 56 using base::Time;
71 using base::TimeDelta; 57 using base::TimeDelta;
72 58
73 using WebKit::WebData; 59 using WebKit::WebData;
74 using WebKit::WebNavigationType; 60 using WebKit::WebNavigationType;
75 using WebKit::WebNavigationPolicy; 61 using WebKit::WebNavigationPolicy;
76 using WebKit::WebString; 62 using WebKit::WebString;
77 using WebKit::WebURL; 63 using WebKit::WebURL;
78 using WebKit::WebURLError; 64 using WebKit::WebURLError;
79 using WebKit::WebURLRequest; 65 using WebKit::WebURLRequest;
80 using WebKit::WebVector; 66 using WebKit::WebVector;
81 using WebKit::WrappedResourceRequest; 67 using WebKit::WrappedResourceRequest;
82 using WebKit::WrappedResourceResponse; 68 using WebKit::WrappedResourceResponse;
83 69
84 using webkit_glue::AltErrorPageResourceFetcher;
85
86 // Domain for internal error codes. 70 // Domain for internal error codes.
87 static const char kInternalErrorDomain[] = "webkit_glue"; 71 static const char kInternalErrorDomain[] = "webkit_glue";
88 72
89 // An internal error code. Used to note a policy change error resulting from 73 // An internal error code. Used to note a policy change error resulting from
90 // dispatchDecidePolicyForMIMEType not passing the PolicyUse option. 74 // dispatchDecidePolicyForMIMEType not passing the PolicyUse option.
91 enum { 75 enum {
92 ERR_POLICY_CHANGE = -10000, 76 ERR_POLICY_CHANGE = -10000,
93 }; 77 };
94 78
95 WebFrameLoaderClient::WebFrameLoaderClient(WebFrameImpl* frame) : 79 WebFrameLoaderClient::WebFrameLoaderClient(WebFrameImpl* frame)
96 webframe_(frame), 80 : webframe_(frame),
97 postpone_loading_data_(false), 81 has_representation_(false),
98 has_representation_(false), 82 sent_initial_response_to_plugin_(false),
99 sent_initial_response_to_plugin_(false), 83 next_navigation_policy_(WebKit::WebNavigationPolicyIgnore) {
100 next_navigation_policy_(WebKit::WebNavigationPolicyIgnore) {
101 } 84 }
102 85
103 WebFrameLoaderClient::~WebFrameLoaderClient() { 86 WebFrameLoaderClient::~WebFrameLoaderClient() {
104 } 87 }
105 88
106 void WebFrameLoaderClient::frameLoaderDestroyed() { 89 void WebFrameLoaderClient::frameLoaderDestroyed() {
107 // When the WebFrame was created, it had an extra reference given to it on 90 // When the WebFrame was created, it had an extra reference given to it on
108 // behalf of the Frame. Since the WebFrame owns us, this extra ref also 91 // behalf of the Frame. Since the WebFrame owns us, this extra ref also
109 // serves to keep us alive until the FrameLoader is done with us. The 92 // serves to keep us alive until the FrameLoader is done with us. The
110 // FrameLoader calls this method when it's going away. Therefore, we balance 93 // FrameLoader calls this method when it's going away. Therefore, we balance
111 // out that extra reference, which may cause 'this' to be deleted. 94 // out that extra reference, which may cause 'this' to be deleted.
112 webframe_->Closing(); 95 webframe_->Closing();
113 webframe_->Release(); 96 webframe_->Release();
114 } 97 }
115 98
116 void WebFrameLoaderClient::windowObjectCleared() { 99 void WebFrameLoaderClient::windowObjectCleared() {
117 WebViewImpl* webview = webframe_->GetWebViewImpl(); 100 WebViewImpl* webview = webframe_->GetWebViewImpl();
118 WebViewDelegate* d = webview->delegate(); 101 WebViewDelegate* d = webview->delegate();
119 if (d) 102 if (d)
120 d->WindowObjectCleared(webframe_); 103 d->WindowObjectCleared(webframe_);
121 104
122 WebDevToolsAgentImpl* tools_agent = webview->GetWebDevToolsAgentImpl(); 105 WebDevToolsAgentImpl* tools_agent = webview->GetWebDevToolsAgentImpl();
123 if (tools_agent) { 106 if (tools_agent)
124 tools_agent->WindowObjectCleared(webframe_); 107 tools_agent->WindowObjectCleared(webframe_);
125 }
126 } 108 }
127 109
128 void WebFrameLoaderClient::documentElementAvailable() { 110 void WebFrameLoaderClient::documentElementAvailable() {
129 WebViewImpl* webview = webframe_->GetWebViewImpl(); 111 WebViewImpl* webview = webframe_->GetWebViewImpl();
130 WebViewDelegate* d = webview->delegate(); 112 WebViewDelegate* d = webview->delegate();
131 if (d) 113 if (d)
132 d->DocumentElementAvailable(webframe_); 114 d->DocumentElementAvailable(webframe_);
133 } 115 }
134 116
135 void WebFrameLoaderClient::didCreateScriptContextForFrame() { 117 void WebFrameLoaderClient::didCreateScriptContextForFrame() {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 webframe_->frame()->script()->proxy()->clearForClose(); 185 webframe_->frame()->script()->proxy()->clearForClose();
204 } 186 }
205 187
206 // This function is responsible for associating the |identifier| with a given 188 // This function is responsible for associating the |identifier| with a given
207 // subresource load. The following functions that accept an |identifier| are 189 // subresource load. The following functions that accept an |identifier| are
208 // called for each subresource, so they should not be dispatched to the 190 // called for each subresource, so they should not be dispatched to the
209 // WebFrame. 191 // WebFrame.
210 void WebFrameLoaderClient::assignIdentifierToInitialRequest( 192 void WebFrameLoaderClient::assignIdentifierToInitialRequest(
211 unsigned long identifier, DocumentLoader* loader, 193 unsigned long identifier, DocumentLoader* loader,
212 const ResourceRequest& request) { 194 const ResourceRequest& request) {
213 WebViewImpl* webview = webframe_->GetWebViewImpl(); 195 WebViewDelegate* d = webframe_->GetWebViewImpl()->delegate();
214 WebViewDelegate* d = webview->delegate();
215 if (d) { 196 if (d) {
216 WrappedResourceRequest webreq(request); 197 WrappedResourceRequest webreq(request);
217 d->AssignIdentifierToRequest(webview, identifier, webreq); 198 d->AssignIdentifierToRequest(webframe_, identifier, webreq);
218 } 199 }
219 } 200 }
220 201
221 // Determines whether the request being loaded by |loader| is a frame or a 202 // Determines whether the request being loaded by |loader| is a frame or a
222 // subresource. A subresource in this context is anything other than a frame -- 203 // subresource. A subresource in this context is anything other than a frame --
223 // this includes images and xmlhttp requests. It is important to note that a 204 // this includes images and xmlhttp requests. It is important to note that a
224 // subresource is NOT limited to stuff loaded through the frame's subresource 205 // subresource is NOT limited to stuff loaded through the frame's subresource
225 // loader. Synchronous xmlhttp requests for example, do not go through the 206 // loader. Synchronous xmlhttp requests for example, do not go through the
226 // subresource loader, but we still label them as TargetIsSubResource. 207 // subresource loader, but we still label them as TargetIsSubResource.
227 // 208 //
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 } 241 }
261 242
262 // FrameLoader::loadEmptyDocumentSynchronously() creates an empty document 243 // FrameLoader::loadEmptyDocumentSynchronously() creates an empty document
263 // with no URL. We don't like that, so we'll rename it to about:blank. 244 // with no URL. We don't like that, so we'll rename it to about:blank.
264 if (request.url().isEmpty()) 245 if (request.url().isEmpty())
265 request.setURL(KURL("about:blank")); 246 request.setURL(KURL("about:blank"));
266 if (request.firstPartyForCookies().isEmpty()) 247 if (request.firstPartyForCookies().isEmpty())
267 request.setFirstPartyForCookies(KURL("about:blank")); 248 request.setFirstPartyForCookies(KURL("about:blank"));
268 249
269 // Give the delegate a crack at the request. 250 // Give the delegate a crack at the request.
270 WebViewImpl* webview = webframe_->GetWebViewImpl(); 251 WebViewDelegate* d = webframe_->GetWebViewImpl()->delegate();
271 WebViewDelegate* d = webview->delegate();
272 if (d) { 252 if (d) {
273 WrappedResourceRequest webreq(request); 253 WrappedResourceRequest webreq(request);
274 d->WillSendRequest(webview, identifier, &webreq); 254 d->WillSendRequest(webframe_, identifier, &webreq);
275 } 255 }
276 } 256 }
277 257
278 bool WebFrameLoaderClient::shouldUseCredentialStorage(DocumentLoader*, 258 bool WebFrameLoaderClient::shouldUseCredentialStorage(DocumentLoader*,
279 unsigned long identifier) { 259 unsigned long identifier) {
280 // FIXME 260 // FIXME
281 // Intended to pass through to a method on the resource load delegate. 261 // Intended to pass through to a method on the resource load delegate.
282 // If implemented, that method controls whether the browser should ask the 262 // If implemented, that method controls whether the browser should ask the
283 // networking layer for a stored default credential for the page (say from 263 // networking layer for a stored default credential for the page (say from
284 // the Mac OS keychain). If the method returns false, the user should be 264 // the Mac OS keychain). If the method returns false, the user should be
(...skipping 11 matching lines...) Expand all
296 } 276 }
297 277
298 void WebFrameLoaderClient::dispatchDidCancelAuthenticationChallenge( 278 void WebFrameLoaderClient::dispatchDidCancelAuthenticationChallenge(
299 DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&) { 279 DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&) {
300 // FIXME 280 // FIXME
301 } 281 }
302 282
303 void WebFrameLoaderClient::dispatchDidReceiveResponse(DocumentLoader* loader, 283 void WebFrameLoaderClient::dispatchDidReceiveResponse(DocumentLoader* loader,
304 unsigned long identifier, 284 unsigned long identifier,
305 const ResourceResponse& re sponse) { 285 const ResourceResponse& re sponse) {
306 286 WebViewDelegate* d = webframe_->GetWebViewImpl()->delegate();
307 287 if (d) {
308 /* TODO(evanm): reenable this once we properly sniff XHTML from text/xml docum ents. 288 WrappedResourceResponse webresp(response);
309 // True if the request was for the page's main frame, or a subframe. 289 d->DidReceiveResponse(webframe_, identifier, webresp);
310 bool is_frame = ResourceType::IsFrame(DetermineTargetTypeFromLoader(loader)); 290 }
311 if (is_frame &&
312 response.httpStatusCode() == 200 &&
313 mime_util::IsViewSourceMimeType(
314 webkit_glue::CStringToStdString(response.mimeType().latin1()).c_str()) ) {
315 loader->frame()->setInViewSourceMode();
316 }*/
317
318 // When the frame request first 404's, chrome may replace it with the alternat e
319 // 404 page's contents. It does this using substitute data in the document
320 // loader, so the original response and url of the request can be preserved.
321 // We need to avoid replacing the current page, if it has already been
322 // replaced (otherwise could loop on setting alt-404 page!)
323 bool is_substitute_data = loader->substituteData().isValid();
324
325 // If it's a 404 page, we wait until we get 512 bytes of data before trying
326 // to load the document. This allows us to put up an alternate 404 page if
327 // there's short text.
328 ResourceRequest::TargetType target_type =
329 DetermineTargetTypeFromLoader(loader);
330 postpone_loading_data_ =
331 ResourceRequest::TargetIsMainFrame == target_type &&
332 !is_substitute_data &&
333 response.httpStatusCode() == 404 &&
334 GetAlt404PageUrl(loader).is_valid();
335 if (postpone_loading_data_)
336 postponed_data_.clear();
337
338 // Cancel any pending loads.
339 alt_404_page_fetcher_.reset(NULL);
340 } 291 }
341 292
342 void WebFrameLoaderClient::dispatchDidReceiveContentLength( 293 void WebFrameLoaderClient::dispatchDidReceiveContentLength(
343 DocumentLoader* loader, 294 DocumentLoader* loader,
344 unsigned long identifier, 295 unsigned long identifier,
345 int length_received) { 296 int length_received) {
346 } 297 }
347 298
348 // Called when a particular resource load completes 299 // Called when a particular resource load completes
349 void WebFrameLoaderClient::dispatchDidFinishLoading(DocumentLoader* loader, 300 void WebFrameLoaderClient::dispatchDidFinishLoading(DocumentLoader* loader,
350 unsigned long identifier) { 301 unsigned long identifier) {
351 if (postpone_loading_data_) { 302 WebViewDelegate* d = webframe_->GetWebViewImpl()->delegate();
352 // The server returned a 404 and the content was < 512 bytes (which we
353 // suppressed). Go ahead and fetch the alternate page content.
354 const GURL& url = GetAlt404PageUrl(loader);
355 DCHECK(url.is_valid()) <<
356 "URL changed? It was valid in dispatchDidReceiveResponse.";
357 WebURLError original_error;
358 original_error.unreachableURL = webkit_glue::KURLToWebURL(loader->url());
359 alt_404_page_fetcher_.reset(new AltErrorPageResourceFetcher(
360 url, webframe_, original_error,
361 NewCallback(this, &WebFrameLoaderClient::Alt404PageFinished)));
362 }
363
364 WebViewImpl* webview = webframe_->GetWebViewImpl();
365 WebViewDelegate* d = webview->delegate();
366 if (d) 303 if (d)
367 d->DidFinishLoading(webview, identifier); 304 d->DidFinishLoading(webframe_, identifier);
368 }
369
370 GURL WebFrameLoaderClient::GetAlt404PageUrl(DocumentLoader* loader) {
371 WebViewImpl* webview = webframe_->GetWebViewImpl();
372 WebViewDelegate* d = webview->delegate();
373 if (!d)
374 return GURL();
375
376 const GURL& failedURL = webkit_glue::KURLToGURL(loader->url());
377
378 // If trying to view source on a 404 page, just show the original page
379 // content.
380 if (webframe_->frame()->inViewSourceMode())
381 return GURL();
382
383 // Construct the URL to fetch from the alt error page server. "html404"
384 // is understood by the link doctor server.
385 return d->GetAlternateErrorPageURL(failedURL, WebViewDelegate::HTTP_404);
386 }
387
388 void WebFrameLoaderClient::Alt404PageFinished(WebFrame* frame,
389 const WebURLError& original_error,
390 const std::string& html) {
391 // TODO(darin): Move this processing out to the embedder.
392 if (!html.empty()) {
393 // TODO(tc): Handle backoff on so we don't hammer the alt error page
394 // servers.
395 WebViewDelegate* d = webframe_->GetWebViewImpl()->delegate();
396 if (!d)
397 return;
398 d->LoadNavigationErrorPage(webframe_, WebURLRequest(), original_error, html,
399 true);
400 } else {
401 // Fall back on original text
402 webframe_->LoadHTMLString(postponed_data_, original_error.unreachableURL);
403 }
404 } 305 }
405 306
406 void WebFrameLoaderClient::dispatchDidFailLoading(DocumentLoader* loader, 307 void WebFrameLoaderClient::dispatchDidFailLoading(DocumentLoader* loader,
407 unsigned long identifier, 308 unsigned long identifier,
408 const ResourceError& error) { 309 const ResourceError& error) {
409 WebViewImpl* webview = webframe_->GetWebViewImpl(); 310 WebViewImpl* webview = webframe_->GetWebViewImpl();
410 if (webview && webview->delegate()) { 311 if (webview && webview->delegate()) {
411 webview->delegate()->DidFailLoadingWithError( 312 webview->delegate()->DidFailLoadingWithError(
412 webview, identifier, webkit_glue::ResourceErrorToWebURLError(error)); 313 webframe_, identifier, webkit_glue::ResourceErrorToWebURLError(error));
413 } 314 }
414 } 315 }
415 316
416 void WebFrameLoaderClient::dispatchDidFinishDocumentLoad() { 317 void WebFrameLoaderClient::dispatchDidFinishDocumentLoad() {
417 WebViewImpl* webview = webframe_->GetWebViewImpl(); 318 WebViewImpl* webview = webframe_->GetWebViewImpl();
418 WebViewDelegate* d = webview->delegate(); 319 WebViewDelegate* d = webview->delegate();
419 DocumentLoader* documentLoader = 320 DocumentLoader* documentLoader =
420 webframe_->frame()->loader()->activeDocumentLoader(); 321 webframe_->frame()->loader()->activeDocumentLoader();
421 WebDataSourceImpl* data_source = 322 WebDataSourceImpl* data_source =
422 WebDataSourceImpl::FromLoader(documentLoader); 323 WebDataSourceImpl::FromLoader(documentLoader);
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 // points out, whatever information its invocation contains should only 624 // points out, whatever information its invocation contains should only
724 // be considered relevant until the next provisional load has started. 625 // be considered relevant until the next provisional load has started.
725 // So we first tell the delegate that the load started, and then tell it 626 // So we first tell the delegate that the load started, and then tell it
726 // about the client redirect the load is responsible for completing. 627 // about the client redirect the load is responsible for completing.
727 d->DidStartProvisionalLoadForFrame(webview, webframe_, 628 d->DidStartProvisionalLoadForFrame(webview, webframe_,
728 NavigationGestureForLastLoad()); 629 NavigationGestureForLastLoad());
729 if (completing_client_redirect) 630 if (completing_client_redirect)
730 d->DidCompleteClientRedirect(webview, webframe_, 631 d->DidCompleteClientRedirect(webview, webframe_,
731 expected_client_redirect_src_); 632 expected_client_redirect_src_);
732 } 633 }
733
734 // Cancel any pending loads.
735 if (alt_404_page_fetcher_.get())
736 alt_404_page_fetcher_->Cancel();
737 } 634 }
738 635
739 void WebFrameLoaderClient::dispatchDidReceiveTitle(const String& title) { 636 void WebFrameLoaderClient::dispatchDidReceiveTitle(const String& title) {
740 WebViewImpl* webview = webframe_->GetWebViewImpl(); 637 WebViewImpl* webview = webframe_->GetWebViewImpl();
741 WebViewDelegate* d = webview->delegate(); 638 WebViewDelegate* d = webview->delegate();
742 if (d) { 639 if (d) {
743 d->DidReceiveTitle(webview, webkit_glue::StringToStdWString(title), 640 d->DidReceiveTitle(webview, webkit_glue::StringToStdWString(title),
744 webframe_); 641 webframe_);
745 } 642 }
746 } 643 }
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 if (d) { 962 if (d) {
1066 const GURL url(webkit_glue::KURLToGURL(request.url())); 963 const GURL url(webkit_glue::KURLToGURL(request.url()));
1067 const GURL referrer(webkit_glue::StringToStdString(request.httpReferrer())); 964 const GURL referrer(webkit_glue::StringToStdString(request.httpReferrer()));
1068 d->DownloadUrl(url, referrer); 965 d->DownloadUrl(url, referrer);
1069 } 966 }
1070 } 967 }
1071 968
1072 void WebFrameLoaderClient::willChangeTitle(DocumentLoader*) { 969 void WebFrameLoaderClient::willChangeTitle(DocumentLoader*) {
1073 // FIXME 970 // FIXME
1074 } 971 }
972
1075 void WebFrameLoaderClient::didChangeTitle(DocumentLoader*) { 973 void WebFrameLoaderClient::didChangeTitle(DocumentLoader*) {
1076 // FIXME 974 // FIXME
1077 } 975 }
1078 976
1079 // Called whenever data is received. 977 // Called whenever data is received.
1080 void WebFrameLoaderClient::committedLoad(DocumentLoader* loader, const char* dat a, int length) { 978 void WebFrameLoaderClient::committedLoad(DocumentLoader* loader, const char* dat a, int length) {
1081 if (!plugin_widget_.get()) { 979 if (!plugin_widget_.get()) {
1082 if (postpone_loading_data_) { 980 WebViewDelegate* d = webframe_->GetWebViewImpl()->delegate();
1083 postponed_data_.append(data, length); 981 if (d)
1084 if (postponed_data_.length() >= 512) { 982 d->DidReceiveDocumentData(webframe_, data, length);
1085 postpone_loading_data_ = false;
1086 webframe_->DidReceiveData(loader, postponed_data_.c_str(),
1087 static_cast<int>(postponed_data_.length()));
1088 }
1089 return;
1090 }
1091 webframe_->DidReceiveData(loader, data, length);
1092 } 983 }
1093 984
1094 // The plugin widget could have been created in the webframe_->DidReceiveData 985 // The plugin widget could have been created in the webframe_->DidReceiveData
1095 // function. 986 // function.
1096 if (plugin_widget_.get()) { 987 if (plugin_widget_.get()) {
1097 if (!sent_initial_response_to_plugin_) { 988 if (!sent_initial_response_to_plugin_) {
1098 sent_initial_response_to_plugin_ = true; 989 sent_initial_response_to_plugin_ = true;
1099 plugin_widget_->didReceiveResponse( 990 plugin_widget_->didReceiveResponse(
1100 webframe_->frame()->loader()->activeDocumentLoader()->response()); 991 webframe_->frame()->loader()->activeDocumentLoader()->response());
1101 } 992 }
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
1537 1428
1538 std::string offset_str = url.ExtractFileName(); 1429 std::string offset_str = url.ExtractFileName();
1539 int offset; 1430 int offset;
1540 if (!StringToInt(offset_str, &offset)) 1431 if (!StringToInt(offset_str, &offset))
1541 return; 1432 return;
1542 1433
1543 WebViewDelegate* d = webframe_->GetWebViewImpl()->delegate(); 1434 WebViewDelegate* d = webframe_->GetWebViewImpl()->delegate();
1544 if (d) 1435 if (d)
1545 d->NavigateBackForwardSoon(offset); 1436 d->NavigateBackForwardSoon(offset);
1546 } 1437 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698