| 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_DRIVE_DRIVE_FEED_LOADER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FEED_LOADER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FEED_LOADER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FEED_LOADER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 int64 start_changestamp; | 69 int64 start_changestamp; |
| 70 int64 root_feed_changestamp; | 70 int64 root_feed_changestamp; |
| 71 std::string search_query; | 71 std::string search_query; |
| 72 std::string directory_resource_id; | 72 std::string directory_resource_id; |
| 73 GURL feed_to_load; | 73 GURL feed_to_load; |
| 74 bool load_subsequent_feeds; | 74 bool load_subsequent_feeds; |
| 75 const LoadDocumentFeedCallback feed_load_callback; | 75 const LoadDocumentFeedCallback feed_load_callback; |
| 76 FileOperationCallback load_finished_callback; | 76 FileOperationCallback load_finished_callback; |
| 77 ScopedVector<google_apis::DocumentFeed> feed_list; | 77 ScopedVector<google_apis::DocumentFeed> feed_list; |
| 78 scoped_ptr<GetDocumentsUiState> ui_state; | 78 scoped_ptr<GetDocumentsUiState> ui_state; |
| 79 // On initial feed load for Drive API, remember root ID for | |
| 80 // DriveResourceData initialization later in UpdateFromFeed(). | |
| 81 std::string root_resource_id; | |
| 82 }; | 79 }; |
| 83 | 80 |
| 84 // Defines set of parameters sent to callback OnProtoLoaded(). | 81 // Defines set of parameters sent to callback OnProtoLoaded(). |
| 85 struct LoadRootFeedParams { | 82 struct LoadRootFeedParams { |
| 86 explicit LoadRootFeedParams(const FileOperationCallback& callback); | 83 explicit LoadRootFeedParams(const FileOperationCallback& callback); |
| 87 ~LoadRootFeedParams(); | 84 ~LoadRootFeedParams(); |
| 88 | 85 |
| 89 std::string proto; | 86 std::string proto; |
| 90 DriveFileError load_error; | 87 DriveFileError load_error; |
| 91 base::Time last_modified; | 88 base::Time last_modified; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 // Retrieves account metadata and determines from the last change timestamp | 131 // Retrieves account metadata and determines from the last change timestamp |
| 135 // if the feed content loading from the server needs to be initiated. | 132 // if the feed content loading from the server needs to be initiated. |
| 136 // |callback| must not be null. | 133 // |callback| must not be null. |
| 137 void ReloadFromServerIfNeeded(const FileOperationCallback& callback); | 134 void ReloadFromServerIfNeeded(const FileOperationCallback& callback); |
| 138 | 135 |
| 139 // Updates whole directory structure feeds collected in |feed_list|. | 136 // Updates whole directory structure feeds collected in |feed_list|. |
| 140 // Record file statistics as UMA histograms. | 137 // Record file statistics as UMA histograms. |
| 141 // | 138 // |
| 142 // See comments at DriveFeedProcessor::ApplyFeeds() for | 139 // See comments at DriveFeedProcessor::ApplyFeeds() for |
| 143 // |start_changestamp| and |root_feed_changestamp|. | 140 // |start_changestamp| and |root_feed_changestamp|. |
| 144 // |root_resource_id| is used for Drive API. | |
| 145 void UpdateFromFeed( | 141 void UpdateFromFeed( |
| 146 const ScopedVector<google_apis::DocumentFeed>& feed_list, | 142 const ScopedVector<google_apis::DocumentFeed>& feed_list, |
| 147 int64 start_changestamp, | 143 int64 start_changestamp, |
| 148 int64 root_feed_changestamp, | 144 int64 root_feed_changestamp); |
| 149 const std::string& root_resource_id); | |
| 150 | 145 |
| 151 // Indicates whether there is a feed refreshing server request is in flight. | 146 // Indicates whether there is a feed refreshing server request is in flight. |
| 152 bool refreshing() const { return refreshing_; } | 147 bool refreshing() const { return refreshing_; } |
| 153 | 148 |
| 154 private: | 149 private: |
| 155 // Starts root feed load from the server, with details specified in |params|. | 150 // Starts root feed load from the server, with details specified in |params|. |
| 156 void LoadFromServer(scoped_ptr<LoadFeedParams> params); | 151 void LoadFromServer(scoped_ptr<LoadFeedParams> params); |
| 157 | 152 |
| 158 // Callback for handling root directory refresh from the cache. | 153 // Callback for handling root directory refresh from the cache. |
| 159 void OnProtoLoaded(LoadRootFeedParams* params); | 154 void OnProtoLoaded(LoadRootFeedParams* params); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 | 230 |
| 236 // Note: This should remain the last member so it'll be destroyed and | 231 // Note: This should remain the last member so it'll be destroyed and |
| 237 // invalidate its weak pointers before any other members are destroyed. | 232 // invalidate its weak pointers before any other members are destroyed. |
| 238 base::WeakPtrFactory<DriveFeedLoader> weak_ptr_factory_; | 233 base::WeakPtrFactory<DriveFeedLoader> weak_ptr_factory_; |
| 239 DISALLOW_COPY_AND_ASSIGN(DriveFeedLoader); | 234 DISALLOW_COPY_AND_ASSIGN(DriveFeedLoader); |
| 240 }; | 235 }; |
| 241 | 236 |
| 242 } // namespace drive | 237 } // namespace drive |
| 243 | 238 |
| 244 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FEED_LOADER_H_ | 239 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FEED_LOADER_H_ |
| OLD | NEW |