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/fake_provided_file_system
.h" | 5 #include "chrome/browser/chromeos/file_system_provider/fake_provided_file_system
.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 135 |
136 base::MessageLoopProxy::current()->PostTask( | 136 base::MessageLoopProxy::current()->PostTask( |
137 FROM_HERE, | 137 FROM_HERE, |
138 base::Bind( | 138 base::Bind( |
139 callback, base::File::FILE_OK, entry_list, false /* has_more */)); | 139 callback, base::File::FILE_OK, entry_list, false /* has_more */)); |
140 } | 140 } |
141 } | 141 } |
142 | 142 |
143 void FakeProvidedFileSystem::OpenFile(const base::FilePath& file_path, | 143 void FakeProvidedFileSystem::OpenFile(const base::FilePath& file_path, |
144 OpenFileMode mode, | 144 OpenFileMode mode, |
145 bool create, | |
146 const OpenFileCallback& callback) { | 145 const OpenFileCallback& callback) { |
147 if (mode == OPEN_FILE_MODE_WRITE || create) { | 146 if (mode == OPEN_FILE_MODE_WRITE) { |
148 base::MessageLoopProxy::current()->PostTask( | 147 base::MessageLoopProxy::current()->PostTask( |
149 FROM_HERE, | 148 FROM_HERE, |
150 base::Bind(callback, | 149 base::Bind(callback, |
151 0 /* file_handle */, | 150 0 /* file_handle */, |
152 base::File::FILE_ERROR_ACCESS_DENIED)); | 151 base::File::FILE_ERROR_ACCESS_DENIED)); |
153 } | 152 } |
154 | 153 |
155 if (file_path.AsUTF8Unsafe() != "/hello.txt") { | 154 if (file_path.AsUTF8Unsafe() != "/hello.txt") { |
156 base::MessageLoopProxy::current()->PostTask( | 155 base::MessageLoopProxy::current()->PostTask( |
157 FROM_HERE, | 156 FROM_HERE, |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 return new FakeProvidedFileSystem(file_system_info); | 243 return new FakeProvidedFileSystem(file_system_info); |
245 } | 244 } |
246 | 245 |
247 base::WeakPtr<ProvidedFileSystemInterface> | 246 base::WeakPtr<ProvidedFileSystemInterface> |
248 FakeProvidedFileSystem::GetWeakPtr() { | 247 FakeProvidedFileSystem::GetWeakPtr() { |
249 return weak_ptr_factory_.GetWeakPtr(); | 248 return weak_ptr_factory_.GetWeakPtr(); |
250 } | 249 } |
251 | 250 |
252 } // namespace file_system_provider | 251 } // namespace file_system_provider |
253 } // namespace chromeos | 252 } // namespace chromeos |
OLD | NEW |