Torne (Richard Coles) | 90dce4d | 2013-05-29 14:40:03 +0100 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_PICASA_PICASA_FILE_UTIL_H_ |
| 6 | #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_PICASA_PICASA_FILE_UTIL_H_ |
| 7 | |
Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 8 | #include "base/memory/scoped_ptr.h" |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 9 | #include "base/memory/weak_ptr.h" |
Torne (Richard Coles) | 90dce4d | 2013-05-29 14:40:03 +0100 | [diff] [blame] | 10 | #include "chrome/browser/media_galleries/fileapi/native_media_file_util.h" |
| 11 | |
| 12 | namespace picasa { |
| 13 | |
| 14 | class PicasaDataProvider; |
| 15 | |
| 16 | extern const char kPicasaDirAlbums[]; |
| 17 | extern const char kPicasaDirFolders[]; |
| 18 | |
| 19 | class PicasaFileUtil : public chrome::NativeMediaFileUtil { |
| 20 | public: |
Ben Murdoch | bb1529c | 2013-08-08 10:24:53 +0100 | [diff] [blame^] | 21 | explicit PicasaFileUtil(chrome::MediaPathFilter* media_path_filter); |
Torne (Richard Coles) | 90dce4d | 2013-05-29 14:40:03 +0100 | [diff] [blame] | 22 | virtual ~PicasaFileUtil(); |
| 23 | |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 24 | protected: |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 25 | // NativeMediaFileUtil overrides. |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 26 | virtual void GetFileInfoOnTaskRunnerThread( |
Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 27 | scoped_ptr<fileapi::FileSystemOperationContext> context, |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 28 | const fileapi::FileSystemURL& url, |
| 29 | const GetFileInfoCallback& callback) OVERRIDE; |
| 30 | virtual void ReadDirectoryOnTaskRunnerThread( |
Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 31 | scoped_ptr<fileapi::FileSystemOperationContext> context, |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 32 | const fileapi::FileSystemURL& url, |
| 33 | const ReadDirectoryCallback& callback) OVERRIDE; |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 34 | virtual base::PlatformFileError GetFileInfoSync( |
Torne (Richard Coles) | 90dce4d | 2013-05-29 14:40:03 +0100 | [diff] [blame] | 35 | fileapi::FileSystemOperationContext* context, |
| 36 | const fileapi::FileSystemURL& url, |
| 37 | base::PlatformFileInfo* file_info, |
| 38 | base::FilePath* platform_path) OVERRIDE; |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 39 | virtual base::PlatformFileError ReadDirectorySync( |
Torne (Richard Coles) | 90dce4d | 2013-05-29 14:40:03 +0100 | [diff] [blame] | 40 | fileapi::FileSystemOperationContext* context, |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 41 | const fileapi::FileSystemURL& url, |
| 42 | EntryList* file_list) OVERRIDE; |
Torne (Richard Coles) | 90dce4d | 2013-05-29 14:40:03 +0100 | [diff] [blame] | 43 | virtual base::PlatformFileError GetLocalFilePath( |
| 44 | fileapi::FileSystemOperationContext* context, |
| 45 | const fileapi::FileSystemURL& url, |
| 46 | base::FilePath* local_file_path) OVERRIDE; |
| 47 | |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 48 | private: |
| 49 | void GetFileInfoWithFreshDataProvider( |
Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 50 | scoped_ptr<fileapi::FileSystemOperationContext> context, |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 51 | const fileapi::FileSystemURL& url, |
| 52 | const GetFileInfoCallback& callback); |
| 53 | void ReadDirectoryWithFreshDataProvider( |
Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 54 | scoped_ptr<fileapi::FileSystemOperationContext> context, |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 55 | const fileapi::FileSystemURL& url, |
| 56 | const ReadDirectoryCallback& callback); |
| 57 | |
| 58 | virtual PicasaDataProvider* GetDataProvider(); |
| 59 | |
| 60 | base::WeakPtrFactory<PicasaFileUtil> weak_factory_; |
Torne (Richard Coles) | 90dce4d | 2013-05-29 14:40:03 +0100 | [diff] [blame] | 61 | |
| 62 | DISALLOW_COPY_AND_ASSIGN(PicasaFileUtil); |
| 63 | }; |
| 64 | |
| 65 | } // namespace picasa |
| 66 | |
| 67 | #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_PICASA_PICASA_FILE_UTIL_H_ |