| 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 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_PICASA_DATA_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_PICASA_DATA_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_PICASA_DATA_PROVIDER_H_ | 6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_PICASA_DATA_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/callback_forward.h" | 13 #include "base/callback_forward.h" |
| 14 #include "base/files/file.h" |
| 14 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
| 15 #include "base/files/file_path_watcher.h" | 16 #include "base/files/file_path_watcher.h" |
| 16 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
| 17 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
| 18 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
| 19 #include "base/time/time.h" | 20 #include "base/time/time.h" |
| 20 #include "chrome/common/media_galleries/picasa_types.h" | 21 #include "chrome/common/media_galleries/picasa_types.h" |
| 21 | 22 |
| 22 namespace picasa { | 23 namespace picasa { |
| 23 | 24 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 40 // Ask the data provider to refresh the data if necessary. |ready_callback| | 41 // Ask the data provider to refresh the data if necessary. |ready_callback| |
| 41 // will be called when the data is up to date. | 42 // will be called when the data is up to date. |
| 42 void RefreshData(DataType needed_data, const ReadyCallback& ready_callback); | 43 void RefreshData(DataType needed_data, const ReadyCallback& ready_callback); |
| 43 | 44 |
| 44 // These methods return scoped_ptrs because we want to return a copy that | 45 // These methods return scoped_ptrs because we want to return a copy that |
| 45 // will not change to the caller. | 46 // will not change to the caller. |
| 46 scoped_ptr<AlbumMap> GetAlbums(); | 47 scoped_ptr<AlbumMap> GetAlbums(); |
| 47 scoped_ptr<AlbumMap> GetFolders(); | 48 scoped_ptr<AlbumMap> GetFolders(); |
| 48 // |error| must be non-NULL. | 49 // |error| must be non-NULL. |
| 49 scoped_ptr<AlbumImages> FindAlbumImages(const std::string& key, | 50 scoped_ptr<AlbumImages> FindAlbumImages(const std::string& key, |
| 50 base::PlatformFileError* error); | 51 base::File::Error* error); |
| 51 | 52 |
| 52 protected: | 53 protected: |
| 53 // Notifies data provider that any currently cached data is stale. | 54 // Notifies data provider that any currently cached data is stale. |
| 54 virtual void InvalidateData(); | 55 virtual void InvalidateData(); |
| 55 | 56 |
| 56 private: | 57 private: |
| 57 enum State { | 58 enum State { |
| 58 STALE_DATA_STATE, | 59 STALE_DATA_STATE, |
| 59 INVALID_DATA_STATE, | 60 INVALID_DATA_STATE, |
| 60 LIST_OF_ALBUMS_AND_FOLDERS_FRESH_STATE, | 61 LIST_OF_ALBUMS_AND_FOLDERS_FRESH_STATE, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 scoped_ptr<base::FilePathWatcher> temp_dir_watcher_; | 112 scoped_ptr<base::FilePathWatcher> temp_dir_watcher_; |
| 112 | 113 |
| 113 base::WeakPtrFactory<PicasaDataProvider> weak_factory_; | 114 base::WeakPtrFactory<PicasaDataProvider> weak_factory_; |
| 114 | 115 |
| 115 DISALLOW_COPY_AND_ASSIGN(PicasaDataProvider); | 116 DISALLOW_COPY_AND_ASSIGN(PicasaDataProvider); |
| 116 }; | 117 }; |
| 117 | 118 |
| 118 } // namespace picasa | 119 } // namespace picasa |
| 119 | 120 |
| 120 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_PICASA_DATA_PROVIDER_H_ | 121 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_PICASA_DATA_PROVIDER_H_ |
| OLD | NEW |