| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 ContentOrigin initial_origin; | 66 ContentOrigin initial_origin; |
| 67 int64 start_changestamp; | 67 int64 start_changestamp; |
| 68 int64 root_feed_changestamp; | 68 int64 root_feed_changestamp; |
| 69 std::string search_query; | 69 std::string search_query; |
| 70 std::string directory_resource_id; | 70 std::string directory_resource_id; |
| 71 GURL feed_to_load; | 71 GURL feed_to_load; |
| 72 const LoadDocumentFeedCallback feed_load_callback; | 72 const LoadDocumentFeedCallback feed_load_callback; |
| 73 FileOperationCallback load_finished_callback; | 73 FileOperationCallback load_finished_callback; |
| 74 ScopedVector<google_apis::DocumentFeed> feed_list; | 74 ScopedVector<google_apis::DocumentFeed> feed_list; |
| 75 scoped_ptr<GetDocumentsUiState> ui_state; | 75 scoped_ptr<GetDocumentsUiState> ui_state; |
| 76 // On initial feed load for Drive API, remember root ID for |
| 77 // DriveResourceData initialization later in UpdateFromFeed(). |
| 78 std::string root_resource_id; |
| 76 }; | 79 }; |
| 77 | 80 |
| 78 // Defines set of parameters sent to callback OnProtoLoaded(). | 81 // Defines set of parameters sent to callback OnProtoLoaded(). |
| 79 struct LoadRootFeedParams { | 82 struct LoadRootFeedParams { |
| 80 LoadRootFeedParams(bool should_load_from_server, | 83 LoadRootFeedParams(bool should_load_from_server, |
| 81 const FileOperationCallback& callback); | 84 const FileOperationCallback& callback); |
| 82 ~LoadRootFeedParams(); | 85 ~LoadRootFeedParams(); |
| 83 | 86 |
| 84 bool should_load_from_server; | 87 bool should_load_from_server; |
| 85 std::string proto; | 88 std::string proto; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 void ReloadFromServerIfNeeded( | 145 void ReloadFromServerIfNeeded( |
| 143 ContentOrigin initial_origin, | 146 ContentOrigin initial_origin, |
| 144 int64 local_changestamp, | 147 int64 local_changestamp, |
| 145 const FileOperationCallback& callback); | 148 const FileOperationCallback& callback); |
| 146 | 149 |
| 147 // Updates whole directory structure feeds collected in |feed_list|. | 150 // Updates whole directory structure feeds collected in |feed_list|. |
| 148 // Record file statistics as UMA histograms. | 151 // Record file statistics as UMA histograms. |
| 149 // | 152 // |
| 150 // See comments at DriveFeedProcessor::ApplyFeeds() for | 153 // See comments at DriveFeedProcessor::ApplyFeeds() for |
| 151 // |start_changestamp| and |root_feed_changestamp|. | 154 // |start_changestamp| and |root_feed_changestamp|. |
| 155 // |root_resource_id| is used for Drive API. |
| 152 void UpdateFromFeed( | 156 void UpdateFromFeed( |
| 153 const ScopedVector<google_apis::DocumentFeed>& feed_list, | 157 const ScopedVector<google_apis::DocumentFeed>& feed_list, |
| 154 int64 start_changestamp, | 158 int64 start_changestamp, |
| 155 int64 root_feed_changestamp); | 159 int64 root_feed_changestamp, |
| 160 const std::string& root_resource_id); |
| 156 | 161 |
| 157 private: | 162 private: |
| 158 // Starts root feed load from the server, with details specified in |params|. | 163 // Starts root feed load from the server, with details specified in |params|. |
| 159 void LoadFromServer(scoped_ptr<LoadFeedParams> params); | 164 void LoadFromServer(scoped_ptr<LoadFeedParams> params); |
| 160 | 165 |
| 161 // Callback for handling root directory refresh from the cache. | 166 // Callback for handling root directory refresh from the cache. |
| 162 void OnProtoLoaded(LoadRootFeedParams* params); | 167 void OnProtoLoaded(LoadRootFeedParams* params); |
| 163 | 168 |
| 164 // Continues handling root directory refresh after the resource metadata | 169 // Continues handling root directory refresh after the resource metadata |
| 165 // is fully loaded. | 170 // is fully loaded. |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 | 244 |
| 240 // Note: This should remain the last member so it'll be destroyed and | 245 // Note: This should remain the last member so it'll be destroyed and |
| 241 // invalidate its weak pointers before any other members are destroyed. | 246 // invalidate its weak pointers before any other members are destroyed. |
| 242 base::WeakPtrFactory<DriveFeedLoader> weak_ptr_factory_; | 247 base::WeakPtrFactory<DriveFeedLoader> weak_ptr_factory_; |
| 243 DISALLOW_COPY_AND_ASSIGN(DriveFeedLoader); | 248 DISALLOW_COPY_AND_ASSIGN(DriveFeedLoader); |
| 244 }; | 249 }; |
| 245 | 250 |
| 246 } // namespace drive | 251 } // namespace drive |
| 247 | 252 |
| 248 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FEED_LOADER_H_ | 253 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FEED_LOADER_H_ |
| OLD | NEW |