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 "android_webview/browser/renderer_host/aw_resource_dispatcher_host_dele
gate.h" | 5 #include "android_webview/browser/renderer_host/aw_resource_dispatcher_host_dele
gate.h" |
6 | 6 |
7 #include "android_webview/browser/aw_login_delegate.h" | 7 #include "android_webview/browser/aw_login_delegate.h" |
8 #include "android_webview/browser/aw_contents_io_thread_client.h" | 8 #include "android_webview/browser/aw_contents_io_thread_client.h" |
9 #include "android_webview/common/url_constants.h" | 9 #include "android_webview/common/url_constants.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 if (io_client->ShouldBlockNetworkLoads()) { | 87 if (io_client->ShouldBlockNetworkLoads()) { |
88 // Need to cancel ftp since it does not support net::LOAD_ONLY_FROM_CACHE | 88 // Need to cancel ftp since it does not support net::LOAD_ONLY_FROM_CACHE |
89 // flag, so must cancel the request if network load is blocked. | 89 // flag, so must cancel the request if network load is blocked. |
90 if (request->url().SchemeIs(chrome::kFtpScheme)) { | 90 if (request->url().SchemeIs(chrome::kFtpScheme)) { |
91 throttles->push_back(new CancelResourceThrottle); | 91 throttles->push_back(new CancelResourceThrottle); |
92 } else { | 92 } else { |
93 SetOnlyAllowLoadFromCache(request); | 93 SetOnlyAllowLoadFromCache(request); |
94 } | 94 } |
95 } | 95 } |
96 | 96 |
97 if (resource_type == ResourceType::MAIN_FRAME) { | 97 // We ignore POST requests because of BUG=155250. |
| 98 if (resource_type == ResourceType::MAIN_FRAME && |
| 99 request->method() != "POST") { |
98 throttles->push_back(InterceptNavigationDelegate::CreateThrottleFor( | 100 throttles->push_back(InterceptNavigationDelegate::CreateThrottleFor( |
99 request)); | 101 request)); |
100 } | 102 } |
101 } | 103 } |
102 | 104 |
103 bool AwResourceDispatcherHostDelegate::AcceptAuthRequest( | 105 bool AwResourceDispatcherHostDelegate::AcceptAuthRequest( |
104 net::URLRequest* request, | 106 net::URLRequest* request, |
105 net::AuthChallengeInfo* auth_info) { | 107 net::AuthChallengeInfo* auth_info) { |
106 return true; | 108 return true; |
107 } | 109 } |
108 | 110 |
109 content::ResourceDispatcherHostLoginDelegate* | 111 content::ResourceDispatcherHostLoginDelegate* |
110 AwResourceDispatcherHostDelegate::CreateLoginDelegate( | 112 AwResourceDispatcherHostDelegate::CreateLoginDelegate( |
111 net::AuthChallengeInfo* auth_info, | 113 net::AuthChallengeInfo* auth_info, |
112 net::URLRequest* request) { | 114 net::URLRequest* request) { |
113 return new AwLoginDelegate(auth_info, request); | 115 return new AwLoginDelegate(auth_info, request); |
114 } | 116 } |
115 | 117 |
116 void AwResourceDispatcherHostDelegate::SetOnlyAllowLoadFromCache( | 118 void AwResourceDispatcherHostDelegate::SetOnlyAllowLoadFromCache( |
117 net::URLRequest* request) { | 119 net::URLRequest* request) { |
118 int load_flags = request->load_flags(); | 120 int load_flags = request->load_flags(); |
119 load_flags &= ~(net::LOAD_BYPASS_CACHE & | 121 load_flags &= ~(net::LOAD_BYPASS_CACHE & |
120 net::LOAD_VALIDATE_CACHE & | 122 net::LOAD_VALIDATE_CACHE & |
121 net::LOAD_PREFERRING_CACHE); | 123 net::LOAD_PREFERRING_CACHE); |
122 load_flags |= net::LOAD_ONLY_FROM_CACHE; | 124 load_flags |= net::LOAD_ONLY_FROM_CACHE; |
123 request->set_load_flags(load_flags); | 125 request->set_load_flags(load_flags); |
124 } | 126 } |
125 | 127 |
126 } | 128 } |
OLD | NEW |