| 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" |
| 11 #include "base/id_map.h" | 11 #include "base/id_map.h" |
| 12 #include "content/browser/browser_message_filter.h" | 12 #include "content/browser/browser_message_filter.h" |
| 13 #include "webkit/fileapi/file_system_types.h" | 13 #include "webkit/fileapi/file_system_types.h" |
| 14 | 14 |
| 15 class GURL; | 15 class GURL; |
| 16 class HostContentSettingsMap; | |
| 17 class Profile; | 16 class Profile; |
| 18 class Receiver; | 17 class Receiver; |
| 19 class RenderMessageFilter; | 18 class RenderMessageFilter; |
| 20 | 19 |
| 21 namespace base { | 20 namespace base { |
| 22 class Time; | 21 class Time; |
| 23 } | 22 } |
| 24 | 23 |
| 25 namespace content { | 24 namespace content { |
| 26 class ResourceContext; | 25 class ResourceContext; |
| 27 } | 26 } |
| 28 | 27 |
| 29 namespace fileapi { | 28 namespace fileapi { |
| 30 class FileSystemContext; | 29 class FileSystemContext; |
| 31 class FileSystemOperation; | 30 class FileSystemOperation; |
| 32 } | 31 } |
| 33 | 32 |
| 34 namespace net { | 33 namespace net { |
| 35 class URLRequestContext; | 34 class URLRequestContext; |
| 36 } // namespace net | 35 } // namespace net |
| 37 | 36 |
| 38 class FileSystemDispatcherHost : public BrowserMessageFilter { | 37 class FileSystemDispatcherHost : public BrowserMessageFilter { |
| 39 public: | 38 public: |
| 40 // Used by the renderer. | 39 // Used by the renderer. |
| 41 FileSystemDispatcherHost( | 40 explicit FileSystemDispatcherHost( |
| 42 const content::ResourceContext* resource_context, | 41 const content::ResourceContext* resource_context); |
| 43 HostContentSettingsMap* host_content_settings_map); | |
| 44 // Used by the worker, since it has the context handy already. | 42 // Used by the worker, since it has the context handy already. |
| 45 FileSystemDispatcherHost(net::URLRequestContext* request_context, | 43 FileSystemDispatcherHost(net::URLRequestContext* request_context, |
| 46 HostContentSettingsMap* host_content_settings_map, | |
| 47 fileapi::FileSystemContext* file_system_context); | 44 fileapi::FileSystemContext* file_system_context); |
| 48 ~FileSystemDispatcherHost(); | 45 ~FileSystemDispatcherHost(); |
| 49 | 46 |
| 50 // BrowserMessageFilter implementation. | 47 // BrowserMessageFilter implementation. |
| 51 virtual void OnChannelConnected(int32 peer_pid); | 48 virtual void OnChannelConnected(int32 peer_pid); |
| 52 virtual bool OnMessageReceived(const IPC::Message& message, | 49 virtual bool OnMessageReceived(const IPC::Message& message, |
| 53 bool* message_was_ok); | 50 bool* message_was_ok); |
| 54 | 51 |
| 55 void UnregisterOperation(int request_id); | 52 void UnregisterOperation(int request_id); |
| 56 | 53 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 85 const base::Time& last_access_time, | 82 const base::Time& last_access_time, |
| 86 const base::Time& last_modified_time); | 83 const base::Time& last_modified_time); |
| 87 void OnCancel(int request_id, int request_to_cancel); | 84 void OnCancel(int request_id, int request_to_cancel); |
| 88 void OnOpenFile(int request_id, const GURL& path, int file_flags); | 85 void OnOpenFile(int request_id, const GURL& path, int file_flags); |
| 89 | 86 |
| 90 // Creates a new FileSystemOperation. | 87 // Creates a new FileSystemOperation. |
| 91 fileapi::FileSystemOperation* GetNewOperation(int request_id); | 88 fileapi::FileSystemOperation* GetNewOperation(int request_id); |
| 92 | 89 |
| 93 fileapi::FileSystemContext* context_; | 90 fileapi::FileSystemContext* context_; |
| 94 | 91 |
| 95 // Used to look up permissions. | |
| 96 scoped_refptr<HostContentSettingsMap> host_content_settings_map_; | |
| 97 | |
| 98 // Keeps ongoing file system operations. | 92 // Keeps ongoing file system operations. |
| 99 typedef IDMap<fileapi::FileSystemOperation> OperationsMap; | 93 typedef IDMap<fileapi::FileSystemOperation> OperationsMap; |
| 100 OperationsMap operations_; | 94 OperationsMap operations_; |
| 101 | 95 |
| 102 // This holds the ResourceContext until Init() can be called from the | 96 // This holds the ResourceContext until Init() can be called from the |
| 103 // IO thread, which will extract the net::URLRequestContext from it. | 97 // IO thread, which will extract the net::URLRequestContext from it. |
| 104 const content::ResourceContext* resource_context_; | 98 const content::ResourceContext* resource_context_; |
| 105 net::URLRequestContext* request_context_; | 99 net::URLRequestContext* request_context_; |
| 106 | 100 |
| 107 DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcherHost); | 101 DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcherHost); |
| 108 }; | 102 }; |
| 109 | 103 |
| 110 #endif // CONTENT_BROWSER_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_HOST_H_ | 104 #endif // CONTENT_BROWSER_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_HOST_H_ |
| OLD | NEW |