OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 | 10 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 #include "webkit/glue/webdatasource_impl.h" | 60 #include "webkit/glue/webdatasource_impl.h" |
61 #include "webkit/glue/webdevtoolsagent_impl.h" | 61 #include "webkit/glue/webdevtoolsagent_impl.h" |
62 #include "webkit/glue/webframeloaderclient_impl.h" | 62 #include "webkit/glue/webframeloaderclient_impl.h" |
63 #include "webkit/glue/webkit_glue.h" | 63 #include "webkit/glue/webkit_glue.h" |
64 #include "webkit/glue/webplugin_delegate.h" | 64 #include "webkit/glue/webplugin_delegate.h" |
65 #include "webkit/glue/webplugin_impl.h" | 65 #include "webkit/glue/webplugin_impl.h" |
66 #include "webkit/glue/webview_delegate.h" | 66 #include "webkit/glue/webview_delegate.h" |
67 #include "webkit/glue/webview_impl.h" | 67 #include "webkit/glue/webview_impl.h" |
68 | 68 |
69 using namespace WebCore; | 69 using namespace WebCore; |
| 70 |
70 using base::Time; | 71 using base::Time; |
71 using base::TimeDelta; | 72 using base::TimeDelta; |
| 73 |
| 74 using WebKit::WebData; |
72 using WebKit::WebNavigationType; | 75 using WebKit::WebNavigationType; |
| 76 using WebKit::WebString; |
73 using WebKit::WebURL; | 77 using WebKit::WebURL; |
74 using WebKit::WebVector; | 78 using WebKit::WebVector; |
75 using WebKit::WrappedResourceRequest; | 79 using WebKit::WrappedResourceRequest; |
76 using WebKit::WrappedResourceResponse; | 80 using WebKit::WrappedResourceResponse; |
77 | 81 |
78 // Domain for internal error codes. | 82 // Domain for internal error codes. |
79 static const char kInternalErrorDomain[] = "webkit_glue"; | 83 static const char kInternalErrorDomain[] = "webkit_glue"; |
80 | 84 |
81 // An internal error code. Used to note a policy change error resulting from | 85 // An internal error code. Used to note a policy change error resulting from |
82 // dispatchDecidePolicyForMIMEType not passing the PolicyUse option. | 86 // dispatchDecidePolicyForMIMEType not passing the PolicyUse option. |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 if (webframe_->frame()->inViewSourceMode()) | 357 if (webframe_->frame()->inViewSourceMode()) |
354 return GURL(); | 358 return GURL(); |
355 | 359 |
356 // Construct the URL to fetch from the alt error page server. "html404" | 360 // Construct the URL to fetch from the alt error page server. "html404" |
357 // is understood by the link doctor server. | 361 // is understood by the link doctor server. |
358 return d->GetAlternateErrorPageURL(failedURL, WebViewDelegate::HTTP_404); | 362 return d->GetAlternateErrorPageURL(failedURL, WebViewDelegate::HTTP_404); |
359 } | 363 } |
360 | 364 |
361 void WebFrameLoaderClient::Alt404PageFinished(DocumentLoader* loader, | 365 void WebFrameLoaderClient::Alt404PageFinished(DocumentLoader* loader, |
362 const std::string& html) { | 366 const std::string& html) { |
| 367 const WebURL& base_url = webkit_glue::KURLToWebURL(loader->url()); |
363 if (html.length() > 0) { | 368 if (html.length() > 0) { |
364 // TODO(tc): Handle backoff on so we don't hammer the alt error page | 369 // TODO(tc): Handle backoff on so we don't hammer the alt error page |
365 // servers. | 370 // servers. |
366 webframe_->LoadHTMLString(html, webkit_glue::KURLToGURL(loader->url())); | 371 webframe_->LoadHTMLString(html, base_url); |
367 } else { | 372 } else { |
368 // Fall back on original text | 373 // Fall back on original text |
369 webframe_->LoadHTMLString(postponed_data_, | 374 webframe_->LoadHTMLString(postponed_data_, base_url); |
370 webkit_glue::KURLToGURL(loader->url())); | |
371 } | 375 } |
372 } | 376 } |
373 | 377 |
374 void WebFrameLoaderClient::dispatchDidFailLoading(DocumentLoader* loader, | 378 void WebFrameLoaderClient::dispatchDidFailLoading(DocumentLoader* loader, |
375 unsigned long identifier, | 379 unsigned long identifier, |
376 const ResourceError& error) { | 380 const ResourceError& error) { |
377 WebViewImpl* webview = webframe_->GetWebViewImpl(); | 381 WebViewImpl* webview = webframe_->GetWebViewImpl(); |
378 if (webview && webview->delegate()) { | 382 if (webview && webview->delegate()) { |
379 webview->delegate()->DidFailLoadingWithError( | 383 webview->delegate()->DidFailLoadingWithError( |
380 webview, identifier, webkit_glue::ResourceErrorToWebURLError(error)); | 384 webview, identifier, webkit_glue::ResourceErrorToWebURLError(error)); |
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1536 | 1540 |
1537 std::string offset_str = url.ExtractFileName(); | 1541 std::string offset_str = url.ExtractFileName(); |
1538 int offset; | 1542 int offset; |
1539 if (!StringToInt(offset_str, &offset)) | 1543 if (!StringToInt(offset_str, &offset)) |
1540 return; | 1544 return; |
1541 | 1545 |
1542 WebViewDelegate* d = webframe_->GetWebViewImpl()->delegate(); | 1546 WebViewDelegate* d = webframe_->GetWebViewImpl()->delegate(); |
1543 if (d) | 1547 if (d) |
1544 d->NavigateBackForwardSoon(offset); | 1548 d->NavigateBackForwardSoon(offset); |
1545 } | 1549 } |
OLD | NEW |