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

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

Issue 824753003: [fsp] Wire limiting number of opened files to FSP API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed. Created 5 years, 11 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/file_system_provider/throttled_file_system_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include <vector> 8 #include <vector>
9 9
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 SetError(FileErrorToString(base::File::FILE_ERROR_INVALID_OPERATION)); 80 SetError(FileErrorToString(base::File::FILE_ERROR_INVALID_OPERATION));
81 return false; 81 return false;
82 } 82 }
83 83
84 // It's an error if the display name is empty. 84 // It's an error if the display name is empty.
85 if (params->options.display_name.empty()) { 85 if (params->options.display_name.empty()) {
86 SetError(FileErrorToString(base::File::FILE_ERROR_INVALID_OPERATION)); 86 SetError(FileErrorToString(base::File::FILE_ERROR_INVALID_OPERATION));
87 return false; 87 return false;
88 } 88 }
89 89
90 // If the opened files limit is set, then it must be larger or equal than 0.
91 if (params->options.opened_files_limit.get() &&
92 *params->options.opened_files_limit.get() < 0) {
93 SetError(FileErrorToString(base::File::FILE_ERROR_INVALID_OPERATION));
94 return false;
95 }
96
90 Service* const service = Service::Get(GetProfile()); 97 Service* const service = Service::Get(GetProfile());
91 DCHECK(service); 98 DCHECK(service);
92 99
93 MountOptions options; 100 MountOptions options;
94 options.file_system_id = params->options.file_system_id; 101 options.file_system_id = params->options.file_system_id;
95 options.display_name = params->options.display_name; 102 options.display_name = params->options.display_name;
96 options.writable = params->options.writable; 103 options.writable = params->options.writable;
104 options.opened_files_limit = params->options.opened_files_limit.get()
105 ? *params->options.opened_files_limit.get()
106 : 0;
97 options.supports_notify_tag = params->options.supports_notify_tag; 107 options.supports_notify_tag = params->options.supports_notify_tag;
98 108
99 const base::File::Error result = 109 const base::File::Error result =
100 service->MountFileSystem(extension_id(), options); 110 service->MountFileSystem(extension_id(), options);
101 if (result != base::File::FILE_OK) { 111 if (result != base::File::FILE_OK) {
102 SetError(FileErrorToString(result)); 112 SetError(FileErrorToString(result));
103 return false; 113 return false;
104 } 114 }
105 115
106 return true; 116 return true;
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 using api::file_system_provider_internal::OperationRequestedError::Params; 282 using api::file_system_provider_internal::OperationRequestedError::Params;
273 scoped_ptr<Params> params(Params::Create(*args_)); 283 scoped_ptr<Params> params(Params::Create(*args_));
274 EXTENSION_FUNCTION_VALIDATE(params); 284 EXTENSION_FUNCTION_VALIDATE(params);
275 285
276 const base::File::Error error = ProviderErrorToFileError(params->error); 286 const base::File::Error error = ProviderErrorToFileError(params->error);
277 return RejectRequest(RequestValue::CreateForOperationError(params.Pass()), 287 return RejectRequest(RequestValue::CreateForOperationError(params.Pass()),
278 error); 288 error);
279 } 289 }
280 290
281 } // namespace extensions 291 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/file_system_provider/throttled_file_system_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698