| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 return NULL; | 120 return NULL; |
| 121 } | 121 } |
| 122 | 122 |
| 123 // If the path ends with a /, we know it's a directory. If the path refers | 123 // If the path ends with a /, we know it's a directory. If the path refers |
| 124 // to a directory and gets dispatched to FileSystemURLRequestJob, that class | 124 // to a directory and gets dispatched to FileSystemURLRequestJob, that class |
| 125 // redirects back here, by adding a / to the URL. | 125 // redirects back here, by adding a / to the URL. |
| 126 const std::string path = request->url().path(); | 126 const std::string path = request->url().path(); |
| 127 if (!path.empty() && path[path.size() - 1] == '/') { | 127 if (!path.empty() && path[path.size() - 1] == '/') { |
| 128 return new fileapi::FileSystemDirURLRequestJob( | 128 return new fileapi::FileSystemDirURLRequestJob( |
| 129 request, | 129 request, |
| 130 fs_context->path_manager(), | 130 fs_context, |
| 131 SimpleResourceLoaderBridge::GetIoThread()); | 131 SimpleResourceLoaderBridge::GetIoThread()); |
| 132 } | 132 } |
| 133 return new fileapi::FileSystemURLRequestJob( | 133 return new fileapi::FileSystemURLRequestJob( |
| 134 request, | 134 request, |
| 135 fs_context->path_manager(), | 135 fs_context, |
| 136 SimpleResourceLoaderBridge::GetIoThread()); | 136 SimpleResourceLoaderBridge::GetIoThread()); |
| 137 } | 137 } |
| 138 | 138 |
| 139 TestShellRequestContextParams* g_request_context_params = NULL; | 139 TestShellRequestContextParams* g_request_context_params = NULL; |
| 140 TestShellRequestContext* g_request_context = NULL; | 140 TestShellRequestContext* g_request_context = NULL; |
| 141 base::Thread* g_cache_thread = NULL; | 141 base::Thread* g_cache_thread = NULL; |
| 142 | 142 |
| 143 //----------------------------------------------------------------------------- | 143 //----------------------------------------------------------------------------- |
| 144 | 144 |
| 145 class IOThread : public base::Thread { | 145 class IOThread : public base::Thread { |
| (...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 948 | 948 |
| 949 // static | 949 // static |
| 950 scoped_refptr<base::MessageLoopProxy> | 950 scoped_refptr<base::MessageLoopProxy> |
| 951 SimpleResourceLoaderBridge::GetIoThread() { | 951 SimpleResourceLoaderBridge::GetIoThread() { |
| 952 if (!EnsureIOThread()) { | 952 if (!EnsureIOThread()) { |
| 953 LOG(DFATAL) << "Failed to create IO thread."; | 953 LOG(DFATAL) << "Failed to create IO thread."; |
| 954 return NULL; | 954 return NULL; |
| 955 } | 955 } |
| 956 return g_io_thread->message_loop_proxy(); | 956 return g_io_thread->message_loop_proxy(); |
| 957 } | 957 } |
| OLD | NEW |