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

Side by Side Diff: webkit/plugins/ppapi/file_callbacks.cc

Issue 14796018: Cleanup: Deprecate FileSystemCallbackDispatcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "webkit/plugins/ppapi/file_callbacks.h" 5 #include "webkit/plugins/ppapi/file_callbacks.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "ppapi/c/pp_file_info.h" 9 #include "ppapi/c/pp_file_info.h"
10 #include "ppapi/c/pp_errors.h" 10 #include "ppapi/c/pp_errors.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 const ReadDirectoryEntriesParams& params) 50 const ReadDirectoryEntriesParams& params)
51 : callback_(callback), 51 : callback_(callback),
52 file_system_type_(PP_FILESYSTEMTYPE_INVALID), 52 file_system_type_(PP_FILESYSTEMTYPE_INVALID),
53 read_entries_dir_ref_(params.dir_ref), 53 read_entries_dir_ref_(params.dir_ref),
54 read_entries_files_(params.files), 54 read_entries_files_(params.files),
55 read_entries_file_types_(params.file_types) { 55 read_entries_file_types_(params.file_types) {
56 } 56 }
57 57
58 FileCallbacks::~FileCallbacks() {} 58 FileCallbacks::~FileCallbacks() {}
59 59
60 void FileCallbacks::DidSucceed() { 60 void FileCallbacks::DidFinish(base::PlatformFileError error_code) {
61 RunCallback(error_code);
62 }
63
64 void FileCallbacks::DidReadMetadata(
65 base::PlatformFileError error_code,
66 const base::PlatformFileInfo& file_info,
67 const base::FilePath& unused) {
68 if (error_code != base::PLATFORM_FILE_OK) {
69 RunCallback(error_code);
70 return;
71 }
72
61 if (callback_->completed()) 73 if (callback_->completed())
62 return; 74 return;
63 75
64 callback_->Run(PP_OK);
65 }
66
67 void FileCallbacks::DidReadMetadata(
68 const base::PlatformFileInfo& file_info,
69 const base::FilePath& unused) {
70 if (callback_->completed())
71 return;
72
73 DCHECK(info_.get()); 76 DCHECK(info_.get());
74 info_->size = file_info.size; 77 info_->size = file_info.size;
75 info_->creation_time = TimeToPPTime(file_info.creation_time); 78 info_->creation_time = TimeToPPTime(file_info.creation_time);
76 info_->last_access_time = TimeToPPTime(file_info.last_accessed); 79 info_->last_access_time = TimeToPPTime(file_info.last_accessed);
77 info_->last_modified_time = TimeToPPTime(file_info.last_modified); 80 info_->last_modified_time = TimeToPPTime(file_info.last_modified);
78 info_->system_type = file_system_type_; 81 info_->system_type = file_system_type_;
79 if (file_info.is_directory) 82 if (file_info.is_directory)
80 info_->type = PP_FILETYPE_DIRECTORY; 83 info_->type = PP_FILETYPE_DIRECTORY;
81 else 84 else
82 info_->type = PP_FILETYPE_REGULAR; 85 info_->type = PP_FILETYPE_REGULAR;
83 86
84 callback_->Run(PP_OK); 87 callback_->Run(PP_OK);
85 } 88 }
86 89
87 void FileCallbacks::DidCreateSnapshotFile( 90 void FileCallbacks::DidReadDirectory(
88 const base::PlatformFileInfo& file_info, 91 base::PlatformFileError error_code,
89 const base::FilePath& path) { 92 const std::vector<base::FileUtilProxy::Entry>& entries, bool has_more) {
yzshen1 2013/05/14 16:50:09 nit: put each parameter on a separate line, please
kinuko 2013/05/15 13:58:03 Done (in ppb_file_ref_impl.cc)
90 NOTREACHED(); 93 if (error_code != base::PLATFORM_FILE_OK) {
91 } 94 RunCallback(error_code);
95 return;
96 }
92 97
93 void FileCallbacks::DidReadDirectory(
94 const std::vector<base::FileUtilProxy::Entry>& entries, bool has_more) {
95 if (callback_->completed()) 98 if (callback_->completed())
96 return; 99 return;
97 100
98 // The current filesystem backend always returns false. 101 // The current filesystem backend always returns false.
99 DCHECK(!has_more); 102 DCHECK(!has_more);
100 103
101 DCHECK(read_entries_dir_ref_); 104 DCHECK(read_entries_dir_ref_);
102 DCHECK(read_entries_files_.get()); 105 DCHECK(read_entries_files_.get());
103 DCHECK(read_entries_file_types_.get()); 106 DCHECK(read_entries_file_types_.get());
104 107
(...skipping 11 matching lines...) Expand all
116 read_entries_file_types_->push_back( 119 read_entries_file_types_->push_back(
117 entry.is_directory ? PP_FILETYPE_DIRECTORY : PP_FILETYPE_REGULAR); 120 entry.is_directory ? PP_FILETYPE_DIRECTORY : PP_FILETYPE_REGULAR);
118 // Add a ref count on behalf of the plugin side. 121 // Add a ref count on behalf of the plugin side.
119 file_ref->GetReference(); 122 file_ref->GetReference();
120 } 123 }
121 CHECK_EQ(read_entries_files_->size(), read_entries_file_types_->size()); 124 CHECK_EQ(read_entries_files_->size(), read_entries_file_types_->size());
122 125
123 callback_->Run(PP_OK); 126 callback_->Run(PP_OK);
124 } 127 }
125 128
126 void FileCallbacks::DidOpenFileSystem(const std::string&,
127 const GURL& root_url) {
128 NOTREACHED();
129 }
130
131 void FileCallbacks::DidFail(base::PlatformFileError error_code) {
132 RunCallback(error_code);
133 }
134
135 void FileCallbacks::DidWrite(int64 bytes, bool complete) {
136 NOTREACHED();
137 }
138
139 void FileCallbacks::RunCallback(base::PlatformFileError error_code) { 129 void FileCallbacks::RunCallback(base::PlatformFileError error_code) {
140 if (callback_->completed()) 130 if (callback_->completed())
141 return; 131 return;
142 132
143 callback_->Run(::ppapi::PlatformFileErrorToPepperError(error_code)); 133 callback_->Run(::ppapi::PlatformFileErrorToPepperError(error_code));
144 } 134 }
145 135
146 } // namespace ppapi 136 } // namespace ppapi
147 } // namespace webkit 137 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698