| 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_CHANGE_LIST_LOADER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_CHANGE_LIST_LOADER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_CHANGE_LIST_LOADER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_CHANGE_LIST_LOADER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 // Starts retrieving search results for |search_query| from the server. | 82 // Starts retrieving search results for |search_query| from the server. |
| 83 // If |next_feed| is set, this is the feed url that will be fetched. | 83 // If |next_feed| is set, this is the feed url that will be fetched. |
| 84 // If |next_feed| is an empty string, the default URL is used. | 84 // If |next_feed| is an empty string, the default URL is used. |
| 85 // Upon completion, |callback| is invoked. | 85 // Upon completion, |callback| is invoked. |
| 86 // |callback| must not be null. | 86 // |callback| must not be null. |
| 87 void SearchFromServer(const std::string& search_query, | 87 void SearchFromServer(const std::string& search_query, |
| 88 const GURL& next_feed, | 88 const GURL& next_feed, |
| 89 const LoadFeedListCallback& callback); | 89 const LoadFeedListCallback& callback); |
| 90 | 90 |
| 91 // Initiates the change list loading from the server if the local | 91 // Checks for updates on the server. Does nothing if the change list is now |
| 92 // changestamp is older than the server changestamp. | 92 // being loaded or refreshed. |callback| must not be null. |
| 93 // See the comment at Load() for |directory_fetch_info| parameter. | 93 void CheckForUpdates(const FileOperationCallback& callback); |
| 94 // |callback| must not be null. | |
| 95 // TODO(satorux): make this private. crbug.com/193417 | |
| 96 void LoadFromServerIfNeeded(const DirectoryFetchInfo& directory_fetch_info, | |
| 97 const FileOperationCallback& callback); | |
| 98 | 94 |
| 99 // Updates whole directory structure feeds collected in |feed_list|. | 95 // Updates whole directory structure feeds collected in |feed_list|. |
| 100 // Record file statistics as UMA histograms. | 96 // Record file statistics as UMA histograms. |
| 101 // | 97 // |
| 102 // See comments at ChangeListProcessor::ApplyFeeds() for | 98 // See comments at ChangeListProcessor::ApplyFeeds() for |
| 103 // |about_resource| and |is_delta_feed|. | 99 // |about_resource| and |is_delta_feed|. |
| 104 // |update_finished_callback| must not be null. | 100 // |update_finished_callback| must not be null. |
| 105 void UpdateFromFeed(scoped_ptr<google_apis::AboutResource> about_resource, | 101 void UpdateFromFeed(scoped_ptr<google_apis::AboutResource> about_resource, |
| 106 ScopedVector<ChangeList> change_lists, | 102 ScopedVector<ChangeList> change_lists, |
| 107 bool is_delta_feed, | 103 bool is_delta_feed, |
| 108 const base::Closure& update_finished_callback); | 104 const base::Closure& update_finished_callback); |
| 109 | 105 |
| 110 // Indicates whether there is a feed refreshing server request is in flight. | 106 // Indicates whether there is a feed refreshing server request is in flight. |
| 111 bool refreshing() const { return refreshing_; } | 107 bool refreshing() const { return refreshing_; } |
| 112 | 108 |
| 113 private: | 109 private: |
| 110 // Initiates the change list loading from the server if the local |
| 111 // changestamp is older than the server changestamp. |
| 112 // See the comment at Load() for |directory_fetch_info| parameter. |
| 113 // |callback| must not be null. |
| 114 void LoadFromServerIfNeeded(const DirectoryFetchInfo& directory_fetch_info, |
| 115 const FileOperationCallback& callback); |
| 116 |
| 114 // Checks the local changestamp. |callback| must not be null. | 117 // Checks the local changestamp. |callback| must not be null. |
| 115 void CheckLocalChangestamp(const GetChangestampCallback& callback); | 118 void CheckLocalChangestamp(const GetChangestampCallback& callback); |
| 116 | 119 |
| 117 // Part of Load(). Called after checking the local changestamp completes. | 120 // Part of Load(). Called after checking the local changestamp completes. |
| 118 void LoadAfterCheckLocalChangestamp( | 121 void LoadAfterCheckLocalChangestamp( |
| 119 const DirectoryFetchInfo& directory_fetch_info, | 122 const DirectoryFetchInfo& directory_fetch_info, |
| 120 const FileOperationCallback& callback, | 123 const FileOperationCallback& callback, |
| 121 int64 local_changestamp); | 124 int64 local_changestamp); |
| 122 | 125 |
| 123 // Callback to fetch all the resource list response from the server. | 126 // Callback to fetch all the resource list response from the server. |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 | 300 |
| 298 // Note: This should remain the last member so it'll be destroyed and | 301 // Note: This should remain the last member so it'll be destroyed and |
| 299 // invalidate its weak pointers before any other members are destroyed. | 302 // invalidate its weak pointers before any other members are destroyed. |
| 300 base::WeakPtrFactory<ChangeListLoader> weak_ptr_factory_; | 303 base::WeakPtrFactory<ChangeListLoader> weak_ptr_factory_; |
| 301 DISALLOW_COPY_AND_ASSIGN(ChangeListLoader); | 304 DISALLOW_COPY_AND_ASSIGN(ChangeListLoader); |
| 302 }; | 305 }; |
| 303 | 306 |
| 304 } // namespace drive | 307 } // namespace drive |
| 305 | 308 |
| 306 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_CHANGE_LIST_LOADER_H_ | 309 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_CHANGE_LIST_LOADER_H_ |
| OLD | NEW |