Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / media_galleries / fileapi / picasa_file_util.h
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_FILE_UTIL_H_
6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_PICASA_FILE_UTIL_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/weak_ptr.h"
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 // PicasaFileUtil virtual directory structure example:
20 //   - /albums/
21 //   - /albums/albumname 2013-08-21/
22 //   - /albums/albumname 2013-08-21/imagename.jpg
23 //   - /albums/duplicatename 2013-08-21/
24 //   - /albums/duplicatename 2013-08-21 (1)/
25 //   - /folders/
26 //   - /folders/My Pictures 2013-08-21/flower.jpg
27 //   - /folders/Photos 2013-08-21/
28 class PicasaFileUtil : public NativeMediaFileUtil {
29  public:
30   explicit PicasaFileUtil(MediaPathFilter* media_path_filter);
31   ~PicasaFileUtil() override;
32
33  protected:
34   // NativeMediaFileUtil overrides.
35   void GetFileInfoOnTaskRunnerThread(
36       scoped_ptr<storage::FileSystemOperationContext> context,
37       const storage::FileSystemURL& url,
38       const GetFileInfoCallback& callback) override;
39   void ReadDirectoryOnTaskRunnerThread(
40       scoped_ptr<storage::FileSystemOperationContext> context,
41       const storage::FileSystemURL& url,
42       const ReadDirectoryCallback& callback) override;
43   base::File::Error GetFileInfoSync(
44       storage::FileSystemOperationContext* context,
45       const storage::FileSystemURL& url,
46       base::File::Info* file_info,
47       base::FilePath* platform_path) override;
48   base::File::Error ReadDirectorySync(
49       storage::FileSystemOperationContext* context,
50       const storage::FileSystemURL& url,
51       EntryList* file_list) override;
52   base::File::Error DeleteDirectorySync(
53       storage::FileSystemOperationContext* context,
54       const storage::FileSystemURL& url) override;
55   base::File::Error DeleteFileSync(storage::FileSystemOperationContext* context,
56                                    const storage::FileSystemURL& url) override;
57   base::File::Error GetLocalFilePath(
58       storage::FileSystemOperationContext* context,
59       const storage::FileSystemURL& url,
60       base::FilePath* local_file_path) override;
61
62  private:
63   void GetFileInfoWithFreshDataProvider(
64       scoped_ptr<storage::FileSystemOperationContext> context,
65       const storage::FileSystemURL& url,
66       const GetFileInfoCallback& callback,
67       bool success);
68   void ReadDirectoryWithFreshDataProvider(
69       scoped_ptr<storage::FileSystemOperationContext> context,
70       const storage::FileSystemURL& url,
71       const ReadDirectoryCallback& callback,
72       bool success);
73
74   virtual PicasaDataProvider* GetDataProvider();
75
76   base::WeakPtrFactory<PicasaFileUtil> weak_factory_;
77
78   DISALLOW_COPY_AND_ASSIGN(PicasaFileUtil);
79 };
80
81 }  // namespace picasa
82
83 #endif  // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_PICASA_FILE_UTIL_H_