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

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

Issue 624903002: [fsp] Group arguments for mounting into a struct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed a bug. Created 6 years, 2 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/fileapi/file_stream_reader_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"
11 #include "base/memory/linked_ptr.h" 11 #include "base/memory/linked_ptr.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte rface.h" 14 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte rface.h"
15 #include "chrome/browser/chromeos/file_system_provider/request_manager.h" 15 #include "chrome/browser/chromeos/file_system_provider/request_manager.h"
16 #include "chrome/browser/chromeos/file_system_provider/request_value.h" 16 #include "chrome/browser/chromeos/file_system_provider/request_value.h"
17 #include "chrome/browser/chromeos/file_system_provider/service.h" 17 #include "chrome/browser/chromeos/file_system_provider/service.h"
18 #include "chrome/common/extensions/api/file_system_provider.h" 18 #include "chrome/common/extensions/api/file_system_provider.h"
19 #include "chrome/common/extensions/api/file_system_provider_internal.h" 19 #include "chrome/common/extensions/api/file_system_provider_internal.h"
20 20
21 using chromeos::file_system_provider::MountOptions;
21 using chromeos::file_system_provider::ProvidedFileSystemInfo; 22 using chromeos::file_system_provider::ProvidedFileSystemInfo;
22 using chromeos::file_system_provider::ProvidedFileSystemInterface; 23 using chromeos::file_system_provider::ProvidedFileSystemInterface;
23 using chromeos::file_system_provider::RequestValue; 24 using chromeos::file_system_provider::RequestValue;
24 using chromeos::file_system_provider::Service; 25 using chromeos::file_system_provider::Service;
25 26
26 namespace extensions { 27 namespace extensions {
27 namespace { 28 namespace {
28 29
29 const char kNotifyFailedErrorMessage[] = 30 const char kNotifyFailedErrorMessage[] =
30 "Sending a response for the request failed."; 31 "Sending a response for the request failed.";
(...skipping 21 matching lines...) Expand all
52 kEmptyNameErrorMessage)); 53 kEmptyNameErrorMessage));
53 SetResult(result); 54 SetResult(result);
54 return true; 55 return true;
55 } 56 }
56 57
57 Service* const service = Service::Get(GetProfile()); 58 Service* const service = Service::Get(GetProfile());
58 DCHECK(service); 59 DCHECK(service);
59 if (!service) 60 if (!service)
60 return false; 61 return false;
61 62
63 MountOptions options;
64 options.file_system_id = params->options.file_system_id;
65 options.display_name = params->options.display_name;
66 options.writable = params->options.writable;
67 options.supports_notify_tag = params->options.supports_notify_tag;
68
62 // TODO(mtomasz): Pass more detailed errors, rather than just a bool. 69 // TODO(mtomasz): Pass more detailed errors, rather than just a bool.
63 if (!service->MountFileSystem(extension_id(), 70 if (!service->MountFileSystem(extension_id(), options)) {
64 params->options.file_system_id,
65 params->options.display_name,
66 params->options.writable,
67 params->options.supports_notify_tag)) {
68 base::ListValue* const result = new base::ListValue(); 71 base::ListValue* const result = new base::ListValue();
69 result->Append(CreateError(kSecurityErrorName, kMountFailedErrorMessage)); 72 result->Append(CreateError(kSecurityErrorName, kMountFailedErrorMessage));
70 SetResult(result); 73 SetResult(result);
71 return true; 74 return true;
72 } 75 }
73 76
74 base::ListValue* result = new base::ListValue(); 77 base::ListValue* result = new base::ListValue();
75 SetResult(result); 78 SetResult(result);
76 return true; 79 return true;
77 } 80 }
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 using api::file_system_provider_internal::OperationRequestedError::Params; 232 using api::file_system_provider_internal::OperationRequestedError::Params;
230 scoped_ptr<Params> params(Params::Create(*args_)); 233 scoped_ptr<Params> params(Params::Create(*args_));
231 EXTENSION_FUNCTION_VALIDATE(params); 234 EXTENSION_FUNCTION_VALIDATE(params);
232 235
233 const base::File::Error error = ProviderErrorToFileError(params->error); 236 const base::File::Error error = ProviderErrorToFileError(params->error);
234 RejectRequest(RequestValue::CreateForOperationError(params.Pass()), error); 237 RejectRequest(RequestValue::CreateForOperationError(params.Pass()), error);
235 return true; 238 return true;
236 } 239 }
237 240
238 } // namespace extensions 241 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698