Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: chrome/browser/chromeos/file_system_provider/fake_provided_file_system.cc

Issue 258783006: [fsp] Add the getMetadata operation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/files/file.h" 7 #include "base/files/file.h"
8 #include "base/message_loop/message_loop_proxy.h" 8 #include "base/message_loop/message_loop_proxy.h"
9 #include "extensions/browser/event_router.h" 9 #include "extensions/browser/event_router.h"
10 10
11 namespace chromeos { 11 namespace chromeos {
12 namespace file_system_provider { 12 namespace file_system_provider {
13 13
14 FakeProvidedFileSystem::FakeProvidedFileSystem( 14 FakeProvidedFileSystem::FakeProvidedFileSystem(
15 const ProvidedFileSystemInfo& file_system_info) 15 const ProvidedFileSystemInfo& file_system_info)
16 : file_system_info_(file_system_info) { 16 : file_system_info_(file_system_info) {
17 } 17 }
18 18
19 FakeProvidedFileSystem::~FakeProvidedFileSystem() {} 19 FakeProvidedFileSystem::~FakeProvidedFileSystem() {}
20 20
21 void FakeProvidedFileSystem::RequestUnmount( 21 void FakeProvidedFileSystem::RequestUnmount(
22 const fileapi::AsyncFileUtil::StatusCallback& callback) { 22 const fileapi::AsyncFileUtil::StatusCallback& callback) {
23 base::MessageLoopProxy::current()->PostTask( 23 base::MessageLoopProxy::current()->PostTask(
24 FROM_HERE, base::Bind(callback, base::File::FILE_OK)); 24 FROM_HERE, base::Bind(callback, base::File::FILE_OK));
25 } 25 }
26 26
27 void FakeProvidedFileSystem::GetMetadata(
28 const base::FilePath& entry_path,
29 const fileapi::AsyncFileUtil::GetFileInfoCallback& callback) {
30 // Return fake metadata for the root directory only.
31 if (entry_path.AsUTF8Unsafe() != "/") {
32 base::MessageLoopProxy::current()->PostTask(
33 FROM_HERE,
34 base::Bind(
35 callback, base::File::FILE_ERROR_NOT_FOUND, base::File::Info()));
36 return;
37 }
38
39 base::File::Info file_info;
40 file_info.size = 0;
41 file_info.is_directory = true;
42 file_info.is_symbolic_link = false;
43 base::Time last_modified_time;
44 const bool result = base::Time::FromString("Thu Apr 24 00:46:52 UTC 2014",
45 &last_modified_time);
46 DCHECK(result);
47 file_info.last_modified = last_modified_time;
48
49 base::MessageLoopProxy::current()->PostTask(
50 FROM_HERE, base::Bind(callback, base::File::FILE_OK, file_info));
51 }
52
27 const ProvidedFileSystemInfo& FakeProvidedFileSystem::GetFileSystemInfo() 53 const ProvidedFileSystemInfo& FakeProvidedFileSystem::GetFileSystemInfo()
28 const { 54 const {
29 return file_system_info_; 55 return file_system_info_;
30 } 56 }
31 57
32 RequestManager* FakeProvidedFileSystem::GetRequestManager() { 58 RequestManager* FakeProvidedFileSystem::GetRequestManager() {
33 NOTREACHED(); 59 NOTREACHED();
34 return NULL; 60 return NULL;
35 } 61 }
36 62
37 ProvidedFileSystemInterface* FakeProvidedFileSystem::Create( 63 ProvidedFileSystemInterface* FakeProvidedFileSystem::Create(
38 extensions::EventRouter* event_router, 64 extensions::EventRouter* event_router,
39 const ProvidedFileSystemInfo& file_system_info) { 65 const ProvidedFileSystemInfo& file_system_info) {
40 return new FakeProvidedFileSystem(file_system_info); 66 return new FakeProvidedFileSystem(file_system_info);
41 } 67 }
42 68
43 } // namespace file_system_provider 69 } // namespace file_system_provider
44 } // namespace chromeos 70 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698