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