OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/renderer/fetchers/alt_error_page_resource_fetcher.h" | 5 #include "content/renderer/fetchers/alt_error_page_resource_fetcher.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "content/renderer/fetchers/resource_fetcher.h" | 9 #include "content/renderer/fetchers/resource_fetcher.h" |
10 | 10 |
11 using WebKit::WebFrame; | 11 using blink::WebFrame; |
12 using WebKit::WebURLError; | 12 using blink::WebURLError; |
13 using WebKit::WebURLRequest; | 13 using blink::WebURLRequest; |
14 using WebKit::WebURLResponse; | 14 using blink::WebURLResponse; |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 | 17 |
18 // Number of seconds to wait for the alternate error page server. If it takes | 18 // Number of seconds to wait for the alternate error page server. If it takes |
19 // too long, just use the local error page. | 19 // too long, just use the local error page. |
20 static const int kDownloadTimeoutSec = 3; | 20 static const int kDownloadTimeoutSec = 3; |
21 | 21 |
22 AltErrorPageResourceFetcher::AltErrorPageResourceFetcher( | 22 AltErrorPageResourceFetcher::AltErrorPageResourceFetcher( |
23 const GURL& url, | 23 const GURL& url, |
24 WebFrame* frame, | 24 WebFrame* frame, |
(...skipping 22 matching lines...) Expand all Loading... |
47 const std::string& data) { | 47 const std::string& data) { |
48 // A null response indicates a network error. | 48 // A null response indicates a network error. |
49 if (!response.isNull() && response.httpStatusCode() == 200) { | 49 if (!response.isNull() && response.httpStatusCode() == 200) { |
50 callback_.Run(frame_, original_request_, original_error_, data); | 50 callback_.Run(frame_, original_request_, original_error_, data); |
51 } else { | 51 } else { |
52 callback_.Run(frame_, original_request_, original_error_, std::string()); | 52 callback_.Run(frame_, original_request_, original_error_, std::string()); |
53 } | 53 } |
54 } | 54 } |
55 | 55 |
56 } // namespace content | 56 } // namespace content |
OLD | NEW |