OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/Platform/chromium/public/Platform.h" | 8 #include "third_party/WebKit/Source/Platform/chromium/public/Platform.h" |
9 #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h" | 9 #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h" |
10 #include "third_party/WebKit/Source/Platform/chromium/public/WebURLError.h" | 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebURLError.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 void ResourceFetcher::Cancel() { | 44 void ResourceFetcher::Cancel() { |
45 if (!completed_) { | 45 if (!completed_) { |
46 loader_->cancel(); | 46 loader_->cancel(); |
47 completed_ = true; | 47 completed_ = true; |
48 } | 48 } |
49 } | 49 } |
50 | 50 |
51 void ResourceFetcher::Start(WebFrame* frame) { | 51 void ResourceFetcher::Start(WebFrame* frame) { |
52 WebURLRequest request(url_); | 52 WebURLRequest request(url_); |
53 request.setTargetType(target_type_); | 53 request.setTargetType(target_type_); |
| 54 if (target_type_ == WebURLRequest::TargetIsFavicon) { |
| 55 // Disable cookies to avoid side effects when fetching favicon. |
| 56 request.setAllowCookies(false); |
| 57 } |
54 request.setFirstPartyForCookies(frame->document().firstPartyForCookies()); | 58 request.setFirstPartyForCookies(frame->document().firstPartyForCookies()); |
55 frame->dispatchWillSendRequest(request); | 59 frame->dispatchWillSendRequest(request); |
56 | 60 |
57 loader_.reset(WebKit::Platform::current()->createURLLoader()); | 61 loader_.reset(WebKit::Platform::current()->createURLLoader()); |
58 loader_->loadAsynchronously(request, this); | 62 loader_->loadAsynchronously(request, this); |
59 } | 63 } |
60 | 64 |
61 void ResourceFetcher::RunCallback(const WebURLResponse& response, | 65 void ResourceFetcher::RunCallback(const WebURLResponse& response, |
62 const std::string& data) { | 66 const std::string& data) { |
63 if (callback_.is_null()) | 67 if (callback_.is_null()) |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 } | 140 } |
137 | 141 |
138 void ResourceFetcherWithTimeout::TimeoutFired() { | 142 void ResourceFetcherWithTimeout::TimeoutFired() { |
139 if (!completed_) { | 143 if (!completed_) { |
140 loader_->cancel(); | 144 loader_->cancel(); |
141 didFail(NULL, WebURLError()); | 145 didFail(NULL, WebURLError()); |
142 } | 146 } |
143 } | 147 } |
144 | 148 |
145 } // namespace webkit_glue | 149 } // namespace webkit_glue |
OLD | NEW |