| 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 "webkit/glue/resource_fetcher.h" | 5 #include "webkit/glue/resource_fetcher.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" | 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" |
| 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKitClient.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKitClient.h" |
| 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLError.h" | 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLError.h" |
| 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLLoader.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLLoader.h" |
| 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" |
| 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" |
| 15 | 15 |
| 16 using base::TimeDelta; | 16 using base::TimeDelta; |
| 17 using WebKit::WebFrame; | 17 using WebKit::WebFrame; |
| 18 using WebKit::WebURLError; | 18 using WebKit::WebURLError; |
| 19 using WebKit::WebURLLoader; | 19 using WebKit::WebURLLoader; |
| 20 using WebKit::WebURLRequest; | 20 using WebKit::WebURLRequest; |
| 21 using WebKit::WebURLResponse; | 21 using WebKit::WebURLResponse; |
| 22 | 22 |
| 23 namespace webkit_glue { | 23 namespace webkit_glue { |
| 24 | 24 |
| 25 ResourceFetcher::ResourceFetcher(const GURL& url, WebFrame* frame, | 25 ResourceFetcher::ResourceFetcher(const GURL& url, WebFrame* frame, |
| 26 Callback* c) | 26 Callback* c) |
| 27 : url_(url), | 27 : url_(url), |
| 28 callback_(c), | 28 completed_(false), |
| 29 completed_(false) { | 29 callback_(c) { |
| 30 // Can't do anything without a frame. However, delegate can be NULL (so we | 30 // Can't do anything without a frame. However, delegate can be NULL (so we |
| 31 // can do a http request and ignore the results). | 31 // can do a http request and ignore the results). |
| 32 DCHECK(frame); | 32 DCHECK(frame); |
| 33 Start(frame); | 33 Start(frame); |
| 34 } | 34 } |
| 35 | 35 |
| 36 ResourceFetcher::~ResourceFetcher() { | 36 ResourceFetcher::~ResourceFetcher() { |
| 37 if (!completed_ && loader_.get()) | 37 if (!completed_ && loader_.get()) |
| 38 loader_->cancel(); | 38 loader_->cancel(); |
| 39 } | 39 } |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 } | 130 } |
| 131 | 131 |
| 132 void ResourceFetcherWithTimeout::TimeoutFired() { | 132 void ResourceFetcherWithTimeout::TimeoutFired() { |
| 133 if (!completed_) { | 133 if (!completed_) { |
| 134 loader_->cancel(); | 134 loader_->cancel(); |
| 135 didFail(NULL, WebURLError()); | 135 didFail(NULL, WebURLError()); |
| 136 } | 136 } |
| 137 } | 137 } |
| 138 | 138 |
| 139 } // namespace webkit_glue | 139 } // namespace webkit_glue |
| OLD | NEW |