Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(776)

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_wapi_feed_loader.h

Issue 10823226: Get AboutResource as account metadata for Drive V2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_GDATA_GDATA_WAPI_FEED_LOADER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_WAPI_FEED_LOADER_H_
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_WAPI_FEED_LOADER_H_ 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_WAPI_FEED_LOADER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/observer_list.h" 10 #include "base/observer_list.h"
11 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h" 11 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h"
12 #include "chrome/browser/chromeos/gdata/gdata_files.h" 12 #include "chrome/browser/chromeos/gdata/gdata_files.h"
13 13
14 namespace gdata { 14 namespace gdata {
15 15
16 class DriveWebAppsRegistryInterface; 16 class DriveWebAppsRegistryInterface;
17 class DocumentsServiceInterface; 17 class DocumentsServiceInterface;
18 class GDataCache; 18 class GDataCache;
19 struct GetDocumentsUiState; 19 struct GetDocumentsUiState;
20 20
21 // Set of parameters sent to LoadDocumentFeedCallback callback. 21 // Set of parameters sent to LoadDocumentFeedCallback callback.
22 struct GetDocumentsParams { 22 struct GetDocumentsParams {
23 GetDocumentsParams(int start_changestamp, 23 GetDocumentsParams(int64 start_changestamp,
24 int root_feed_changestamp, 24 int64 root_feed_changestamp,
25 std::vector<DocumentFeed*>* feed_list, 25 std::vector<DocumentFeed*>* feed_list,
26 bool should_fetch_multiple_feeds, 26 bool should_fetch_multiple_feeds,
27 const FilePath& search_file_path, 27 const FilePath& search_file_path,
28 const std::string& search_query, 28 const std::string& search_query,
29 const std::string& directory_resource_id, 29 const std::string& directory_resource_id,
30 const FindEntryCallback& callback, 30 const FindEntryCallback& callback,
31 GetDocumentsUiState* ui_state); 31 GetDocumentsUiState* ui_state);
32 ~GetDocumentsParams(); 32 ~GetDocumentsParams();
33 33
34 // Changestamps are positive numbers in increasing order. The difference 34 // Changestamps are positive numbers in increasing order. The difference
35 // between two changestamps is proportional equal to number of items in 35 // between two changestamps is proportional equal to number of items in
36 // delta feed between them - bigger the difference, more likely bigger 36 // delta feed between them - bigger the difference, more likely bigger
37 // number of items in delta feeds. 37 // number of items in delta feeds.
38 int start_changestamp; 38 int64 start_changestamp;
39 int root_feed_changestamp; 39 int64 root_feed_changestamp;
40 scoped_ptr<std::vector<DocumentFeed*> > feed_list; 40 scoped_ptr<std::vector<DocumentFeed*> > feed_list;
41 // Should we stop after getting first feed chunk, even if there is more 41 // Should we stop after getting first feed chunk, even if there is more
42 // data. 42 // data.
43 bool should_fetch_multiple_feeds; 43 bool should_fetch_multiple_feeds;
44 FilePath search_file_path; 44 FilePath search_file_path;
45 std::string search_query; 45 std::string search_query;
46 std::string directory_resource_id; 46 std::string directory_resource_id;
47 FindEntryCallback callback; 47 FindEntryCallback callback;
48 scoped_ptr<GetDocumentsUiState> ui_state; 48 scoped_ptr<GetDocumentsUiState> ui_state;
49 }; 49 };
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // |entry_found_callback| is used only when this is invoked while searching 107 // |entry_found_callback| is used only when this is invoked while searching
108 // for file info, and is used in |load_feed_callback|. If successful, it will 108 // for file info, and is used in |load_feed_callback|. If successful, it will
109 // try to find the file upon retrieval completion. 109 // try to find the file upon retrieval completion.
110 // |should_fetch_multiple_feeds| is true iff don't want to stop feed loading 110 // |should_fetch_multiple_feeds| is true iff don't want to stop feed loading
111 // after we retrieve first feed chunk. 111 // after we retrieve first feed chunk.
112 // If invoked as a part of content search, query will be set in 112 // If invoked as a part of content search, query will be set in
113 // |search_query|. 113 // |search_query|.
114 // If |feed_to_load| is set, this is feed url that will be used to load feed. 114 // If |feed_to_load| is set, this is feed url that will be used to load feed.
115 void LoadFromServer( 115 void LoadFromServer(
116 ContentOrigin initial_origin, 116 ContentOrigin initial_origin,
117 int start_changestamp, 117 int64 start_changestamp,
118 int root_feed_changestamp, 118 int64 root_feed_changestamp,
119 bool should_fetch_multiple_feeds, 119 bool should_fetch_multiple_feeds,
120 const FilePath& search_file_path, 120 const FilePath& search_file_path,
121 const std::string& search_query, 121 const std::string& search_query,
122 const GURL& feed_to_load, 122 const GURL& feed_to_load,
123 const std::string& directory_resource_id, 123 const std::string& directory_resource_id,
124 const FindEntryCallback& entry_found_callback, 124 const FindEntryCallback& entry_found_callback,
125 const LoadDocumentFeedCallback& feed_load_callback); 125 const LoadDocumentFeedCallback& feed_load_callback);
126 126
127 // Retrieves account metadata and determines from the last change timestamp 127 // Retrieves account metadata and determines from the last change timestamp
128 // if the feed content loading from the server needs to be initiated. 128 // if the feed content loading from the server needs to be initiated.
129 void ReloadFromServerIfNeeded( 129 void ReloadFromServerIfNeeded(
130 ContentOrigin initial_origin, 130 ContentOrigin initial_origin,
131 int local_changestamp, 131 int64 local_changestamp,
132 const FilePath& search_file_path, 132 const FilePath& search_file_path,
133 const FindEntryCallback& callback); 133 const FindEntryCallback& callback);
134 134
135 // Updates whole directory structure feeds collected in |feed_list|. 135 // Updates whole directory structure feeds collected in |feed_list|.
136 // On success, returns PLATFORM_FILE_OK. Record file statistics as UMA 136 // On success, returns PLATFORM_FILE_OK. Record file statistics as UMA
137 // histograms. 137 // histograms.
138 // 138 //
139 // See comments at GDataWapiFeedProcessor::ApplyFeeds() for 139 // See comments at GDataWapiFeedProcessor::ApplyFeeds() for
140 // |start_changestamp| and |root_feed_changestamp|. 140 // |start_changestamp| and |root_feed_changestamp|.
141 GDataFileError UpdateFromFeed( 141 GDataFileError UpdateFromFeed(
142 const std::vector<DocumentFeed*>& feed_list, 142 const std::vector<DocumentFeed*>& feed_list,
143 int start_changestamp, 143 int64 start_changestamp,
144 int root_feed_changestamp); 144 int64 root_feed_changestamp);
145 145
146 private: 146 private:
147 // Callback for handling root directory refresh from the cache. 147 // Callback for handling root directory refresh from the cache.
148 void OnProtoLoaded(LoadRootFeedParams* params); 148 void OnProtoLoaded(LoadRootFeedParams* params);
149 149
150 // Continues handling root directory refresh after the directory service 150 // Continues handling root directory refresh after the directory service
151 // is fully loaded. 151 // is fully loaded.
152 void ContinueWithInitializedDirectoryService(LoadRootFeedParams* params, 152 void ContinueWithInitializedDirectoryService(LoadRootFeedParams* params,
153 GDataFileError error); 153 GDataFileError error);
154 154
155 // Helper callback for handling results of metadata retrieval initiated from 155 // Helper callback for handling results of metadata retrieval initiated from
156 // ReloadFeedFromServerIfNeeded(). This method makes a decision about fetching 156 // ReloadFeedFromServerIfNeeded(). This method makes a decision about fetching
157 // the content of the root feed during the root directory refresh process. 157 // the content of the root feed during the root directory refresh process.
158 void OnGetAccountMetadata( 158 void OnGetAccountMetadata(
159 ContentOrigin initial_origin, 159 ContentOrigin initial_origin,
160 int local_changestamp, 160 int64 local_changestamp,
161 const FilePath& search_file_path, 161 const FilePath& search_file_path,
162 const FindEntryCallback& callback, 162 const FindEntryCallback& callback,
163 GDataErrorCode status, 163 GDataErrorCode status,
164 scoped_ptr<base::Value> feed_data);
165
166 // Helper callback for handling results of account data retrieval initiated
167 // from ReloadFeedFromServerIfNeeded() for Drive V2 API.
168 // This method makes a decision about fetching the content of the root feed
169 // during the root directory refresh process.
170 void OnGetAboutResource(
171 ContentOrigin initial_origin,
172 int64 local_changestamp,
173 const FilePath& search_file_path,
174 const FindEntryCallback& callback,
175 GDataErrorCode status,
164 scoped_ptr<base::Value> feed_data); 176 scoped_ptr<base::Value> feed_data);
165 177
166 // Callback for handling feed content fetching while searching for file info. 178 // Callback for handling feed content fetching while searching for file info.
167 // This callback is invoked after async feed fetch operation that was 179 // This callback is invoked after async feed fetch operation that was
168 // invoked by StartDirectoryRefresh() completes. This callback will update 180 // invoked by StartDirectoryRefresh() completes. This callback will update
169 // the content of the refreshed directory object and continue initially 181 // the content of the refreshed directory object and continue initially
170 // started FindEntryByPath() request. 182 // started FindEntryByPath() request.
171 void OnFeedFromServerLoaded(GetDocumentsParams* params, 183 void OnFeedFromServerLoaded(GetDocumentsParams* params,
172 GDataFileError error); 184 GDataFileError error);
173 185
(...skipping 23 matching lines...) Expand all
197 209
198 // Note: This should remain the last member so it'll be destroyed and 210 // Note: This should remain the last member so it'll be destroyed and
199 // invalidate its weak pointers before any other members are destroyed. 211 // invalidate its weak pointers before any other members are destroyed.
200 base::WeakPtrFactory<GDataWapiFeedLoader> weak_ptr_factory_; 212 base::WeakPtrFactory<GDataWapiFeedLoader> weak_ptr_factory_;
201 DISALLOW_COPY_AND_ASSIGN(GDataWapiFeedLoader); 213 DISALLOW_COPY_AND_ASSIGN(GDataWapiFeedLoader);
202 }; 214 };
203 215
204 } // namespace gdata 216 } // namespace gdata
205 217
206 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_WAPI_FEED_LOADER_H_ 218 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_WAPI_FEED_LOADER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_files.cc ('k') | chrome/browser/chromeos/gdata/gdata_wapi_feed_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698