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
3 // found in the LICENSE file.
5 #ifndef STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_DIR_URL_REQUEST_JOB_H_
6 #define STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_DIR_URL_REQUEST_JOB_H_
11 #include "base/files/file.h"
12 #include "base/files/file_path.h"
13 #include "base/memory/weak_ptr.h"
14 #include "base/message_loop/message_loop_proxy.h"
15 #include "net/url_request/url_request_job.h"
16 #include "storage/browser/fileapi/file_system_url.h"
17 #include "storage/browser/storage_browser_export.h"
21 class FileSystemContext
;
22 struct DirectoryEntry
;
24 // A request job that handles reading filesystem: URLs for directories.
25 class STORAGE_EXPORT_PRIVATE FileSystemDirURLRequestJob
26 : public net::URLRequestJob
{
28 FileSystemDirURLRequestJob(
29 net::URLRequest
* request
,
30 net::NetworkDelegate
* network_delegate
,
31 const std::string
& storage_domain
,
32 FileSystemContext
* file_system_context
);
34 // URLRequestJob methods:
35 virtual void Start() OVERRIDE
;
36 virtual void Kill() OVERRIDE
;
37 virtual bool ReadRawData(net::IOBuffer
* buf
,
39 int* bytes_read
) OVERRIDE
;
40 virtual bool GetCharset(std::string
* charset
) OVERRIDE
;
42 // FilterContext methods (via URLRequestJob):
43 virtual bool GetMimeType(std::string
* mime_type
) const OVERRIDE
;
44 // TODO(adamk): Implement GetResponseInfo and GetResponseCode to simulate
48 class CallbackDispatcher
;
50 virtual ~FileSystemDirURLRequestJob();
53 void DidAttemptAutoMount(base::File::Error result
);
54 void DidReadDirectory(base::File::Error result
,
55 const std::vector
<DirectoryEntry
>& entries
,
60 const std::string storage_domain_
;
61 FileSystemContext
* file_system_context_
;
62 base::WeakPtrFactory
<FileSystemDirURLRequestJob
> weak_factory_
;
64 DISALLOW_COPY_AND_ASSIGN(FileSystemDirURLRequestJob
);
67 } // namespace storage
69 #endif // STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_DIR_URL_REQUEST_JOB_H_