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

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

Issue 252653002: Rename (Chrome)SyncExtensionFunction::RunImpl to RunSync so that the RunImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte rface.h" 10 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte rface.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 case api::file_system_provider::PROVIDER_ERROR_IO: 81 case api::file_system_provider::PROVIDER_ERROR_IO:
82 return base::File::FILE_ERROR_IO; 82 return base::File::FILE_ERROR_IO;
83 default: 83 default:
84 NOTREACHED(); 84 NOTREACHED();
85 } 85 }
86 return base::File::FILE_ERROR_FAILED; 86 return base::File::FILE_ERROR_FAILED;
87 } 87 }
88 88
89 } // namespace 89 } // namespace
90 90
91 bool FileSystemProviderMountFunction::RunImpl() { 91 bool FileSystemProviderMountFunction::RunSync() {
92 using api::file_system_provider::Mount::Params; 92 using api::file_system_provider::Mount::Params;
93 const scoped_ptr<Params> params(Params::Create(*args_)); 93 const scoped_ptr<Params> params(Params::Create(*args_));
94 EXTENSION_FUNCTION_VALIDATE(params); 94 EXTENSION_FUNCTION_VALIDATE(params);
95 95
96 // It's an error if the display name is empty. 96 // It's an error if the display name is empty.
97 if (params->display_name.empty()) { 97 if (params->display_name.empty()) {
98 base::ListValue* result = new base::ListValue(); 98 base::ListValue* result = new base::ListValue();
99 result->Append(new base::StringValue("")); 99 result->Append(new base::StringValue(""));
100 result->Append(CreateError(kSecurityErrorName, 100 result->Append(CreateError(kSecurityErrorName,
101 kEmptyNameErrorMessage)); 101 kEmptyNameErrorMessage));
(...skipping 19 matching lines...) Expand all
121 } 121 }
122 122
123 base::ListValue* result = new base::ListValue(); 123 base::ListValue* result = new base::ListValue();
124 result->Append(new base::FundamentalValue(file_system_id)); 124 result->Append(new base::FundamentalValue(file_system_id));
125 // Don't append an error on success. 125 // Don't append an error on success.
126 126
127 SetResult(result); 127 SetResult(result);
128 return true; 128 return true;
129 } 129 }
130 130
131 bool FileSystemProviderUnmountFunction::RunImpl() { 131 bool FileSystemProviderUnmountFunction::RunSync() {
132 using api::file_system_provider::Unmount::Params; 132 using api::file_system_provider::Unmount::Params;
133 const scoped_ptr<Params> params(Params::Create(*args_)); 133 const scoped_ptr<Params> params(Params::Create(*args_));
134 EXTENSION_FUNCTION_VALIDATE(params); 134 EXTENSION_FUNCTION_VALIDATE(params);
135 135
136 Service* service = Service::Get(GetProfile()); 136 Service* service = Service::Get(GetProfile());
137 DCHECK(service); 137 DCHECK(service);
138 138
139 if (!service->UnmountFileSystem(extension_id(), params->file_system_id)) { 139 if (!service->UnmountFileSystem(extension_id(), params->file_system_id)) {
140 // TODO(mtomasz): Pass more detailed errors, rather than just a bool. 140 // TODO(mtomasz): Pass more detailed errors, rather than just a bool.
141 base::ListValue* result = new base::ListValue(); 141 base::ListValue* result = new base::ListValue();
142 result->Append(CreateError(kSecurityErrorName, kUnmountFailedErrorMessage)); 142 result->Append(CreateError(kSecurityErrorName, kUnmountFailedErrorMessage));
143 SetResult(result); 143 SetResult(result);
144 return false; 144 return false;
145 } 145 }
146 146
147 base::ListValue* result = new base::ListValue(); 147 base::ListValue* result = new base::ListValue();
148 SetResult(result); 148 SetResult(result);
149 return true; 149 return true;
150 } 150 }
151 151
152 bool FileSystemProviderInternalUnmountRequestedSuccessFunction::RunImpl() { 152 bool FileSystemProviderInternalUnmountRequestedSuccessFunction::RunSync() {
153 using api::file_system_provider_internal::UnmountRequestedSuccess::Params; 153 using api::file_system_provider_internal::UnmountRequestedSuccess::Params;
154 const scoped_ptr<Params> params(Params::Create(*args_)); 154 const scoped_ptr<Params> params(Params::Create(*args_));
155 EXTENSION_FUNCTION_VALIDATE(params); 155 EXTENSION_FUNCTION_VALIDATE(params);
156 156
157 Service* service = Service::Get(GetProfile()); 157 Service* service = Service::Get(GetProfile());
158 DCHECK(service); 158 DCHECK(service);
159 159
160 ProvidedFileSystemInterface* file_system = 160 ProvidedFileSystemInterface* file_system =
161 service->GetProvidedFileSystem(extension_id(), params->file_system_id); 161 service->GetProvidedFileSystem(extension_id(), params->file_system_id);
162 if (!file_system) { 162 if (!file_system) {
(...skipping 16 matching lines...) Expand all
179 CreateError(kSecurityErrorName, kResponseFailedErrorMessage)); 179 CreateError(kSecurityErrorName, kResponseFailedErrorMessage));
180 SetResult(result); 180 SetResult(result);
181 return false; 181 return false;
182 } 182 }
183 183
184 base::ListValue* result = new base::ListValue(); 184 base::ListValue* result = new base::ListValue();
185 SetResult(result); 185 SetResult(result);
186 return true; 186 return true;
187 } 187 }
188 188
189 bool FileSystemProviderInternalUnmountRequestedErrorFunction::RunImpl() { 189 bool FileSystemProviderInternalUnmountRequestedErrorFunction::RunSync() {
190 using api::file_system_provider_internal::UnmountRequestedError::Params; 190 using api::file_system_provider_internal::UnmountRequestedError::Params;
191 const scoped_ptr<Params> params(Params::Create(*args_)); 191 const scoped_ptr<Params> params(Params::Create(*args_));
192 EXTENSION_FUNCTION_VALIDATE(params); 192 EXTENSION_FUNCTION_VALIDATE(params);
193 193
194 Service* service = Service::Get(GetProfile()); 194 Service* service = Service::Get(GetProfile());
195 DCHECK(service); 195 DCHECK(service);
196 196
197 ProvidedFileSystemInterface* file_system = 197 ProvidedFileSystemInterface* file_system =
198 service->GetProvidedFileSystem(extension_id(), params->file_system_id); 198 service->GetProvidedFileSystem(extension_id(), params->file_system_id);
199 if (!file_system) { 199 if (!file_system) {
(...skipping 16 matching lines...) Expand all
216 SetResult(result); 216 SetResult(result);
217 return false; 217 return false;
218 } 218 }
219 219
220 base::ListValue* result = new base::ListValue(); 220 base::ListValue* result = new base::ListValue();
221 SetResult(result); 221 SetResult(result);
222 return true; 222 return true;
223 } 223 }
224 224
225 } // namespace extensions 225 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698