| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/chromeos/file_system_provider/provided_file_system.h" | 5 #include "chrome/browser/chromeos/file_system_provider/provided_file_system.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/files/file.h" | 8 #include "base/files/file.h" |
| 9 #include "chrome/browser/chromeos/file_system_provider/notification_manager.h" | 9 #include "chrome/browser/chromeos/file_system_provider/notification_manager.h" |
| 10 #include "chrome/browser/chromeos/file_system_provider/operations/close_file.h" | 10 #include "chrome/browser/chromeos/file_system_provider/operations/close_file.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 length, | 92 length, |
| 93 callback)))) { | 93 callback)))) { |
| 94 callback.Run(0 /* chunk_length */, | 94 callback.Run(0 /* chunk_length */, |
| 95 false /* has_more */, | 95 false /* has_more */, |
| 96 base::File::FILE_ERROR_SECURITY); | 96 base::File::FILE_ERROR_SECURITY); |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 | 99 |
| 100 void ProvidedFileSystem::OpenFile(const base::FilePath& file_path, | 100 void ProvidedFileSystem::OpenFile(const base::FilePath& file_path, |
| 101 OpenFileMode mode, | 101 OpenFileMode mode, |
| 102 bool create, | |
| 103 const OpenFileCallback& callback) { | 102 const OpenFileCallback& callback) { |
| 104 // Writing is not supported. Note, that this includes a situation, when a file | 103 // Writing is not supported. |
| 105 // exists, but |create| is set to true. | 104 if (mode == OPEN_FILE_MODE_WRITE) { |
| 106 if (mode == OPEN_FILE_MODE_WRITE || create) { | |
| 107 callback.Run(0 /* file_handle */, base::File::FILE_ERROR_SECURITY); | 105 callback.Run(0 /* file_handle */, base::File::FILE_ERROR_SECURITY); |
| 108 return; | 106 return; |
| 109 } | 107 } |
| 110 | 108 |
| 111 if (!request_manager_.CreateRequest( | 109 if (!request_manager_.CreateRequest( |
| 112 OPEN_FILE, | 110 OPEN_FILE, |
| 113 scoped_ptr<RequestManager::HandlerInterface>( | 111 scoped_ptr<RequestManager::HandlerInterface>( |
| 114 new operations::OpenFile(event_router_, | 112 new operations::OpenFile(event_router_, |
| 115 file_system_info_, | 113 file_system_info_, |
| 116 file_path, | 114 file_path, |
| 117 mode, | 115 mode, |
| 118 create, | |
| 119 callback)))) { | 116 callback)))) { |
| 120 callback.Run(0 /* file_handle */, base::File::FILE_ERROR_SECURITY); | 117 callback.Run(0 /* file_handle */, base::File::FILE_ERROR_SECURITY); |
| 121 } | 118 } |
| 122 } | 119 } |
| 123 | 120 |
| 124 void ProvidedFileSystem::CloseFile( | 121 void ProvidedFileSystem::CloseFile( |
| 125 int file_handle, | 122 int file_handle, |
| 126 const fileapi::AsyncFileUtil::StatusCallback& callback) { | 123 const fileapi::AsyncFileUtil::StatusCallback& callback) { |
| 127 if (!request_manager_.CreateRequest( | 124 if (!request_manager_.CreateRequest( |
| 128 CLOSE_FILE, | 125 CLOSE_FILE, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 140 RequestManager* ProvidedFileSystem::GetRequestManager() { | 137 RequestManager* ProvidedFileSystem::GetRequestManager() { |
| 141 return &request_manager_; | 138 return &request_manager_; |
| 142 } | 139 } |
| 143 | 140 |
| 144 base::WeakPtr<ProvidedFileSystemInterface> ProvidedFileSystem::GetWeakPtr() { | 141 base::WeakPtr<ProvidedFileSystemInterface> ProvidedFileSystem::GetWeakPtr() { |
| 145 return weak_ptr_factory_.GetWeakPtr(); | 142 return weak_ptr_factory_.GetWeakPtr(); |
| 146 } | 143 } |
| 147 | 144 |
| 148 } // namespace file_system_provider | 145 } // namespace file_system_provider |
| 149 } // namespace chromeos | 146 } // namespace chromeos |
| OLD | NEW |