Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Side by Side Diff: android_webview/browser/aw_request_interceptor.cc

Issue 282103004: Rename ProtocolInterceptJobFactory and make it not use ProtocolHandlers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Response to jam's comments (And a merge) Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/aw_request_interceptor.h" 5 #include "android_webview/browser/aw_request_interceptor.h"
6 6
7 #include "android_webview/browser/aw_contents_io_thread_client.h" 7 #include "android_webview/browser/aw_contents_io_thread_client.h"
8 #include "android_webview/browser/intercepted_request_data.h" 8 #include "android_webview/browser/intercepted_request_data.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 scoped_ptr<AwContentsIoThreadClient> io_thread_client = 47 scoped_ptr<AwContentsIoThreadClient> io_thread_client =
48 AwContentsIoThreadClient::FromID(render_process_id, render_frame_id); 48 AwContentsIoThreadClient::FromID(render_process_id, render_frame_id);
49 49
50 if (!io_thread_client.get()) 50 if (!io_thread_client.get())
51 return scoped_ptr<InterceptedRequestData>(); 51 return scoped_ptr<InterceptedRequestData>();
52 52
53 return io_thread_client->ShouldInterceptRequest(location, request).Pass(); 53 return io_thread_client->ShouldInterceptRequest(location, request).Pass();
54 } 54 }
55 55
56 net::URLRequestJob* AwRequestInterceptor::MaybeCreateJob( 56 net::URLRequestJob* AwRequestInterceptor::MaybeInterceptRequest(
57 net::URLRequest* request, 57 net::URLRequest* request,
58 net::NetworkDelegate* network_delegate) const { 58 net::NetworkDelegate* network_delegate) const {
59 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 59 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
60 60
61 // See if we've already found out the intercepted_request_data for this 61 // See if we've already found out the intercepted_request_data for this
62 // request. 62 // request.
63 // This is done not only for efficiency reasons, but also for correctness 63 // This is done not only for efficiency reasons, but also for correctness
64 // as it is possible for the Interceptor chain to be invoked more than once 64 // as it is possible for the Interceptor chain to be invoked more than once
65 // in which case we don't want to query the embedder multiple times. 65 // in which case we don't want to query the embedder multiple times.
66 // Note: The Interceptor chain is not invoked more than once if we create a 66 // Note: The Interceptor chain is not invoked more than once if we create a
67 // URLRequestJob in this method, so this is only caching negative hits. 67 // URLRequestJob in this method, so this is only caching negative hits.
68 if (request->GetUserData(kRequestAlreadyQueriedDataKey)) 68 if (request->GetUserData(kRequestAlreadyQueriedDataKey))
69 return NULL; 69 return NULL;
70 request->SetUserData(kRequestAlreadyQueriedDataKey, 70 request->SetUserData(kRequestAlreadyQueriedDataKey,
71 new base::SupportsUserData::Data()); 71 new base::SupportsUserData::Data());
72 72
73 scoped_ptr<InterceptedRequestData> intercepted_request_data = 73 scoped_ptr<InterceptedRequestData> intercepted_request_data =
74 QueryForInterceptedRequestData(request->url(), request); 74 QueryForInterceptedRequestData(request->url(), request);
75 75
76 if (!intercepted_request_data) 76 if (!intercepted_request_data)
77 return NULL; 77 return NULL;
78 78
79 // The newly created job will own the InterceptedRequestData. 79 // The newly created job will own the InterceptedRequestData.
80 return InterceptedRequestData::CreateJobFor( 80 return InterceptedRequestData::CreateJobFor(
81 intercepted_request_data.Pass(), request, network_delegate); 81 intercepted_request_data.Pass(), request, network_delegate);
82 } 82 }
83 83
84 } // namespace android_webview 84 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/browser/aw_request_interceptor.h ('k') | android_webview/browser/net/aw_url_request_context_getter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698