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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 0 /* size */, | 111 0 /* size */, |
112 "Tue May 22 00:40:50 UTC 2014"); | 112 "Tue May 22 00:40:50 UTC 2014"); |
113 | 113 |
114 base::MessageLoopProxy::current()->PostTask( | 114 base::MessageLoopProxy::current()->PostTask( |
115 FROM_HERE, | 115 FROM_HERE, |
116 base::Bind( | 116 base::Bind( |
117 callback, base::File::FILE_OK, entry_list, false /* has_more */)); | 117 callback, base::File::FILE_OK, entry_list, false /* has_more */)); |
118 } | 118 } |
119 } | 119 } |
120 | 120 |
| 121 void FakeProvidedFileSystem::OpenFile( |
| 122 const base::FilePath& file_path, |
| 123 OpenFileMode mode, |
| 124 bool create, |
| 125 const fileapi::AsyncFileUtil::StatusCallback& callback) { |
| 126 if (file_path.AsUTF8Unsafe() != "/hello.txt" || |
| 127 mode == OPEN_FILE_MODE_WRITE || create) { |
| 128 callback.Run(base::File::FILE_ERROR_SECURITY); |
| 129 return; |
| 130 } |
| 131 |
| 132 callback.Run(base::File::FILE_OK); |
| 133 } |
| 134 |
121 const ProvidedFileSystemInfo& FakeProvidedFileSystem::GetFileSystemInfo() | 135 const ProvidedFileSystemInfo& FakeProvidedFileSystem::GetFileSystemInfo() |
122 const { | 136 const { |
123 return file_system_info_; | 137 return file_system_info_; |
124 } | 138 } |
125 | 139 |
126 RequestManager* FakeProvidedFileSystem::GetRequestManager() { | 140 RequestManager* FakeProvidedFileSystem::GetRequestManager() { |
127 NOTREACHED(); | 141 NOTREACHED(); |
128 return NULL; | 142 return NULL; |
129 } | 143 } |
130 | 144 |
131 ProvidedFileSystemInterface* FakeProvidedFileSystem::Create( | 145 ProvidedFileSystemInterface* FakeProvidedFileSystem::Create( |
132 extensions::EventRouter* event_router, | 146 extensions::EventRouter* event_router, |
133 const ProvidedFileSystemInfo& file_system_info) { | 147 const ProvidedFileSystemInfo& file_system_info) { |
134 return new FakeProvidedFileSystem(file_system_info); | 148 return new FakeProvidedFileSystem(file_system_info); |
135 } | 149 } |
136 | 150 |
137 } // namespace file_system_provider | 151 } // namespace file_system_provider |
138 } // namespace chromeos | 152 } // namespace chromeos |
OLD | NEW |