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

Side by Side Diff: chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc

Issue 335753004: [fsp] Cleanup handling errors for operation requests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 years, 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/extensions/file_system_provider/file_system_pr ovider_api.h" 5 #include "chrome/browser/chromeos/extensions/file_system_provider/file_system_pr ovider_api.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 bool FileSystemProviderInternalUnmountRequestedSuccessFunction::RunWhenValid() { 90 bool FileSystemProviderInternalUnmountRequestedSuccessFunction::RunWhenValid() {
91 using api::file_system_provider_internal::UnmountRequestedSuccess::Params; 91 using api::file_system_provider_internal::UnmountRequestedSuccess::Params;
92 scoped_ptr<Params> params(Params::Create(*args_)); 92 scoped_ptr<Params> params(Params::Create(*args_));
93 EXTENSION_FUNCTION_VALIDATE(params); 93 EXTENSION_FUNCTION_VALIDATE(params);
94 94
95 FulfillRequest(RequestValue::CreateForUnmountSuccess(params.Pass()), 95 FulfillRequest(RequestValue::CreateForUnmountSuccess(params.Pass()),
96 false /* has_more */); 96 false /* has_more */);
97 return true; 97 return true;
98 } 98 }
99 99
100 bool FileSystemProviderInternalUnmountRequestedErrorFunction::RunWhenValid() {
101 using api::file_system_provider_internal::UnmountRequestedError::Params;
102 const scoped_ptr<Params> params(Params::Create(*args_));
103 EXTENSION_FUNCTION_VALIDATE(params);
104
105 RejectRequest(ProviderErrorToFileError(params->error));
106 return true;
107 }
108
109 bool 100 bool
110 FileSystemProviderInternalGetMetadataRequestedSuccessFunction::RunWhenValid() { 101 FileSystemProviderInternalGetMetadataRequestedSuccessFunction::RunWhenValid() {
111 using api::file_system_provider_internal::GetMetadataRequestedSuccess::Params; 102 using api::file_system_provider_internal::GetMetadataRequestedSuccess::Params;
112 scoped_ptr<Params> params(Params::Create(*args_)); 103 scoped_ptr<Params> params(Params::Create(*args_));
113 EXTENSION_FUNCTION_VALIDATE(params); 104 EXTENSION_FUNCTION_VALIDATE(params);
114 105
115 FulfillRequest(RequestValue::CreateForGetMetadataSuccess(params.Pass()), 106 FulfillRequest(RequestValue::CreateForGetMetadataSuccess(params.Pass()),
116 false /* has_more */); 107 false /* has_more */);
117 return true; 108 return true;
118 } 109 }
119 110
120 bool
121 FileSystemProviderInternalGetMetadataRequestedErrorFunction::RunWhenValid() {
122 using api::file_system_provider_internal::GetMetadataRequestedError::Params;
123 const scoped_ptr<Params> params(Params::Create(*args_));
124 EXTENSION_FUNCTION_VALIDATE(params);
125
126 RejectRequest(ProviderErrorToFileError(params->error));
127 return true;
128 }
129
130 bool FileSystemProviderInternalReadDirectoryRequestedSuccessFunction:: 111 bool FileSystemProviderInternalReadDirectoryRequestedSuccessFunction::
131 RunWhenValid() { 112 RunWhenValid() {
132 using api::file_system_provider_internal::ReadDirectoryRequestedSuccess:: 113 using api::file_system_provider_internal::ReadDirectoryRequestedSuccess::
133 Params; 114 Params;
134 scoped_ptr<Params> params(Params::Create(*args_)); 115 scoped_ptr<Params> params(Params::Create(*args_));
135 EXTENSION_FUNCTION_VALIDATE(params); 116 EXTENSION_FUNCTION_VALIDATE(params);
136 117
137 const bool has_more = params->has_more; 118 const bool has_more = params->has_more;
138 FulfillRequest(RequestValue::CreateForReadDirectorySuccess(params.Pass()), 119 FulfillRequest(RequestValue::CreateForReadDirectorySuccess(params.Pass()),
139 has_more); 120 has_more);
140 return true; 121 return true;
141 } 122 }
142 123
143 bool 124 bool
144 FileSystemProviderInternalReadDirectoryRequestedErrorFunction::RunWhenValid() {
145 using api::file_system_provider_internal::ReadDirectoryRequestedError::Params;
146 const scoped_ptr<Params> params(Params::Create(*args_));
147 EXTENSION_FUNCTION_VALIDATE(params);
148
149 RejectRequest(ProviderErrorToFileError(params->error));
150 return true;
151 }
152
153 bool
154 FileSystemProviderInternalOpenFileRequestedSuccessFunction::RunWhenValid() { 125 FileSystemProviderInternalOpenFileRequestedSuccessFunction::RunWhenValid() {
155 using api::file_system_provider_internal::OpenFileRequestedSuccess::Params; 126 using api::file_system_provider_internal::OpenFileRequestedSuccess::Params;
156 scoped_ptr<Params> params(Params::Create(*args_)); 127 scoped_ptr<Params> params(Params::Create(*args_));
157 EXTENSION_FUNCTION_VALIDATE(params); 128 EXTENSION_FUNCTION_VALIDATE(params);
158 129
159 FulfillRequest(scoped_ptr<RequestValue>(new RequestValue()), 130 FulfillRequest(scoped_ptr<RequestValue>(new RequestValue()),
160 false /* has_more */); 131 false /* has_more */);
161 return true; 132 return true;
162 } 133 }
163 134
164 bool FileSystemProviderInternalOpenFileRequestedErrorFunction::RunWhenValid() {
165 using api::file_system_provider_internal::OpenFileRequestedError::Params;
166 const scoped_ptr<Params> params(Params::Create(*args_));
167 EXTENSION_FUNCTION_VALIDATE(params);
168
169 RejectRequest(ProviderErrorToFileError(params->error));
170 return true;
171 }
172
173 bool 135 bool
174 FileSystemProviderInternalCloseFileRequestedSuccessFunction::RunWhenValid() { 136 FileSystemProviderInternalCloseFileRequestedSuccessFunction::RunWhenValid() {
175 using api::file_system_provider_internal::CloseFileRequestedSuccess::Params; 137 using api::file_system_provider_internal::CloseFileRequestedSuccess::Params;
176 scoped_ptr<Params> params(Params::Create(*args_)); 138 scoped_ptr<Params> params(Params::Create(*args_));
177 EXTENSION_FUNCTION_VALIDATE(params); 139 EXTENSION_FUNCTION_VALIDATE(params);
178 140
179 FulfillRequest(scoped_ptr<RequestValue>(new RequestValue()), 141 FulfillRequest(scoped_ptr<RequestValue>(new RequestValue()),
180 false /* has_more */); 142 false /* has_more */);
181 return true; 143 return true;
182 } 144 }
183 145
184 bool FileSystemProviderInternalCloseFileRequestedErrorFunction::RunWhenValid() {
185 using api::file_system_provider_internal::CloseFileRequestedError::Params;
186 const scoped_ptr<Params> params(Params::Create(*args_));
187 EXTENSION_FUNCTION_VALIDATE(params);
188
189 RejectRequest(ProviderErrorToFileError(params->error));
190 return true;
191 }
192
193 bool 146 bool
194 FileSystemProviderInternalReadFileRequestedSuccessFunction::RunWhenValid() { 147 FileSystemProviderInternalReadFileRequestedSuccessFunction::RunWhenValid() {
195 using api::file_system_provider_internal::ReadFileRequestedSuccess::Params; 148 using api::file_system_provider_internal::ReadFileRequestedSuccess::Params;
196 scoped_ptr<Params> params(Params::Create(*args_)); 149 scoped_ptr<Params> params(Params::Create(*args_));
197 EXTENSION_FUNCTION_VALIDATE(params); 150 EXTENSION_FUNCTION_VALIDATE(params);
198 151
199 const bool has_more = params->has_more; 152 const bool has_more = params->has_more;
200 FulfillRequest(RequestValue::CreateForReadFileSuccess(params.Pass()), 153 FulfillRequest(RequestValue::CreateForReadFileSuccess(params.Pass()),
201 has_more); 154 has_more);
202 return true; 155 return true;
203 } 156 }
204 157
205 bool FileSystemProviderInternalReadFileRequestedErrorFunction::RunWhenValid() { 158 bool FileSystemProviderInternalOperationRequestedErrorFunction::RunWhenValid() {
206 using api::file_system_provider_internal::ReadFileRequestedError::Params; 159 using api::file_system_provider_internal::OperationRequestedError::Params;
207 const scoped_ptr<Params> params(Params::Create(*args_)); 160 scoped_ptr<Params> params(Params::Create(*args_));
208 EXTENSION_FUNCTION_VALIDATE(params); 161 EXTENSION_FUNCTION_VALIDATE(params);
209 162 RejectRequest(RequestValue::CreateForOperationError(params.Pass()),
210 RejectRequest(ProviderErrorToFileError(params->error)); 163 ProviderErrorToFileError(params->error));
211 return true; 164 return true;
212 } 165 }
213 166
214 } // namespace extensions 167 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698