OLD | NEW |
---|---|
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_manager/private_api_drive.h" | 5 #include "chrome/browser/chromeos/extensions/file_manager/private_api_drive.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/chromeos/drive/drive_integration_service.h" | 9 #include "chrome/browser/chromeos/drive/drive_integration_service.h" |
10 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" | 10 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" |
11 #include "chrome/browser/chromeos/file_manager/file_tasks.h" | 11 #include "chrome/browser/chromeos/file_manager/file_tasks.h" |
12 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" | 12 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" |
13 #include "chrome/browser/chromeos/file_manager/url_util.h" | 13 #include "chrome/browser/chromeos/file_manager/url_util.h" |
14 #include "chrome/browser/chromeos/file_system_provider/mount_path_util.h" | |
15 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte rface.h" | |
14 #include "chrome/browser/chromeos/fileapi/file_system_backend.h" | 16 #include "chrome/browser/chromeos/fileapi/file_system_backend.h" |
15 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 17 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
16 #include "chrome/browser/drive/drive_app_registry.h" | 18 #include "chrome/browser/drive/drive_app_registry.h" |
17 #include "chrome/browser/drive/event_logger.h" | 19 #include "chrome/browser/drive/event_logger.h" |
18 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/profiles/profile_manager.h" | 21 #include "chrome/browser/profiles/profile_manager.h" |
20 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 22 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
21 #include "chrome/browser/signin/signin_manager_factory.h" | 23 #include "chrome/browser/signin/signin_manager_factory.h" |
22 #include "chromeos/chromeos_switches.h" | 24 #include "chromeos/chromeos_switches.h" |
23 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 25 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
24 #include "components/signin/core/browser/signin_manager.h" | 26 #include "components/signin/core/browser/signin_manager.h" |
25 #include "content/public/browser/browser_thread.h" | 27 #include "content/public/browser/browser_thread.h" |
26 #include "google_apis/drive/auth_service.h" | 28 #include "google_apis/drive/auth_service.h" |
27 #include "webkit/common/fileapi/file_system_info.h" | 29 #include "webkit/common/fileapi/file_system_info.h" |
28 #include "webkit/common/fileapi/file_system_util.h" | 30 #include "webkit/common/fileapi/file_system_util.h" |
29 | 31 |
30 using content::BrowserThread; | 32 using content::BrowserThread; |
31 | 33 |
34 using chromeos::file_system_provider::EntryMetadata; | |
35 using chromeos::file_system_provider::ProvidedFileSystemInterface; | |
36 using chromeos::file_system_provider::util::FileSystemURLParser; | |
37 using extensions::api::file_browser_private::EntryProperties; | |
32 using file_manager::util::EntryDefinition; | 38 using file_manager::util::EntryDefinition; |
33 using file_manager::util::EntryDefinitionCallback; | 39 using file_manager::util::EntryDefinitionCallback; |
34 using file_manager::util::EntryDefinitionList; | 40 using file_manager::util::EntryDefinitionList; |
35 using file_manager::util::EntryDefinitionListCallback; | 41 using file_manager::util::EntryDefinitionListCallback; |
36 using file_manager::util::FileDefinition; | 42 using file_manager::util::FileDefinition; |
37 using file_manager::util::FileDefinitionList; | 43 using file_manager::util::FileDefinitionList; |
38 using extensions::api::file_browser_private::EntryProperties; | |
39 | 44 |
40 namespace extensions { | 45 namespace extensions { |
41 namespace { | 46 namespace { |
42 | 47 |
43 // List of connection types of drive. | 48 // List of connection types of drive. |
44 // Keep this in sync with the DriveConnectionType in common/js/util.js. | 49 // Keep this in sync with the DriveConnectionType in common/js/util.js. |
45 const char kDriveConnectionTypeOffline[] = "offline"; | 50 const char kDriveConnectionTypeOffline[] = "offline"; |
46 const char kDriveConnectionTypeMetered[] = "metered"; | 51 const char kDriveConnectionTypeMetered[] = "metered"; |
47 const char kDriveConnectionTypeOnline[] = "online"; | 52 const char kDriveConnectionTypeOnline[] = "online"; |
48 | 53 |
49 // List of reasons of kDriveConnectionType*. | 54 // List of reasons of kDriveConnectionType*. |
50 // Keep this in sync with the DriveConnectionReason in common/js/util.js. | 55 // Keep this in sync with the DriveConnectionReason in common/js/util.js. |
51 const char kDriveConnectionReasonNotReady[] = "not_ready"; | 56 const char kDriveConnectionReasonNotReady[] = "not_ready"; |
52 const char kDriveConnectionReasonNoNetwork[] = "no_network"; | 57 const char kDriveConnectionReasonNoNetwork[] = "no_network"; |
53 const char kDriveConnectionReasonNoService[] = "no_service"; | 58 const char kDriveConnectionReasonNoService[] = "no_service"; |
54 | 59 |
55 // Copies properties from |entry_proto| to |properties|. |shared_with_me| is | 60 // Copies properties from |entry_proto| to |properties|. |shared_with_me| is |
56 // given from the running profile. | 61 // given from the running profile. |
57 void FillEntryPropertiesValue(const drive::ResourceEntry& entry_proto, | 62 void FillEntryPropertiesValueForDrive(const drive::ResourceEntry& entry_proto, |
58 bool shared_with_me, | 63 bool shared_with_me, |
59 EntryProperties* properties) { | 64 EntryProperties* properties) { |
60 properties->shared_with_me.reset(new bool(shared_with_me)); | 65 properties->shared_with_me.reset(new bool(shared_with_me)); |
61 properties->shared.reset(new bool(entry_proto.shared())); | 66 properties->shared.reset(new bool(entry_proto.shared())); |
62 | 67 |
63 const drive::PlatformFileInfoProto& file_info = entry_proto.file_info(); | 68 const drive::PlatformFileInfoProto& file_info = entry_proto.file_info(); |
64 properties->file_size.reset(new double(file_info.size())); | 69 properties->file_size.reset(new double(file_info.size())); |
65 properties->last_modified_time.reset(new double( | 70 properties->last_modified_time.reset(new double( |
66 base::Time::FromInternalValue(file_info.last_modified()).ToJsTime())); | 71 base::Time::FromInternalValue(file_info.last_modified()).ToJsTime())); |
67 | 72 |
68 if (!entry_proto.has_file_specific_info()) | 73 if (!entry_proto.has_file_specific_info()) |
69 return; | 74 return; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
157 SingleEntryPropertiesGetterForDrive* instance = | 162 SingleEntryPropertiesGetterForDrive* instance = |
158 new SingleEntryPropertiesGetterForDrive(local_path, profile, callback); | 163 new SingleEntryPropertiesGetterForDrive(local_path, profile, callback); |
159 instance->StartProcess(); | 164 instance->StartProcess(); |
160 | 165 |
161 // The instance will be destroyed by itself. | 166 // The instance will be destroyed by itself. |
162 } | 167 } |
163 | 168 |
164 virtual ~SingleEntryPropertiesGetterForDrive() {} | 169 virtual ~SingleEntryPropertiesGetterForDrive() {} |
165 | 170 |
166 private: | 171 private: |
167 // Given parameters. | |
168 const ResultCallback callback_; | |
169 const base::FilePath local_path_; | |
170 Profile* const running_profile_; | |
171 | |
172 // Values used in the process. | |
173 scoped_ptr<EntryProperties> properties_; | |
174 Profile* file_owner_profile_; | |
175 base::FilePath file_path_; | |
176 scoped_ptr<drive::ResourceEntry> owner_resource_entry_; | |
177 | |
178 base::WeakPtrFactory<SingleEntryPropertiesGetterForDrive> weak_ptr_factory_; | |
179 | |
180 SingleEntryPropertiesGetterForDrive(const base::FilePath local_path, | 172 SingleEntryPropertiesGetterForDrive(const base::FilePath local_path, |
181 Profile* const profile, | 173 Profile* const profile, |
182 const ResultCallback& callback) | 174 const ResultCallback& callback) |
183 : callback_(callback), | 175 : callback_(callback), |
184 local_path_(local_path), | 176 local_path_(local_path), |
185 running_profile_(profile), | 177 running_profile_(profile), |
186 properties_(new EntryProperties), | 178 properties_(new EntryProperties), |
187 file_owner_profile_(NULL), | 179 file_owner_profile_(NULL), |
188 weak_ptr_factory_(this) { | 180 weak_ptr_factory_(this) { |
189 DCHECK(!callback_.is_null()); | 181 DCHECK(!callback_.is_null()); |
190 DCHECK(profile); | 182 DCHECK(profile); |
191 } | 183 } |
192 | 184 |
193 base::WeakPtr<SingleEntryPropertiesGetterForDrive> GetWeakPtr() { | |
194 return weak_ptr_factory_.GetWeakPtr(); | |
195 } | |
196 | |
197 void StartProcess() { | 185 void StartProcess() { |
198 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 186 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
199 | 187 |
200 file_path_ = drive::util::ExtractDrivePath(local_path_); | 188 file_path_ = drive::util::ExtractDrivePath(local_path_); |
201 file_owner_profile_ = drive::util::ExtractProfileFromPath(local_path_); | 189 file_owner_profile_ = drive::util::ExtractProfileFromPath(local_path_); |
202 | 190 |
203 if (!file_owner_profile_ || | 191 if (!file_owner_profile_ || |
204 !g_browser_process->profile_manager()->IsValidProfile( | 192 !g_browser_process->profile_manager()->IsValidProfile( |
205 file_owner_profile_)) { | 193 file_owner_profile_)) { |
206 CompleteGetEntryProperties(drive::FILE_ERROR_FAILED); | 194 CompleteGetEntryProperties(drive::FILE_ERROR_FAILED); |
207 return; | 195 return; |
208 } | 196 } |
209 | 197 |
210 // Start getting the file info. | 198 // Start getting the file info. |
211 drive::FileSystemInterface* const file_system = | 199 drive::FileSystemInterface* const file_system = |
212 drive::util::GetFileSystemByProfile(file_owner_profile_); | 200 drive::util::GetFileSystemByProfile(file_owner_profile_); |
213 if (!file_system) { | 201 if (!file_system) { |
214 // |file_system| is NULL if Drive is disabled or not mounted. | 202 // |file_system| is NULL if Drive is disabled or not mounted. |
215 CompleteGetEntryProperties(drive::FILE_ERROR_FAILED); | 203 CompleteGetEntryProperties(drive::FILE_ERROR_FAILED); |
216 return; | 204 return; |
217 } | 205 } |
218 | 206 |
219 file_system->GetResourceEntry( | 207 file_system->GetResourceEntry( |
220 file_path_, | 208 file_path_, |
221 base::Bind(&SingleEntryPropertiesGetterForDrive::OnGetFileInfo, | 209 base::Bind(&SingleEntryPropertiesGetterForDrive::OnGetFileInfo, |
222 GetWeakPtr())); | 210 weak_ptr_factory_.GetWeakPtr())); |
223 } | 211 } |
224 | 212 |
225 void OnGetFileInfo(drive::FileError error, | 213 void OnGetFileInfo(drive::FileError error, |
226 scoped_ptr<drive::ResourceEntry> entry) { | 214 scoped_ptr<drive::ResourceEntry> entry) { |
227 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 215 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
228 | 216 |
229 if (error != drive::FILE_ERROR_OK) { | 217 if (error != drive::FILE_ERROR_OK) { |
230 CompleteGetEntryProperties(error); | 218 CompleteGetEntryProperties(error); |
231 return; | 219 return; |
232 } | 220 } |
(...skipping 10 matching lines...) Expand all Loading... | |
243 // flag from the running profile's value. | 231 // flag from the running profile's value. |
244 drive::FileSystemInterface* const file_system = | 232 drive::FileSystemInterface* const file_system = |
245 drive::util::GetFileSystemByProfile(running_profile_); | 233 drive::util::GetFileSystemByProfile(running_profile_); |
246 if (!file_system) { | 234 if (!file_system) { |
247 CompleteGetEntryProperties(drive::FILE_ERROR_FAILED); | 235 CompleteGetEntryProperties(drive::FILE_ERROR_FAILED); |
248 return; | 236 return; |
249 } | 237 } |
250 file_system->GetPathFromResourceId( | 238 file_system->GetPathFromResourceId( |
251 owner_resource_entry_->resource_id(), | 239 owner_resource_entry_->resource_id(), |
252 base::Bind(&SingleEntryPropertiesGetterForDrive::OnGetRunningPath, | 240 base::Bind(&SingleEntryPropertiesGetterForDrive::OnGetRunningPath, |
253 GetWeakPtr())); | 241 weak_ptr_factory_.GetWeakPtr())); |
254 } | 242 } |
255 | 243 |
256 void OnGetRunningPath(drive::FileError error, | 244 void OnGetRunningPath(drive::FileError error, |
257 const base::FilePath& file_path) { | 245 const base::FilePath& file_path) { |
258 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 246 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
259 | 247 |
260 if (error != drive::FILE_ERROR_OK) { | 248 if (error != drive::FILE_ERROR_OK) { |
261 // The running profile does not know the file. | 249 // The running profile does not know the file. |
262 StartParseFileInfo(false); | 250 StartParseFileInfo(false); |
263 return; | 251 return; |
264 } | 252 } |
265 | 253 |
266 drive::FileSystemInterface* const file_system = | 254 drive::FileSystemInterface* const file_system = |
267 drive::util::GetFileSystemByProfile(running_profile_); | 255 drive::util::GetFileSystemByProfile(running_profile_); |
268 if (!file_system) { | 256 if (!file_system) { |
269 // The drive is disable for the running profile. | 257 // The drive is disable for the running profile. |
270 StartParseFileInfo(false); | 258 StartParseFileInfo(false); |
271 return; | 259 return; |
272 } | 260 } |
273 | 261 |
274 file_system->GetResourceEntry( | 262 file_system->GetResourceEntry( |
275 file_path, | 263 file_path, |
276 base::Bind(&SingleEntryPropertiesGetterForDrive::OnGetShareInfo, | 264 base::Bind(&SingleEntryPropertiesGetterForDrive::OnGetShareInfo, |
277 GetWeakPtr())); | 265 weak_ptr_factory_.GetWeakPtr())); |
278 } | 266 } |
279 | 267 |
280 void OnGetShareInfo(drive::FileError error, | 268 void OnGetShareInfo(drive::FileError error, |
281 scoped_ptr<drive::ResourceEntry> entry) { | 269 scoped_ptr<drive::ResourceEntry> entry) { |
282 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 270 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
283 | 271 |
284 if (error != drive::FILE_ERROR_OK) { | 272 if (error != drive::FILE_ERROR_OK) { |
285 CompleteGetEntryProperties(error); | 273 CompleteGetEntryProperties(error); |
286 return; | 274 return; |
287 } | 275 } |
288 | 276 |
289 DCHECK(entry); | 277 DCHECK(entry.get()); |
290 StartParseFileInfo(entry->shared_with_me()); | 278 StartParseFileInfo(entry->shared_with_me()); |
291 } | 279 } |
292 | 280 |
293 void StartParseFileInfo(bool shared_with_me) { | 281 void StartParseFileInfo(bool shared_with_me) { |
294 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 282 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
295 | 283 |
296 FillEntryPropertiesValue( | 284 FillEntryPropertiesValueForDrive( |
297 *owner_resource_entry_, shared_with_me, properties_.get()); | 285 *owner_resource_entry_, shared_with_me, properties_.get()); |
298 | 286 |
299 drive::FileSystemInterface* const file_system = | 287 drive::FileSystemInterface* const file_system = |
300 drive::util::GetFileSystemByProfile(file_owner_profile_); | 288 drive::util::GetFileSystemByProfile(file_owner_profile_); |
301 drive::DriveAppRegistry* const app_registry = | 289 drive::DriveAppRegistry* const app_registry = |
302 drive::util::GetDriveAppRegistryByProfile(file_owner_profile_); | 290 drive::util::GetDriveAppRegistryByProfile(file_owner_profile_); |
303 if (!file_system || !app_registry) { | 291 if (!file_system || !app_registry) { |
304 // |file_system| or |app_registry| is NULL if Drive is disabled. | 292 // |file_system| or |app_registry| is NULL if Drive is disabled. |
305 CompleteGetEntryProperties(drive::FILE_ERROR_FAILED); | 293 CompleteGetEntryProperties(drive::FILE_ERROR_FAILED); |
306 return; | 294 return; |
307 } | 295 } |
308 | 296 |
309 // The properties meaningful for directories are already filled in | 297 // The properties meaningful for directories are already filled in |
310 // FillEntryPropertiesValue(). | 298 // FillEntryPropertiesValueForDrive(). |
311 if (!owner_resource_entry_->has_file_specific_info()) { | 299 if (!owner_resource_entry_->has_file_specific_info()) { |
312 CompleteGetEntryProperties(drive::FILE_ERROR_OK); | 300 CompleteGetEntryProperties(drive::FILE_ERROR_OK); |
313 return; | 301 return; |
314 } | 302 } |
315 | 303 |
316 const drive::FileSpecificInfo& file_specific_info = | 304 const drive::FileSpecificInfo& file_specific_info = |
317 owner_resource_entry_->file_specific_info(); | 305 owner_resource_entry_->file_specific_info(); |
318 | 306 |
319 // Get drive WebApps that can accept this file. We just need to extract the | 307 // Get drive WebApps that can accept this file. We just need to extract the |
320 // doc icon for the drive app, which is set as default. | 308 // doc icon for the drive app, which is set as default. |
(...skipping 25 matching lines...) Expand all Loading... | |
346 } | 334 } |
347 | 335 |
348 void CompleteGetEntryProperties(drive::FileError error) { | 336 void CompleteGetEntryProperties(drive::FileError error) { |
349 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 337 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
350 DCHECK(!callback_.is_null()); | 338 DCHECK(!callback_.is_null()); |
351 | 339 |
352 callback_.Run(properties_.Pass(), drive::FileErrorToBaseFileError(error)); | 340 callback_.Run(properties_.Pass(), drive::FileErrorToBaseFileError(error)); |
353 | 341 |
354 delete this; | 342 delete this; |
355 } | 343 } |
344 | |
345 // Given parameters. | |
346 const ResultCallback callback_; | |
347 const base::FilePath local_path_; | |
348 Profile* const running_profile_; | |
349 | |
350 // Values used in the process. | |
351 scoped_ptr<EntryProperties> properties_; | |
352 Profile* file_owner_profile_; | |
353 base::FilePath file_path_; | |
354 scoped_ptr<drive::ResourceEntry> owner_resource_entry_; | |
355 | |
356 base::WeakPtrFactory<SingleEntryPropertiesGetterForDrive> weak_ptr_factory_; | |
357 }; // class SingleEntryPropertiesGetterForDrive | |
358 | |
359 class SingleEntryPropertiesGetterForFileSystemProvider { | |
360 public: | |
361 typedef base::Callback<void(scoped_ptr<EntryProperties> properties, | |
362 base::File::Error error)> ResultCallback; | |
363 | |
364 // Creates an instance and starts the process. | |
365 static void Start(const storage::FileSystemURL file_system_url, | |
366 const ResultCallback& callback) { | |
yoshiki
2014/09/04 05:29:21
nit: Please DCHECK if the current thread is the UI
mtomasz
2014/09/04 06:22:08
Done.
| |
367 SingleEntryPropertiesGetterForFileSystemProvider* instance = | |
368 new SingleEntryPropertiesGetterForFileSystemProvider(file_system_url, | |
369 callback); | |
370 instance->StartProcess(); | |
371 | |
372 // The instance will be destroyed by itself. | |
373 } | |
374 | |
375 virtual ~SingleEntryPropertiesGetterForFileSystemProvider() {} | |
376 | |
377 private: | |
378 SingleEntryPropertiesGetterForFileSystemProvider( | |
379 const storage::FileSystemURL& file_system_url, | |
380 const ResultCallback& callback) | |
381 : callback_(callback), | |
382 file_system_url_(file_system_url), | |
383 properties_(new EntryProperties), | |
384 weak_ptr_factory_(this) { | |
385 DCHECK(!callback_.is_null()); | |
386 } | |
387 | |
388 void StartProcess() { | |
389 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
390 | |
391 FileSystemURLParser parser(file_system_url_); | |
392 if (!parser.Parse()) { | |
393 CompleteGetEntryProperties(base::File::FILE_ERROR_NOT_FOUND); | |
394 return; | |
395 } | |
396 | |
397 parser.file_system()->GetMetadata( | |
398 parser.file_path(), | |
399 ProvidedFileSystemInterface::METADATA_FIELD_THUMBNAIL, | |
400 base::Bind(&SingleEntryPropertiesGetterForFileSystemProvider:: | |
401 OnGetMetadataCompleted, | |
402 weak_ptr_factory_.GetWeakPtr())); | |
403 } | |
404 | |
405 void OnGetMetadataCompleted(scoped_ptr<EntryMetadata> metadata, | |
406 base::File::Error result) { | |
407 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
408 | |
409 if (result != base::File::FILE_OK) { | |
410 CompleteGetEntryProperties(result); | |
411 return; | |
412 } | |
413 | |
414 properties_->file_size.reset(new double(metadata->size)); | |
415 properties_->last_modified_time.reset( | |
416 new double(metadata->modification_time.ToJsTime())); | |
417 | |
418 if (!metadata->thumbnail.empty()) | |
419 properties_->thumbnail_url.reset(new std::string(metadata->thumbnail)); | |
420 | |
421 CompleteGetEntryProperties(base::File::FILE_OK); | |
422 } | |
423 | |
424 void CompleteGetEntryProperties(base::File::Error result) { | |
425 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
426 DCHECK(!callback_.is_null()); | |
427 | |
428 callback_.Run(properties_.Pass(), result); | |
429 delete this; | |
yoshiki
2014/09/04 05:29:21
Asynchronous delete should be safer.
eg. BrowserT
mtomasz
2014/09/04 06:22:08
Good idea. Done.
| |
430 } | |
431 | |
432 // Given parameters. | |
433 const ResultCallback callback_; | |
434 const storage::FileSystemURL file_system_url_; | |
435 | |
436 // Values used in the process. | |
437 scoped_ptr<EntryProperties> properties_; | |
438 | |
439 base::WeakPtrFactory<SingleEntryPropertiesGetterForFileSystemProvider> | |
440 weak_ptr_factory_; | |
356 }; // class SingleEntryPropertiesGetterForDrive | 441 }; // class SingleEntryPropertiesGetterForDrive |
357 | 442 |
358 } // namespace | 443 } // namespace |
359 | 444 |
360 FileBrowserPrivateGetEntryPropertiesFunction:: | 445 FileBrowserPrivateGetEntryPropertiesFunction:: |
361 FileBrowserPrivateGetEntryPropertiesFunction() | 446 FileBrowserPrivateGetEntryPropertiesFunction() |
362 : processed_count_(0) { | 447 : processed_count_(0) { |
363 } | 448 } |
364 | 449 |
365 FileBrowserPrivateGetEntryPropertiesFunction:: | 450 FileBrowserPrivateGetEntryPropertiesFunction:: |
(...skipping 20 matching lines...) Expand all Loading... | |
386 case storage::kFileSystemTypeDrive: | 471 case storage::kFileSystemTypeDrive: |
387 SingleEntryPropertiesGetterForDrive::Start( | 472 SingleEntryPropertiesGetterForDrive::Start( |
388 file_system_url.path(), | 473 file_system_url.path(), |
389 GetProfile(), | 474 GetProfile(), |
390 base::Bind(&FileBrowserPrivateGetEntryPropertiesFunction:: | 475 base::Bind(&FileBrowserPrivateGetEntryPropertiesFunction:: |
391 CompleteGetEntryProperties, | 476 CompleteGetEntryProperties, |
392 this, | 477 this, |
393 i)); | 478 i)); |
394 break; | 479 break; |
395 case storage::kFileSystemTypeProvided: | 480 case storage::kFileSystemTypeProvided: |
396 // TODO(mtomasz): Add support for provided file systems. | 481 SingleEntryPropertiesGetterForFileSystemProvider::Start( |
397 NOTIMPLEMENTED(); | 482 file_system_url, |
483 base::Bind(&FileBrowserPrivateGetEntryPropertiesFunction:: | |
484 CompleteGetEntryProperties, | |
485 this, | |
486 i)); | |
398 break; | 487 break; |
399 default: | 488 default: |
400 LOG(ERROR) << "Not supported file system type."; | 489 LOG(ERROR) << "Not supported file system type."; |
401 CompleteGetEntryProperties(i, | 490 CompleteGetEntryProperties(i, |
402 make_scoped_ptr(new EntryProperties), | 491 make_scoped_ptr(new EntryProperties), |
403 base::File::FILE_ERROR_INVALID_OPERATION); | 492 base::File::FILE_ERROR_INVALID_OPERATION); |
404 } | 493 } |
405 } | 494 } |
406 | 495 |
407 return true; | 496 return true; |
408 } | 497 } |
409 | 498 |
410 void FileBrowserPrivateGetEntryPropertiesFunction::CompleteGetEntryProperties( | 499 void FileBrowserPrivateGetEntryPropertiesFunction::CompleteGetEntryProperties( |
411 size_t index, | 500 size_t index, |
412 scoped_ptr<EntryProperties> properties, | 501 scoped_ptr<EntryProperties> properties, |
413 base::File::Error error) { | 502 base::File::Error error) { |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1014 return; | 1103 return; |
1015 } | 1104 } |
1016 | 1105 |
1017 const std::string url = download_url_ + "?access_token=" + access_token; | 1106 const std::string url = download_url_ + "?access_token=" + access_token; |
1018 SetResult(new base::StringValue(url)); | 1107 SetResult(new base::StringValue(url)); |
1019 | 1108 |
1020 SendResponse(true); | 1109 SendResponse(true); |
1021 } | 1110 } |
1022 | 1111 |
1023 } // namespace extensions | 1112 } // namespace extensions |
OLD | NEW |