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 "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" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 RunCallback(WebURLResponse(), std::string()); | 120 RunCallback(WebURLResponse(), std::string()); |
121 } | 121 } |
122 | 122 |
123 ///////////////////////////////////////////////////////////////////////////// | 123 ///////////////////////////////////////////////////////////////////////////// |
124 // A resource fetcher with a timeout | 124 // A resource fetcher with a timeout |
125 | 125 |
126 ResourceFetcherWithTimeout::ResourceFetcherWithTimeout( | 126 ResourceFetcherWithTimeout::ResourceFetcherWithTimeout( |
127 const GURL& url, WebFrame* frame, WebURLRequest::TargetType target_type, | 127 const GURL& url, WebFrame* frame, WebURLRequest::TargetType target_type, |
128 int timeout_secs, Callback* callback) | 128 int timeout_secs, Callback* callback) |
129 : ResourceFetcher(url, frame, target_type, callback) { | 129 : ResourceFetcher(url, frame, target_type, callback) { |
130 timeout_timer_.Start(FROM_HERE, TimeDelta::FromSeconds(timeout_secs), this, | 130 timeout_timer_.Start(TimeDelta::FromSeconds(timeout_secs), this, |
131 &ResourceFetcherWithTimeout::TimeoutFired); | 131 &ResourceFetcherWithTimeout::TimeoutFired); |
132 } | 132 } |
133 | 133 |
134 ResourceFetcherWithTimeout::~ResourceFetcherWithTimeout() { | 134 ResourceFetcherWithTimeout::~ResourceFetcherWithTimeout() { |
135 } | 135 } |
136 | 136 |
137 void ResourceFetcherWithTimeout::TimeoutFired() { | 137 void ResourceFetcherWithTimeout::TimeoutFired() { |
138 if (!completed_) { | 138 if (!completed_) { |
139 loader_->cancel(); | 139 loader_->cancel(); |
140 didFail(NULL, WebURLError()); | 140 didFail(NULL, WebURLError()); |
141 } | 141 } |
142 } | 142 } |
143 | 143 |
144 } // namespace webkit_glue | 144 } // namespace webkit_glue |
OLD | NEW |