| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "android_webview/browser/aw_contents_io_thread_client.h" | 9 #include "android_webview/browser/aw_contents_io_thread_client.h" |
| 10 #include "android_webview/browser/aw_login_delegate.h" | 10 #include "android_webview/browser/aw_login_delegate.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // the client callbacks will be deferred the request until a client is ready. | 60 // the client callbacks will be deferred the request until a client is ready. |
| 61 class IoThreadClientThrottle : public content::ResourceThrottle { | 61 class IoThreadClientThrottle : public content::ResourceThrottle { |
| 62 public: | 62 public: |
| 63 IoThreadClientThrottle(int render_process_id, | 63 IoThreadClientThrottle(int render_process_id, |
| 64 int render_frame_id, | 64 int render_frame_id, |
| 65 net::URLRequest* request); | 65 net::URLRequest* request); |
| 66 ~IoThreadClientThrottle() override; | 66 ~IoThreadClientThrottle() override; |
| 67 | 67 |
| 68 // From content::ResourceThrottle | 68 // From content::ResourceThrottle |
| 69 void WillStartRequest(bool* defer) override; | 69 void WillStartRequest(bool* defer) override; |
| 70 void WillRedirectRequest(const GURL& new_url, bool* defer) override; | 70 void WillRedirectRequest(const net::RedirectInfo& redirect_info, |
| 71 bool* defer) override; |
| 71 const char* GetNameForLogging() const override; | 72 const char* GetNameForLogging() const override; |
| 72 | 73 |
| 73 void OnIoThreadClientReady(int new_render_process_id, | 74 void OnIoThreadClientReady(int new_render_process_id, |
| 74 int new_render_frame_id); | 75 int new_render_frame_id); |
| 75 bool MaybeBlockRequest(); | 76 bool MaybeBlockRequest(); |
| 76 bool ShouldBlockRequest(); | 77 bool ShouldBlockRequest(); |
| 77 int render_process_id() const { return render_process_id_; } | 78 int render_process_id() const { return render_process_id_; } |
| 78 int render_frame_id() const { return render_frame_id_; } | 79 int render_frame_id() const { return render_frame_id_; } |
| 79 | 80 |
| 80 private: | 81 private: |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 AwContentsIoThreadClient::FromID(render_process_id_, render_frame_id_); | 114 AwContentsIoThreadClient::FromID(render_process_id_, render_frame_id_); |
| 114 if (io_client && io_client->PendingAssociation()) { | 115 if (io_client && io_client->PendingAssociation()) { |
| 115 *defer = true; | 116 *defer = true; |
| 116 AwResourceDispatcherHostDelegate::AddPendingThrottle( | 117 AwResourceDispatcherHostDelegate::AddPendingThrottle( |
| 117 render_process_id_, render_frame_id_, this); | 118 render_process_id_, render_frame_id_, this); |
| 118 } else { | 119 } else { |
| 119 MaybeBlockRequest(); | 120 MaybeBlockRequest(); |
| 120 } | 121 } |
| 121 } | 122 } |
| 122 | 123 |
| 123 void IoThreadClientThrottle::WillRedirectRequest(const GURL& new_url, | 124 void IoThreadClientThrottle::WillRedirectRequest( |
| 124 bool* defer) { | 125 const net::RedirectInfo& redirect_info, |
| 126 bool* defer) { |
| 125 WillStartRequest(defer); | 127 WillStartRequest(defer); |
| 126 } | 128 } |
| 127 | 129 |
| 128 void IoThreadClientThrottle::OnIoThreadClientReady(int new_render_process_id, | 130 void IoThreadClientThrottle::OnIoThreadClientReady(int new_render_process_id, |
| 129 int new_render_frame_id) { | 131 int new_render_frame_id) { |
| 130 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 132 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 131 | 133 |
| 132 if (!MaybeBlockRequest()) { | 134 if (!MaybeBlockRequest()) { |
| 133 controller()->Resume(); | 135 controller()->Resume(); |
| 134 } | 136 } |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 net::HttpRequestHeaders headers; | 418 net::HttpRequestHeaders headers; |
| 417 headers.AddHeadersFromString(extra_headers); | 419 headers.AddHeadersFromString(extra_headers); |
| 418 for (net::HttpRequestHeaders::Iterator it(headers); it.GetNext(); ) { | 420 for (net::HttpRequestHeaders::Iterator it(headers); it.GetNext(); ) { |
| 419 request->SetExtraRequestHeaderByName(it.name(), it.value(), false); | 421 request->SetExtraRequestHeaderByName(it.name(), it.value(), false); |
| 420 } | 422 } |
| 421 } | 423 } |
| 422 } | 424 } |
| 423 } | 425 } |
| 424 | 426 |
| 425 } // namespace android_webview | 427 } // namespace android_webview |
| OLD | NEW |