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

Side by Side Diff: chrome/browser/net/file_system_url_request_job_factory.cc

Issue 6864040: Fixed file/directory url resolution for external mount point provider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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) 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 #include "chrome/browser/net/file_system_url_request_job_factory.h" 5 #include "chrome/browser/net/file_system_url_request_job_factory.h"
6 6
7 #include "chrome/browser/net/chrome_url_request_context.h" 7 #include "chrome/browser/net/chrome_url_request_context.h"
8 #include "chrome/common/url_constants.h" 8 #include "chrome/common/url_constants.h"
9 #include "content/browser/browser_thread.h" 9 #include "content/browser/browser_thread.h"
10 #include "net/url_request/url_request.h" 10 #include "net/url_request/url_request.h"
11 #include "webkit/fileapi/file_system_url_request_job.h" 11 #include "webkit/fileapi/file_system_url_request_job.h"
12 #include "webkit/fileapi/file_system_dir_url_request_job.h" 12 #include "webkit/fileapi/file_system_dir_url_request_job.h"
13 13
14 namespace { 14 namespace {
15 15
16 net::URLRequestJob* FileSystemURLRequestJobFactory(net::URLRequest* request, 16 net::URLRequestJob* FileSystemURLRequestJobFactory(net::URLRequest* request,
17 const std::string& scheme) { 17 const std::string& scheme) {
18 fileapi::FileSystemPathManager* path_manager = 18 fileapi::FileSystemContext* file_system_context =
19 static_cast<ChromeURLRequestContext*>(request->context()) 19 static_cast<ChromeURLRequestContext*>(request->context())
20 ->file_system_context()->path_manager(); 20 ->file_system_context();
21 const std::string path = request->url().path(); 21 const std::string path = request->url().path();
22 22
23 // If the path ends with a /, we know it's a directory. If the path refers 23 // If the path ends with a /, we know it's a directory. If the path refers
24 // to a directory and gets dispatched to FileSystemURLRequestJob, that class 24 // to a directory and gets dispatched to FileSystemURLRequestJob, that class
25 // redirects back here, by adding a / to the URL. 25 // redirects back here, by adding a / to the URL.
26 if (!path.empty() && path[path.size() - 1] == '/') { 26 if (!path.empty() && path[path.size() - 1] == '/') {
27 return new fileapi::FileSystemDirURLRequestJob(request, path_manager, 27 return new fileapi::FileSystemDirURLRequestJob(request, file_system_context,
28 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); 28 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
29 } 29 }
30 return new fileapi::FileSystemURLRequestJob(request, path_manager, 30 return new fileapi::FileSystemURLRequestJob(request, file_system_context,
31 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); 31 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
32 } 32 }
33 33
34 } // anonymous namespace 34 } // anonymous namespace
35 35
36 void RegisterFileSystemURLRequestJobFactory() { 36 void RegisterFileSystemURLRequestJobFactory() {
37 net::URLRequest::RegisterProtocolFactory(chrome::kFileSystemScheme, 37 net::URLRequest::RegisterProtocolFactory(chrome::kFileSystemScheme,
38 &FileSystemURLRequestJobFactory); 38 &FileSystemURLRequestJobFactory);
39 } 39 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698