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

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

Issue 210803003: [fsp] Decouple file_service_provider::Service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments. 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/service.h" 10 #include "chrome/browser/chromeos/file_system_provider/service.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 result->Append(CreateError(kSecurityErrorName, kMountFailedErrorMessage)); 112 result->Append(CreateError(kSecurityErrorName, kMountFailedErrorMessage));
113 SetResult(result); 113 SetResult(result);
114 return false; 114 return false;
115 } 115 }
116 116
117 base::ListValue* result = new base::ListValue(); 117 base::ListValue* result = new base::ListValue();
118 result->Append(new base::FundamentalValue(file_system_id)); 118 result->Append(new base::FundamentalValue(file_system_id));
119 // Don't append an error on success. 119 // Don't append an error on success.
120 120
121 SetResult(result); 121 SetResult(result);
122 SendResponse(true);
123 return true; 122 return true;
124 } 123 }
125 124
126 bool FileSystemProviderUnmountFunction::RunImpl() { 125 bool FileSystemProviderUnmountFunction::RunImpl() {
127 using api::file_system_provider::Unmount::Params; 126 using api::file_system_provider::Unmount::Params;
128 const scoped_ptr<Params> params(Params::Create(*args_)); 127 const scoped_ptr<Params> params(Params::Create(*args_));
129 EXTENSION_FUNCTION_VALIDATE(params); 128 EXTENSION_FUNCTION_VALIDATE(params);
130 129
131 chromeos::file_system_provider::Service* service = 130 chromeos::file_system_provider::Service* service =
132 chromeos::file_system_provider::Service::Get(GetProfile()); 131 chromeos::file_system_provider::Service::Get(GetProfile());
133 DCHECK(service); 132 DCHECK(service);
134 133
135 if (!service->UnmountFileSystem(extension_id(), params->file_system_id)) { 134 if (!service->UnmountFileSystem(extension_id(), params->file_system_id)) {
136 // TODO(mtomasz): Pass more detailed errors, rather than just a bool. 135 // TODO(mtomasz): Pass more detailed errors, rather than just a bool.
137 base::ListValue* result = new base::ListValue(); 136 base::ListValue* result = new base::ListValue();
138 result->Append(CreateError(kSecurityErrorName, kUnmountFailedErrorMessage)); 137 result->Append(CreateError(kSecurityErrorName, kUnmountFailedErrorMessage));
139 SetResult(result); 138 SetResult(result);
140 return false; 139 return false;
141 } 140 }
142 141
143 base::ListValue* result = new base::ListValue(); 142 base::ListValue* result = new base::ListValue();
144 SetResult(result); 143 SetResult(result);
145 SendResponse(true);
146 return true; 144 return true;
147 } 145 }
148 146
149 bool FileSystemProviderInternalUnmountRequestedSuccessFunction::RunImpl() { 147 bool FileSystemProviderInternalUnmountRequestedSuccessFunction::RunImpl() {
150 using api::file_system_provider_internal::UnmountRequestedSuccess::Params; 148 using api::file_system_provider_internal::UnmountRequestedSuccess::Params;
151 const scoped_ptr<Params> params(Params::Create(*args_)); 149 const scoped_ptr<Params> params(Params::Create(*args_));
152 EXTENSION_FUNCTION_VALIDATE(params); 150 EXTENSION_FUNCTION_VALIDATE(params);
153 151
154 chromeos::file_system_provider::Service* service = 152 chromeos::file_system_provider::Service* service =
155 chromeos::file_system_provider::Service::Get(GetProfile()); 153 chromeos::file_system_provider::Service::Get(GetProfile());
156 DCHECK(service); 154 DCHECK(service);
157 155
158 if (!service->FulfillRequest(extension_id(), 156 if (!service->request_manager()->FulfillRequest(
159 params->file_system_id, 157 extension_id(),
160 params->request_id, 158 params->file_system_id,
161 scoped_ptr<base::DictionaryValue>(), 159 params->request_id,
162 false /* has_more */)) { 160 scoped_ptr<base::DictionaryValue>(),
161 false /* has_more */)) {
163 // TODO(mtomasz): Pass more detailed errors, rather than just a bool. 162 // TODO(mtomasz): Pass more detailed errors, rather than just a bool.
164 base::ListValue* result = new base::ListValue(); 163 base::ListValue* result = new base::ListValue();
165 result->Append( 164 result->Append(
166 CreateError(kSecurityErrorName, kResponseFailedErrorMessage)); 165 CreateError(kSecurityErrorName, kResponseFailedErrorMessage));
167 SetResult(result); 166 SetResult(result);
168 return false; 167 return false;
169 } 168 }
170 169
171 base::ListValue* result = new base::ListValue(); 170 base::ListValue* result = new base::ListValue();
172 SetResult(result); 171 SetResult(result);
173 SendResponse(true);
174 return true; 172 return true;
175 } 173 }
176 174
177 bool FileSystemProviderInternalUnmountRequestedErrorFunction::RunImpl() { 175 bool FileSystemProviderInternalUnmountRequestedErrorFunction::RunImpl() {
178 using api::file_system_provider_internal::UnmountRequestedError::Params; 176 using api::file_system_provider_internal::UnmountRequestedError::Params;
179 const scoped_ptr<Params> params(Params::Create(*args_)); 177 const scoped_ptr<Params> params(Params::Create(*args_));
180 EXTENSION_FUNCTION_VALIDATE(params); 178 EXTENSION_FUNCTION_VALIDATE(params);
181 179
182 chromeos::file_system_provider::Service* service = 180 chromeos::file_system_provider::Service* service =
183 chromeos::file_system_provider::Service::Get(GetProfile()); 181 chromeos::file_system_provider::Service::Get(GetProfile());
184 DCHECK(service); 182 DCHECK(service);
185 183
186 if (!service->RejectRequest(extension_id(), 184 if (!service->request_manager()->RejectRequest(
187 params->file_system_id, 185 extension_id(),
188 params->request_id, 186 params->file_system_id,
189 ProviderErrorToFileError(params->error))) { 187 params->request_id,
190 // TODO(mtomasz): Pass more detailed errors, rather than just a bool. 188 ProviderErrorToFileError(params->error))) {
191 base::ListValue* result = new base::ListValue(); 189 base::ListValue* result = new base::ListValue();
192 result->Append( 190 result->Append(
193 CreateError(kSecurityErrorName, kResponseFailedErrorMessage)); 191 CreateError(kSecurityErrorName, kResponseFailedErrorMessage));
194 SetResult(result); 192 SetResult(result);
195 return false; 193 return false;
196 } 194 }
197 195
198 base::ListValue* result = new base::ListValue(); 196 base::ListValue* result = new base::ListValue();
199 SetResult(result); 197 SetResult(result);
200 SendResponse(true);
201 return true; 198 return true;
202 } 199 }
203 200
204 } // namespace extensions 201 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698