| 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 LoadRootFeedParams(bool should_load_from_server, | 86 LoadRootFeedParams(bool should_load_from_server, |
| 84 const FileOperationCallback& callback); | 87 const FileOperationCallback& callback); |
| 85 ~LoadRootFeedParams(); | 88 ~LoadRootFeedParams(); |
| 86 | 89 |
| 87 bool should_load_from_server; | 90 bool should_load_from_server; |
| 88 std::string proto; | 91 std::string proto; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 // Retrieves account metadata and determines from the last change timestamp | 144 // Retrieves account metadata and determines from the last change timestamp |
| 142 // if the feed content loading from the server needs to be initiated. | 145 // if the feed content loading from the server needs to be initiated. |
| 143 void ReloadFromServerIfNeeded(int64 local_changestamp, | 146 void ReloadFromServerIfNeeded(int64 local_changestamp, |
| 144 const FileOperationCallback& callback); | 147 const FileOperationCallback& callback); |
| 145 | 148 |
| 146 // Updates whole directory structure feeds collected in |feed_list|. | 149 // Updates whole directory structure feeds collected in |feed_list|. |
| 147 // Record file statistics as UMA histograms. | 150 // Record file statistics as UMA histograms. |
| 148 // | 151 // |
| 149 // See comments at DriveFeedProcessor::ApplyFeeds() for | 152 // See comments at DriveFeedProcessor::ApplyFeeds() for |
| 150 // |start_changestamp| and |root_feed_changestamp|. | 153 // |start_changestamp| and |root_feed_changestamp|. |
| 154 // |root_resource_id| is used for Drive API. |
| 151 void UpdateFromFeed( | 155 void UpdateFromFeed( |
| 152 const ScopedVector<google_apis::DocumentFeed>& feed_list, | 156 const ScopedVector<google_apis::DocumentFeed>& feed_list, |
| 153 int64 start_changestamp, | 157 int64 start_changestamp, |
| 154 int64 root_feed_changestamp); | 158 int64 root_feed_changestamp, |
| 159 const std::string& root_resource_id); |
| 155 | 160 |
| 156 // Indicates whether there is a feed refreshing server request is in flight. | 161 // Indicates whether there is a feed refreshing server request is in flight. |
| 157 bool refreshing() const { return refreshing_; } | 162 bool refreshing() const { return refreshing_; } |
| 158 | 163 |
| 159 private: | 164 private: |
| 160 // Starts root feed load from the server, with details specified in |params|. | 165 // Starts root feed load from the server, with details specified in |params|. |
| 161 void LoadFromServer(scoped_ptr<LoadFeedParams> params); | 166 void LoadFromServer(scoped_ptr<LoadFeedParams> params); |
| 162 | 167 |
| 163 // Callback for handling root directory refresh from the cache. | 168 // Callback for handling root directory refresh from the cache. |
| 164 void OnProtoLoaded(LoadRootFeedParams* params); | 169 void OnProtoLoaded(LoadRootFeedParams* params); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 | 247 |
| 243 // Note: This should remain the last member so it'll be destroyed and | 248 // Note: This should remain the last member so it'll be destroyed and |
| 244 // invalidate its weak pointers before any other members are destroyed. | 249 // invalidate its weak pointers before any other members are destroyed. |
| 245 base::WeakPtrFactory<DriveFeedLoader> weak_ptr_factory_; | 250 base::WeakPtrFactory<DriveFeedLoader> weak_ptr_factory_; |
| 246 DISALLOW_COPY_AND_ASSIGN(DriveFeedLoader); | 251 DISALLOW_COPY_AND_ASSIGN(DriveFeedLoader); |
| 247 }; | 252 }; |
| 248 | 253 |
| 249 } // namespace drive | 254 } // namespace drive |
| 250 | 255 |
| 251 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FEED_LOADER_H_ | 256 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FEED_LOADER_H_ |
| OLD | NEW |