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 // An implementation of WebURLLoader in terms of ResourceLoaderBridge. | 5 // An implementation of WebURLLoader in terms of ResourceLoaderBridge. |
6 | 6 |
7 #include "webkit/glue/weburlloader_impl.h" | 7 #include "webkit/glue/weburlloader_impl.h" |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 has_accept_header_(false) { | 62 has_accept_header_(false) { |
63 } | 63 } |
64 | 64 |
65 virtual void visitHeader(const WebString& name, const WebString& value) { | 65 virtual void visitHeader(const WebString& name, const WebString& value) { |
66 // TODO(darin): is UTF-8 really correct here? It is if the strings are | 66 // TODO(darin): is UTF-8 really correct here? It is if the strings are |
67 // already ASCII (i.e., if they are already escaped properly). | 67 // already ASCII (i.e., if they are already escaped properly). |
68 const std::string& name_utf8 = name.utf8(); | 68 const std::string& name_utf8 = name.utf8(); |
69 const std::string& value_utf8 = value.utf8(); | 69 const std::string& value_utf8 = value.utf8(); |
70 | 70 |
71 // Skip over referrer headers found in the header map because we already | 71 // Skip over referrer headers found in the header map because we already |
72 // pulled it out as a separate parameter. We likewise prune the UA since | 72 // pulled it out as a separate parameter. |
73 // that will be added back by the network layer. | 73 if (LowerCaseEqualsASCII(name_utf8, "referer")) |
74 if (LowerCaseEqualsASCII(name_utf8, "referer") || | |
75 LowerCaseEqualsASCII(name_utf8, "user-agent")) | |
76 return; | 74 return; |
77 | 75 |
78 // Skip over "Cache-Control: max-age=0" header if the corresponding | 76 // Skip over "Cache-Control: max-age=0" header if the corresponding |
79 // load flag is already specified. FrameLoader sets both the flag and | 77 // load flag is already specified. FrameLoader sets both the flag and |
80 // the extra header -- the extra header is redundant since our network | 78 // the extra header -- the extra header is redundant since our network |
81 // implementation will add the necessary headers based on load flags. | 79 // implementation will add the necessary headers based on load flags. |
82 // See http://code.google.com/p/chromium/issues/detail?id=3434. | 80 // See http://code.google.com/p/chromium/issues/detail?id=3434. |
83 if ((load_flags_ & net::LOAD_VALIDATE_CACHE) && | 81 if ((load_flags_ & net::LOAD_VALIDATE_CACHE) && |
84 LowerCaseEqualsASCII(name_utf8, "cache-control") && | 82 LowerCaseEqualsASCII(name_utf8, "cache-control") && |
85 LowerCaseEqualsASCII(value_utf8, "max-age=0")) | 83 LowerCaseEqualsASCII(value_utf8, "max-age=0")) |
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 | 750 |
753 void WebURLLoaderImpl::cancel() { | 751 void WebURLLoaderImpl::cancel() { |
754 context_->Cancel(); | 752 context_->Cancel(); |
755 } | 753 } |
756 | 754 |
757 void WebURLLoaderImpl::setDefersLoading(bool value) { | 755 void WebURLLoaderImpl::setDefersLoading(bool value) { |
758 context_->SetDefersLoading(value); | 756 context_->SetDefersLoading(value); |
759 } | 757 } |
760 | 758 |
761 } // namespace webkit_glue | 759 } // namespace webkit_glue |
OLD | NEW |