| 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 // 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 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 ~CookieGetter() {} | 900 ~CookieGetter() {} |
| 901 | 901 |
| 902 base::WaitableEvent event_; | 902 base::WaitableEvent event_; |
| 903 std::string result_; | 903 std::string result_; |
| 904 }; | 904 }; |
| 905 | 905 |
| 906 } // anonymous namespace | 906 } // anonymous namespace |
| 907 | 907 |
| 908 //----------------------------------------------------------------------------- | 908 //----------------------------------------------------------------------------- |
| 909 | 909 |
| 910 namespace webkit_glue { | |
| 911 | |
| 912 // Factory function. | |
| 913 ResourceLoaderBridge* ResourceLoaderBridge::Create( | |
| 914 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) { | |
| 915 return new ResourceLoaderBridgeImpl(request_info); | |
| 916 } | |
| 917 | |
| 918 } // namespace webkit_glue | |
| 919 | |
| 920 //----------------------------------------------------------------------------- | |
| 921 | |
| 922 // static | 910 // static |
| 923 void SimpleResourceLoaderBridge::Init( | 911 void SimpleResourceLoaderBridge::Init( |
| 924 const FilePath& cache_path, | 912 const FilePath& cache_path, |
| 925 net::HttpCache::Mode cache_mode, | 913 net::HttpCache::Mode cache_mode, |
| 926 bool no_proxy) { | 914 bool no_proxy) { |
| 927 // Make sure to stop any existing IO thread since it may be using the | 915 // Make sure to stop any existing IO thread since it may be using the |
| 928 // current request context. | 916 // current request context. |
| 929 Shutdown(); | 917 Shutdown(); |
| 930 | 918 |
| 931 DCHECK(!g_request_context_params); | 919 DCHECK(!g_request_context_params); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1040 | 1028 |
| 1041 // static | 1029 // static |
| 1042 void SimpleResourceLoaderBridge::AllowFileOverHTTP( | 1030 void SimpleResourceLoaderBridge::AllowFileOverHTTP( |
| 1043 const std::string& file_path_template, const GURL& http_prefix) { | 1031 const std::string& file_path_template, const GURL& http_prefix) { |
| 1044 DCHECK(!file_path_template.empty()); | 1032 DCHECK(!file_path_template.empty()); |
| 1045 DCHECK(http_prefix.is_valid() && | 1033 DCHECK(http_prefix.is_valid() && |
| 1046 (http_prefix.SchemeIs("http") || http_prefix.SchemeIs("https"))); | 1034 (http_prefix.SchemeIs("http") || http_prefix.SchemeIs("https"))); |
| 1047 g_file_over_http_params = new FileOverHTTPParams(file_path_template, | 1035 g_file_over_http_params = new FileOverHTTPParams(file_path_template, |
| 1048 http_prefix); | 1036 http_prefix); |
| 1049 } | 1037 } |
| 1038 |
| 1039 // static |
| 1040 webkit_glue::ResourceLoaderBridge* SimpleResourceLoaderBridge::Create( |
| 1041 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) { |
| 1042 return new ResourceLoaderBridgeImpl(request_info); |
| 1043 } |
| OLD | NEW |