OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
358 int64 content_length, | 358 int64 content_length, |
359 const FilePath& destination_directory, | 359 const FilePath& destination_directory, |
360 const InitiateUploadOperationCallback& callback); | 360 const InitiateUploadOperationCallback& callback); |
361 | 361 |
362 // Resumes upload operation for chunk of file defined in |params.. | 362 // Resumes upload operation for chunk of file defined in |params.. |
363 // | 363 // |
364 // Can be called from any thread. |callback| is run on the calling thread. | 364 // Can be called from any thread. |callback| is run on the calling thread. |
365 void ResumeUpload(const ResumeUploadParams& params, | 365 void ResumeUpload(const ResumeUploadParams& params, |
366 const ResumeUploadOperationCallback& callback); | 366 const ResumeUploadOperationCallback& callback); |
367 | 367 |
368 // Only used by tests to inject a mock documents service. | |
369 void ReplaceDocumentsService( | |
satorux1
2012/03/08 01:48:37
Rather than replacing it, wouldn't it be cleaner t
Greg Spencer (Chromium)
2012/03/08 19:06:35
It would, but I worried about the following too mu
satorux1
2012/03/08 19:28:37
As mentioned elsewhere, I think you can inject fro
Greg Spencer (Chromium)
2012/03/09 00:33:30
Done.
| |
370 scoped_ptr<DocumentsServiceInterface> documents_service); | |
371 | |
368 // Unsafe (unlocked) version of the function above. | 372 // Unsafe (unlocked) version of the function above. |
369 void UnsafeFindFileByPath(const FilePath& file_path, | 373 void UnsafeFindFileByPath(const FilePath& file_path, |
370 scoped_refptr<FindFileDelegate> delegate); | 374 scoped_refptr<FindFileDelegate> delegate); |
371 | 375 |
372 // Converts document feed from gdata service into DirectoryInfo. On failure, | 376 // Converts document feed from gdata service into DirectoryInfo. On failure, |
373 // returns NULL and fills in |error| with an appropriate value. | 377 // returns NULL and fills in |error| with an appropriate value. |
374 GDataDirectory* ParseGDataFeed(GDataErrorCode status, | 378 GDataDirectory* ParseGDataFeed(GDataErrorCode status, |
375 base::Value* data, | 379 base::Value* data, |
376 base::PlatformFileError *error); | 380 base::PlatformFileError *error); |
377 | 381 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
449 // if directory can't be found. | 453 // if directory can't be found. |
450 GURL GetUploadUrlForDirectory(const FilePath& destination_directory); | 454 GURL GetUploadUrlForDirectory(const FilePath& destination_directory); |
451 | 455 |
452 scoped_ptr<GDataDirectory> root_; | 456 scoped_ptr<GDataDirectory> root_; |
453 base::Lock lock_; | 457 base::Lock lock_; |
454 | 458 |
455 // The profile hosts the GDataFileSystem. | 459 // The profile hosts the GDataFileSystem. |
456 Profile* profile_; | 460 Profile* profile_; |
457 | 461 |
458 // The document service for the GDataFileSystem. | 462 // The document service for the GDataFileSystem. |
459 scoped_ptr<DocumentsService> documents_service_; | 463 scoped_ptr<DocumentsServiceInterface> documents_service_; |
460 | 464 |
461 // File content uploader. | 465 // File content uploader. |
462 scoped_ptr<GDataUploader> uploader_; | 466 scoped_ptr<GDataUploader> uploader_; |
463 | 467 |
464 base::WeakPtrFactory<GDataFileSystem> weak_ptr_factory_; | 468 base::WeakPtrFactory<GDataFileSystem> weak_ptr_factory_; |
465 }; | 469 }; |
466 | 470 |
467 // Singleton that owns all GDataFileSystems and associates them with | 471 // Singleton that owns all GDataFileSystems and associates them with |
468 // Profiles. | 472 // Profiles. |
469 class GDataFileSystemFactory : public ProfileKeyedServiceFactory { | 473 class GDataFileSystemFactory : public ProfileKeyedServiceFactory { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
537 GDataDirectory*) OVERRIDE; | 541 GDataDirectory*) OVERRIDE; |
538 virtual void OnError(base::PlatformFileError) OVERRIDE; | 542 virtual void OnError(base::PlatformFileError) OVERRIDE; |
539 | 543 |
540 // File entry that was found. | 544 // File entry that was found. |
541 GDataFileBase* file_; | 545 GDataFileBase* file_; |
542 }; | 546 }; |
543 | 547 |
544 } // namespace gdata | 548 } // namespace gdata |
545 | 549 |
546 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ | 550 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
OLD | NEW |