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

Side by Side Diff: webkit/browser/fileapi/file_system_url_request_job_factory.cc

Issue 206253002: Revert of Add mechanism to auto mount file systems in response to a URL request. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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/browser/fileapi/file_system_url_request_job_factory.h ('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) 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 "webkit/browser/fileapi/file_system_url_request_job_factory.h" 5 #include "webkit/browser/fileapi/file_system_url_request_job_factory.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "net/url_request/url_request.h" 11 #include "net/url_request/url_request.h"
12 #include "webkit/browser/fileapi/file_system_dir_url_request_job.h" 12 #include "webkit/browser/fileapi/file_system_dir_url_request_job.h"
13 #include "webkit/browser/fileapi/file_system_url_request_job.h" 13 #include "webkit/browser/fileapi/file_system_url_request_job.h"
14 14
15 namespace fileapi { 15 namespace fileapi {
16 16
17 namespace { 17 namespace {
18 18
19 class FileSystemProtocolHandler 19 class FileSystemProtocolHandler
20 : public net::URLRequestJobFactory::ProtocolHandler { 20 : public net::URLRequestJobFactory::ProtocolHandler {
21 public: 21 public:
22 FileSystemProtocolHandler(const std::string& storage_domain, 22 explicit FileSystemProtocolHandler(FileSystemContext* context);
23 FileSystemContext* context);
24 virtual ~FileSystemProtocolHandler(); 23 virtual ~FileSystemProtocolHandler();
25 24
26 virtual net::URLRequestJob* MaybeCreateJob( 25 virtual net::URLRequestJob* MaybeCreateJob(
27 net::URLRequest* request, 26 net::URLRequest* request,
28 net::NetworkDelegate* network_delegate) const OVERRIDE; 27 net::NetworkDelegate* network_delegate) const OVERRIDE;
29 28
30 private: 29 private:
31 const std::string storage_domain_;
32
33 // No scoped_refptr because |file_system_context_| is owned by the 30 // No scoped_refptr because |file_system_context_| is owned by the
34 // ProfileIOData, which also owns this ProtocolHandler. 31 // ProfileIOData, which also owns this ProtocolHandler.
35 FileSystemContext* const file_system_context_; 32 FileSystemContext* const file_system_context_;
36 33
37 DISALLOW_COPY_AND_ASSIGN(FileSystemProtocolHandler); 34 DISALLOW_COPY_AND_ASSIGN(FileSystemProtocolHandler);
38 }; 35 };
39 36
40 FileSystemProtocolHandler::FileSystemProtocolHandler( 37 FileSystemProtocolHandler::FileSystemProtocolHandler(
41 const std::string& storage_domain,
42 FileSystemContext* context) 38 FileSystemContext* context)
43 : storage_domain_(storage_domain), 39 : file_system_context_(context) {
44 file_system_context_(context) {
45 DCHECK(file_system_context_); 40 DCHECK(file_system_context_);
46 } 41 }
47 42
48 FileSystemProtocolHandler::~FileSystemProtocolHandler() {} 43 FileSystemProtocolHandler::~FileSystemProtocolHandler() {}
49 44
50 net::URLRequestJob* FileSystemProtocolHandler::MaybeCreateJob( 45 net::URLRequestJob* FileSystemProtocolHandler::MaybeCreateJob(
51 net::URLRequest* request, net::NetworkDelegate* network_delegate) const { 46 net::URLRequest* request, net::NetworkDelegate* network_delegate) const {
52 const std::string path = request->url().path(); 47 const std::string path = request->url().path();
53 48
54 // If the path ends with a /, we know it's a directory. If the path refers 49 // If the path ends with a /, we know it's a directory. If the path refers
55 // to a directory and gets dispatched to FileSystemURLRequestJob, that class 50 // to a directory and gets dispatched to FileSystemURLRequestJob, that class
56 // redirects back here, by adding a / to the URL. 51 // redirects back here, by adding a / to the URL.
57 if (!path.empty() && path[path.size() - 1] == '/') { 52 if (!path.empty() && path[path.size() - 1] == '/') {
58 return new FileSystemDirURLRequestJob( 53 return new FileSystemDirURLRequestJob(
59 request, network_delegate, storage_domain_, file_system_context_); 54 request, network_delegate, file_system_context_);
60 } 55 }
61 return new FileSystemURLRequestJob( 56 return new FileSystemURLRequestJob(
62 request, network_delegate, storage_domain_, file_system_context_); 57 request, network_delegate, file_system_context_);
63 } 58 }
64 59
65 } // anonymous namespace 60 } // anonymous namespace
66 61
67 net::URLRequestJobFactory::ProtocolHandler* CreateFileSystemProtocolHandler( 62 net::URLRequestJobFactory::ProtocolHandler*
68 const std::string& storage_domain, FileSystemContext* context) { 63 CreateFileSystemProtocolHandler(FileSystemContext* context) {
69 DCHECK(context); 64 DCHECK(context);
70 return new FileSystemProtocolHandler(storage_domain, context); 65 return new FileSystemProtocolHandler(context);
71 } 66 }
72 67
73 } // namespace fileapi 68 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/browser/fileapi/file_system_url_request_job_factory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698