| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "content/browser/file_system/file_system_dispatcher_host.h" | 5 #include "content/browser/file_system/file_system_dispatcher_host.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 request_id_, info, platform_path)); | 52 request_id_, info, platform_path)); |
| 53 } | 53 } |
| 54 | 54 |
| 55 virtual void DidReadDirectory( | 55 virtual void DidReadDirectory( |
| 56 const std::vector<base::FileUtilProxy::Entry>& entries, bool has_more) { | 56 const std::vector<base::FileUtilProxy::Entry>& entries, bool has_more) { |
| 57 dispatcher_host_->Send(new FileSystemMsg_DidReadDirectory( | 57 dispatcher_host_->Send(new FileSystemMsg_DidReadDirectory( |
| 58 request_id_, entries, has_more)); | 58 request_id_, entries, has_more)); |
| 59 } | 59 } |
| 60 | 60 |
| 61 virtual void DidOpenFileSystem(const std::string& name, | 61 virtual void DidOpenFileSystem(const std::string& name, |
| 62 const FilePath& path) { | 62 const GURL& root) { |
| 63 dispatcher_host_->Send( | 63 dispatcher_host_->Send( |
| 64 new FileSystemMsg_OpenComplete(request_id_, !path.empty(), name, path)); | 64 new FileSystemMsg_OpenComplete( |
| 65 request_id_, root.is_valid(), name, root)); |
| 65 } | 66 } |
| 66 | 67 |
| 67 virtual void DidFail(base::PlatformFileError error_code) { | 68 virtual void DidFail(base::PlatformFileError error_code) { |
| 68 dispatcher_host_->Send(new FileSystemMsg_DidFail(request_id_, error_code)); | 69 dispatcher_host_->Send(new FileSystemMsg_DidFail(request_id_, error_code)); |
| 69 } | 70 } |
| 70 | 71 |
| 71 virtual void DidWrite(int64 bytes, bool complete) { | 72 virtual void DidWrite(int64 bytes, bool complete) { |
| 72 dispatcher_host_->Send(new FileSystemMsg_DidWrite( | 73 dispatcher_host_->Send(new FileSystemMsg_DidWrite( |
| 73 request_id_, bytes, complete)); | 74 request_id_, bytes, complete)); |
| 74 } | 75 } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 ContentSetting content_setting = | 133 ContentSetting content_setting = |
| 133 host_content_settings_map_->GetContentSetting( | 134 host_content_settings_map_->GetContentSetting( |
| 134 origin_url, CONTENT_SETTINGS_TYPE_COOKIES, ""); | 135 origin_url, CONTENT_SETTINGS_TYPE_COOKIES, ""); |
| 135 DCHECK((content_setting == CONTENT_SETTING_ALLOW) || | 136 DCHECK((content_setting == CONTENT_SETTING_ALLOW) || |
| 136 (content_setting == CONTENT_SETTING_BLOCK) || | 137 (content_setting == CONTENT_SETTING_BLOCK) || |
| 137 (content_setting == CONTENT_SETTING_SESSION_ONLY)); | 138 (content_setting == CONTENT_SETTING_SESSION_ONLY)); |
| 138 if (content_setting == CONTENT_SETTING_BLOCK) { | 139 if (content_setting == CONTENT_SETTING_BLOCK) { |
| 139 // TODO(kinuko): Need to notify the UI thread to indicate that | 140 // TODO(kinuko): Need to notify the UI thread to indicate that |
| 140 // there's a blocked content. | 141 // there's a blocked content. |
| 141 Send(new FileSystemMsg_OpenComplete( | 142 Send(new FileSystemMsg_OpenComplete( |
| 142 request_id, false, std::string(), FilePath())); | 143 request_id, false, std::string(), GURL())); |
| 143 return; | 144 return; |
| 144 } | 145 } |
| 145 | 146 |
| 146 GetNewOperation(request_id)->OpenFileSystem(origin_url, type, create); | 147 GetNewOperation(request_id)->OpenFileSystem(origin_url, type, create); |
| 147 } | 148 } |
| 148 | 149 |
| 149 void FileSystemDispatcherHost::OnMove( | 150 void FileSystemDispatcherHost::OnMove( |
| 150 int request_id, const FilePath& src_path, const FilePath& dest_path) { | 151 int request_id, const GURL& src_path, const GURL& dest_path) { |
| 151 GetNewOperation(request_id)->Move(src_path, dest_path); | 152 GetNewOperation(request_id)->Move(src_path, dest_path); |
| 152 } | 153 } |
| 153 | 154 |
| 154 void FileSystemDispatcherHost::OnCopy( | 155 void FileSystemDispatcherHost::OnCopy( |
| 155 int request_id, const FilePath& src_path, const FilePath& dest_path) { | 156 int request_id, const GURL& src_path, const GURL& dest_path) { |
| 156 GetNewOperation(request_id)->Copy(src_path, dest_path); | 157 GetNewOperation(request_id)->Copy(src_path, dest_path); |
| 157 } | 158 } |
| 158 | 159 |
| 159 void FileSystemDispatcherHost::OnRemove( | 160 void FileSystemDispatcherHost::OnRemove( |
| 160 int request_id, const FilePath& path, bool recursive) { | 161 int request_id, const GURL& path, bool recursive) { |
| 161 GetNewOperation(request_id)->Remove(path, recursive); | 162 GetNewOperation(request_id)->Remove(path, recursive); |
| 162 } | 163 } |
| 163 | 164 |
| 164 void FileSystemDispatcherHost::OnReadMetadata( | 165 void FileSystemDispatcherHost::OnReadMetadata( |
| 165 int request_id, const FilePath& path) { | 166 int request_id, const GURL& path) { |
| 166 GetNewOperation(request_id)->GetMetadata(path); | 167 GetNewOperation(request_id)->GetMetadata(path); |
| 167 } | 168 } |
| 168 | 169 |
| 169 void FileSystemDispatcherHost::OnCreate( | 170 void FileSystemDispatcherHost::OnCreate( |
| 170 int request_id, const FilePath& path, bool exclusive, | 171 int request_id, const GURL& path, bool exclusive, |
| 171 bool is_directory, bool recursive) { | 172 bool is_directory, bool recursive) { |
| 172 if (is_directory) | 173 if (is_directory) |
| 173 GetNewOperation(request_id)->CreateDirectory(path, exclusive, recursive); | 174 GetNewOperation(request_id)->CreateDirectory(path, exclusive, recursive); |
| 174 else | 175 else |
| 175 GetNewOperation(request_id)->CreateFile(path, exclusive); | 176 GetNewOperation(request_id)->CreateFile(path, exclusive); |
| 176 } | 177 } |
| 177 | 178 |
| 178 void FileSystemDispatcherHost::OnExists( | 179 void FileSystemDispatcherHost::OnExists( |
| 179 int request_id, const FilePath& path, bool is_directory) { | 180 int request_id, const GURL& path, bool is_directory) { |
| 180 if (is_directory) | 181 if (is_directory) |
| 181 GetNewOperation(request_id)->DirectoryExists(path); | 182 GetNewOperation(request_id)->DirectoryExists(path); |
| 182 else | 183 else |
| 183 GetNewOperation(request_id)->FileExists(path); | 184 GetNewOperation(request_id)->FileExists(path); |
| 184 } | 185 } |
| 185 | 186 |
| 186 void FileSystemDispatcherHost::OnReadDirectory( | 187 void FileSystemDispatcherHost::OnReadDirectory( |
| 187 int request_id, const FilePath& path) { | 188 int request_id, const GURL& path) { |
| 188 GetNewOperation(request_id)->ReadDirectory(path); | 189 GetNewOperation(request_id)->ReadDirectory(path); |
| 189 } | 190 } |
| 190 | 191 |
| 191 void FileSystemDispatcherHost::OnWrite( | 192 void FileSystemDispatcherHost::OnWrite( |
| 192 int request_id, | 193 int request_id, |
| 193 const FilePath& path, | 194 const GURL& path, |
| 194 const GURL& blob_url, | 195 const GURL& blob_url, |
| 195 int64 offset) { | 196 int64 offset) { |
| 196 GetNewOperation(request_id)->Write( | 197 GetNewOperation(request_id)->Write( |
| 197 request_context_, path, blob_url, offset); | 198 request_context_, path, blob_url, offset); |
| 198 } | 199 } |
| 199 | 200 |
| 200 void FileSystemDispatcherHost::OnTruncate( | 201 void FileSystemDispatcherHost::OnTruncate( |
| 201 int request_id, | 202 int request_id, |
| 202 const FilePath& path, | 203 const GURL& path, |
| 203 int64 length) { | 204 int64 length) { |
| 204 GetNewOperation(request_id)->Truncate(path, length); | 205 GetNewOperation(request_id)->Truncate(path, length); |
| 205 } | 206 } |
| 206 | 207 |
| 207 void FileSystemDispatcherHost::OnTouchFile( | 208 void FileSystemDispatcherHost::OnTouchFile( |
| 208 int request_id, | 209 int request_id, |
| 209 const FilePath& path, | 210 const GURL& path, |
| 210 const base::Time& last_access_time, | 211 const base::Time& last_access_time, |
| 211 const base::Time& last_modified_time) { | 212 const base::Time& last_modified_time) { |
| 212 GetNewOperation(request_id)->TouchFile( | 213 GetNewOperation(request_id)->TouchFile( |
| 213 path, last_access_time, last_modified_time); | 214 path, last_access_time, last_modified_time); |
| 214 } | 215 } |
| 215 | 216 |
| 216 void FileSystemDispatcherHost::OnCancel( | 217 void FileSystemDispatcherHost::OnCancel( |
| 217 int request_id, | 218 int request_id, |
| 218 int request_id_to_cancel) { | 219 int request_id_to_cancel) { |
| 219 FileSystemOperation* write = operations_.Lookup( | 220 FileSystemOperation* write = operations_.Lookup( |
| (...skipping 19 matching lines...) Expand all Loading... |
| 239 context_, | 240 context_, |
| 240 NULL); | 241 NULL); |
| 241 operations_.AddWithID(operation, request_id); | 242 operations_.AddWithID(operation, request_id); |
| 242 return operation; | 243 return operation; |
| 243 } | 244 } |
| 244 | 245 |
| 245 void FileSystemDispatcherHost::UnregisterOperation(int request_id) { | 246 void FileSystemDispatcherHost::UnregisterOperation(int request_id) { |
| 246 DCHECK(operations_.Lookup(request_id)); | 247 DCHECK(operations_.Lookup(request_id)); |
| 247 operations_.Remove(request_id); | 248 operations_.Remove(request_id); |
| 248 } | 249 } |
| OLD | NEW |