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

Side by Side Diff: webkit/tools/test_shell/simple_resource_loader_bridge.cc

Issue 7791005: Stop using the default profile's proxy service for plugin proxy requests, and instead use the ass... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix test Created 9 years, 3 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
« no previous file with comments | « webkit/plugins/npapi/webplugin_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // This file contains an implementation of the ResourceLoaderBridge class. 5 // This file contains an implementation of the ResourceLoaderBridge class.
6 // The class is implemented using net::URLRequest, meaning it is a "simple" 6 // The class is implemented using net::URLRequest, meaning it is a "simple"
7 // version that directly issues requests. The more complicated one used in the 7 // version that directly issues requests. The more complicated one used in the
8 // browser uses IPC. 8 // browser uses IPC.
9 // 9 //
10 // Because net::URLRequest only provides an asynchronous resource loading API, 10 // Because net::URLRequest only provides an asynchronous resource loading API,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "net/base/file_stream.h" 47 #include "net/base/file_stream.h"
48 #include "net/base/io_buffer.h" 48 #include "net/base/io_buffer.h"
49 #include "net/base/load_flags.h" 49 #include "net/base/load_flags.h"
50 #include "net/base/net_errors.h" 50 #include "net/base/net_errors.h"
51 #include "net/base/net_util.h" 51 #include "net/base/net_util.h"
52 #include "net/base/static_cookie_policy.h" 52 #include "net/base/static_cookie_policy.h"
53 #include "net/base/upload_data.h" 53 #include "net/base/upload_data.h"
54 #include "net/http/http_cache.h" 54 #include "net/http/http_cache.h"
55 #include "net/http/http_request_headers.h" 55 #include "net/http/http_request_headers.h"
56 #include "net/http/http_response_headers.h" 56 #include "net/http/http_response_headers.h"
57 #include "net/proxy/proxy_service.h"
58 #include "net/url_request/url_request.h" 57 #include "net/url_request/url_request.h"
59 #include "net/url_request/url_request_job.h" 58 #include "net/url_request/url_request_job.h"
60 #include "webkit/appcache/appcache_interfaces.h" 59 #include "webkit/appcache/appcache_interfaces.h"
61 #include "webkit/blob/blob_storage_controller.h" 60 #include "webkit/blob/blob_storage_controller.h"
62 #include "webkit/blob/blob_url_request_job.h" 61 #include "webkit/blob/blob_url_request_job.h"
63 #include "webkit/blob/deletable_file_reference.h" 62 #include "webkit/blob/deletable_file_reference.h"
64 #include "webkit/fileapi/file_system_context.h" 63 #include "webkit/fileapi/file_system_context.h"
65 #include "webkit/fileapi/file_system_dir_url_request_job.h" 64 #include "webkit/fileapi/file_system_dir_url_request_job.h"
66 #include "webkit/fileapi/file_system_url_request_job.h" 65 #include "webkit/fileapi/file_system_url_request_job.h"
67 #include "webkit/glue/resource_loader_bridge.h" 66 #include "webkit/glue/resource_loader_bridge.h"
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 //----------------------------------------------------------------------------- 784 //-----------------------------------------------------------------------------
786 785
787 namespace webkit_glue { 786 namespace webkit_glue {
788 787
789 // Factory function. 788 // Factory function.
790 ResourceLoaderBridge* ResourceLoaderBridge::Create( 789 ResourceLoaderBridge* ResourceLoaderBridge::Create(
791 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) { 790 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) {
792 return new ResourceLoaderBridgeImpl(request_info); 791 return new ResourceLoaderBridgeImpl(request_info);
793 } 792 }
794 793
795 // Issue the proxy resolve request on the io thread, and wait
796 // for the result.
797 bool FindProxyForUrl(const GURL& url, std::string* proxy_list) {
798 DCHECK(g_request_context);
799
800 scoped_refptr<net::SyncProxyServiceHelper> sync_proxy_service(
801 new net::SyncProxyServiceHelper(g_io_thread->message_loop(),
802 g_request_context->proxy_service()));
803
804 net::ProxyInfo proxy_info;
805 int rv = sync_proxy_service->ResolveProxy(url, &proxy_info,
806 net::BoundNetLog());
807 if (rv == net::OK) {
808 *proxy_list = proxy_info.ToPacString();
809 }
810
811 return rv == net::OK;
812 }
813
814 } // namespace webkit_glue 794 } // namespace webkit_glue
815 795
816 //----------------------------------------------------------------------------- 796 //-----------------------------------------------------------------------------
817 797
818 // static 798 // static
819 void SimpleResourceLoaderBridge::Init( 799 void SimpleResourceLoaderBridge::Init(
820 const FilePath& cache_path, 800 const FilePath& cache_path,
821 net::HttpCache::Mode cache_mode, 801 net::HttpCache::Mode cache_mode,
822 bool no_proxy) { 802 bool no_proxy) {
823 // Make sure to stop any existing IO thread since it may be using the 803 // Make sure to stop any existing IO thread since it may be using the
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 899
920 // static 900 // static
921 scoped_refptr<base::MessageLoopProxy> 901 scoped_refptr<base::MessageLoopProxy>
922 SimpleResourceLoaderBridge::GetIoThread() { 902 SimpleResourceLoaderBridge::GetIoThread() {
923 if (!EnsureIOThread()) { 903 if (!EnsureIOThread()) {
924 LOG(DFATAL) << "Failed to create IO thread."; 904 LOG(DFATAL) << "Failed to create IO thread.";
925 return NULL; 905 return NULL;
926 } 906 }
927 return g_io_thread->message_loop_proxy(); 907 return g_io_thread->message_loop_proxy();
928 } 908 }
OLDNEW
« no previous file with comments | « webkit/plugins/npapi/webplugin_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698