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 #ifndef CONTENT_BROWSER_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_HOST_H_ |
6 #define CONTENT_BROWSER_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_HOST_H_ | 6 #define CONTENT_BROWSER_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_HOST_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 explicit FileSystemDispatcherHost(Profile* profile); | 40 explicit FileSystemDispatcherHost(Profile* profile); |
41 // Used by the worker, since it has the context handy already. | 41 // Used by the worker, since it has the context handy already. |
42 explicit FileSystemDispatcherHost(ChromeURLRequestContext* context); | 42 explicit FileSystemDispatcherHost(ChromeURLRequestContext* context); |
43 ~FileSystemDispatcherHost(); | 43 ~FileSystemDispatcherHost(); |
44 | 44 |
45 // BrowserMessageFilter implementation. | 45 // BrowserMessageFilter implementation. |
46 virtual void OnChannelConnected(int32 peer_pid); | 46 virtual void OnChannelConnected(int32 peer_pid); |
47 virtual bool OnMessageReceived(const IPC::Message& message, | 47 virtual bool OnMessageReceived(const IPC::Message& message, |
48 bool* message_was_ok); | 48 bool* message_was_ok); |
49 | 49 |
| 50 void UnregisterOperation(int request_id); |
50 | 51 |
51 void OnOpenFileSystem(int request_id, | 52 private: |
52 const GURL& origin_url, | 53 void OnOpen(int request_id, |
53 fileapi::FileSystemType type, | 54 const GURL& origin_url, |
54 int64 requested_size, | 55 fileapi::FileSystemType type, |
55 bool create); | 56 int64 requested_size, |
| 57 bool create); |
56 void OnMove(int request_id, | 58 void OnMove(int request_id, |
57 const FilePath& src_path, | 59 const FilePath& src_path, |
58 const FilePath& dest_path); | 60 const FilePath& dest_path); |
59 void OnCopy(int request_id, | 61 void OnCopy(int request_id, |
60 const FilePath& src_path, | 62 const FilePath& src_path, |
61 const FilePath& dest_path); | 63 const FilePath& dest_path); |
62 void OnRemove(int request_id, const FilePath& path, bool recursive); | 64 void OnRemove(int request_id, const FilePath& path, bool recursive); |
63 void OnReadMetadata(int request_id, const FilePath& path); | 65 void OnReadMetadata(int request_id, const FilePath& path); |
64 void OnCreate(int request_id, | 66 void OnCreate(int request_id, |
65 const FilePath& path, | 67 const FilePath& path, |
66 bool exclusive, | 68 bool exclusive, |
67 bool is_directory, | 69 bool is_directory, |
68 bool recursive); | 70 bool recursive); |
69 void OnExists(int request_id, const FilePath& path, bool is_directory); | 71 void OnExists(int request_id, const FilePath& path, bool is_directory); |
70 void OnReadDirectory(int request_id, const FilePath& path); | 72 void OnReadDirectory(int request_id, const FilePath& path); |
71 void OnWrite(int request_id, | 73 void OnWrite(int request_id, |
72 const FilePath& path, | 74 const FilePath& path, |
73 const GURL& blob_url, | 75 const GURL& blob_url, |
74 int64 offset); | 76 int64 offset); |
75 void OnTruncate(int request_id, const FilePath& path, int64 length); | 77 void OnTruncate(int request_id, const FilePath& path, int64 length); |
76 void OnTouchFile(int request_id, | 78 void OnTouchFile(int request_id, |
77 const FilePath& path, | 79 const FilePath& path, |
78 const base::Time& last_access_time, | 80 const base::Time& last_access_time, |
79 const base::Time& last_modified_time); | 81 const base::Time& last_modified_time); |
80 void OnCancel(int request_id, int request_to_cancel); | 82 void OnCancel(int request_id, int request_to_cancel); |
81 void UnregisterOperation(int request_id); | |
82 | 83 |
83 private: | |
84 // Creates a new FileSystemOperation. | 84 // Creates a new FileSystemOperation. |
85 fileapi::FileSystemOperation* GetNewOperation(int request_id); | 85 fileapi::FileSystemOperation* GetNewOperation(int request_id); |
86 | 86 |
87 scoped_refptr<fileapi::FileSystemContext> context_; | 87 scoped_refptr<fileapi::FileSystemContext> context_; |
88 | 88 |
89 // Used to look up permissions. | 89 // Used to look up permissions. |
90 scoped_refptr<HostContentSettingsMap> host_content_settings_map_; | 90 scoped_refptr<HostContentSettingsMap> host_content_settings_map_; |
91 | 91 |
92 // Keeps ongoing file system operations. | 92 // Keeps ongoing file system operations. |
93 typedef IDMap<fileapi::FileSystemOperation> OperationsMap; | 93 typedef IDMap<fileapi::FileSystemOperation> OperationsMap; |
94 OperationsMap operations_; | 94 OperationsMap operations_; |
95 | 95 |
96 // This holds the URLRequestContextGetter until Init() can be called from the | 96 // This holds the URLRequestContextGetter until Init() can be called from the |
97 // IO thread, which will extract the net::URLRequestContext from it. | 97 // IO thread, which will extract the net::URLRequestContext from it. |
98 scoped_refptr<URLRequestContextGetter> request_context_getter_; | 98 scoped_refptr<URLRequestContextGetter> request_context_getter_; |
99 scoped_refptr<net::URLRequestContext> request_context_; | 99 scoped_refptr<net::URLRequestContext> request_context_; |
100 | 100 |
101 DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcherHost); | 101 DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcherHost); |
102 }; | 102 }; |
103 | 103 |
104 #endif // CONTENT_BROWSER_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_HOST_H_ | 104 #endif // CONTENT_BROWSER_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_HOST_H_ |
OLD | NEW |