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/operations/get_metadata.h
" | 5 #include "chrome/browser/chromeos/file_system_provider/operations/get_metadata.h
" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "chrome/common/extensions/api/file_system_provider.h" | 9 #include "chrome/common/extensions/api/file_system_provider.h" |
10 #include "chrome/common/extensions/api/file_system_provider_internal.h" | 10 #include "chrome/common/extensions/api/file_system_provider_internal.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 &output->last_modified); | 41 &output->last_modified); |
42 | 42 |
43 return true; | 43 return true; |
44 } | 44 } |
45 | 45 |
46 } // namespace | 46 } // namespace |
47 | 47 |
48 GetMetadata::GetMetadata( | 48 GetMetadata::GetMetadata( |
49 extensions::EventRouter* event_router, | 49 extensions::EventRouter* event_router, |
50 const ProvidedFileSystemInfo& file_system_info, | 50 const ProvidedFileSystemInfo& file_system_info, |
51 const base::FilePath& directory_path, | 51 const base::FilePath& entry_path, |
52 const fileapi::AsyncFileUtil::GetFileInfoCallback& callback) | 52 const fileapi::AsyncFileUtil::GetFileInfoCallback& callback) |
53 : Operation(event_router, file_system_info), | 53 : Operation(event_router, file_system_info), |
54 directory_path_(directory_path), | 54 entry_path_(entry_path), |
55 callback_(callback) { | 55 callback_(callback) { |
56 } | 56 } |
57 | 57 |
58 GetMetadata::~GetMetadata() { | 58 GetMetadata::~GetMetadata() { |
59 } | 59 } |
60 | 60 |
61 bool GetMetadata::Execute(int request_id) { | 61 bool GetMetadata::Execute(int request_id) { |
62 scoped_ptr<base::ListValue> values(new base::ListValue); | 62 scoped_ptr<base::DictionaryValue> values(new base::DictionaryValue); |
63 values->AppendString(directory_path_.AsUTF8Unsafe()); | 63 values->SetString("entryPath", entry_path_.AsUTF8Unsafe()); |
64 return SendEvent( | 64 return SendEvent( |
65 request_id, | 65 request_id, |
66 extensions::api::file_system_provider::OnGetMetadataRequested::kEventName, | 66 extensions::api::file_system_provider::OnGetMetadataRequested::kEventName, |
67 values.Pass()); | 67 values.Pass()); |
68 } | 68 } |
69 | 69 |
70 void GetMetadata::OnSuccess(int /* request_id */, | 70 void GetMetadata::OnSuccess(int /* request_id */, |
71 scoped_ptr<RequestValue> result, | 71 scoped_ptr<RequestValue> result, |
72 bool has_more) { | 72 bool has_more) { |
73 base::File::Info file_info; | 73 base::File::Info file_info; |
74 const bool convert_result = | 74 const bool convert_result = |
75 ConvertRequestValueToFileInfo(result.Pass(), &file_info); | 75 ConvertRequestValueToFileInfo(result.Pass(), &file_info); |
76 DCHECK(convert_result); | 76 DCHECK(convert_result); |
77 callback_.Run(base::File::FILE_OK, file_info); | 77 callback_.Run(base::File::FILE_OK, file_info); |
78 } | 78 } |
79 | 79 |
80 void GetMetadata::OnError(int /* request_id */, base::File::Error error) { | 80 void GetMetadata::OnError(int /* request_id */, base::File::Error error) { |
81 callback_.Run(error, base::File::Info()); | 81 callback_.Run(error, base::File::Info()); |
82 } | 82 } |
83 | 83 |
84 } // namespace operations | 84 } // namespace operations |
85 } // namespace file_system_provider | 85 } // namespace file_system_provider |
86 } // namespace chromeos | 86 } // namespace chromeos |
OLD | NEW |