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 #include "chrome/browser/google_apis/gdata_wapi_service.h" | 5 #include "chrome/browser/google_apis/gdata_wapi_service.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // Because GData WAPI support is expected to be gone somehow soon by migration | 192 // Because GData WAPI support is expected to be gone somehow soon by migration |
193 // to the Drive API v2, so we'll reuse GetResourceListOperation to implement | 193 // to the Drive API v2, so we'll reuse GetResourceListOperation to implement |
194 // following methods, instead of cleaning the operation class. | 194 // following methods, instead of cleaning the operation class. |
195 | 195 |
196 void GDataWapiService::GetAllResourceList( | 196 void GDataWapiService::GetAllResourceList( |
197 const GetResourceListCallback& callback) { | 197 const GetResourceListCallback& callback) { |
198 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 198 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
199 DCHECK(!callback.is_null()); | 199 DCHECK(!callback.is_null()); |
200 | 200 |
201 runner_->StartOperationWithRetry( | 201 runner_->StartOperationWithRetry( |
202 new GetResourceListOperation( | 202 new GetResourceListOperation(operation_registry(), |
203 operation_registry(), | 203 url_request_context_getter_, |
204 url_request_context_getter_, | 204 url_generator_, |
205 url_generator_, | 205 GURL(), // No override url |
206 GURL(), // No override url | 206 0, // start changestamp |
207 0, // start changestamp | 207 std::string(), // empty search query |
208 "", // empty search query | 208 std::string(), // no directory resource id |
209 "", // no directory resource id | 209 callback)); |
210 callback)); | |
211 } | 210 } |
212 | 211 |
213 void GDataWapiService::GetResourceListInDirectory( | 212 void GDataWapiService::GetResourceListInDirectory( |
214 const std::string& directory_resource_id, | 213 const std::string& directory_resource_id, |
215 const GetResourceListCallback& callback) { | 214 const GetResourceListCallback& callback) { |
216 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 215 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
217 DCHECK(!directory_resource_id.empty()); | 216 DCHECK(!directory_resource_id.empty()); |
218 DCHECK(!callback.is_null()); | 217 DCHECK(!callback.is_null()); |
219 | 218 |
220 runner_->StartOperationWithRetry( | 219 runner_->StartOperationWithRetry( |
221 new GetResourceListOperation( | 220 new GetResourceListOperation(operation_registry(), |
222 operation_registry(), | 221 url_request_context_getter_, |
223 url_request_context_getter_, | 222 url_generator_, |
224 url_generator_, | 223 GURL(), // No override url |
225 GURL(), // No override url | 224 0, // start changestamp |
226 0, // start changestamp | 225 std::string(), // empty search query |
227 "", // empty search query | 226 directory_resource_id, |
228 directory_resource_id, | 227 callback)); |
229 callback)); | |
230 } | 228 } |
231 | 229 |
232 void GDataWapiService::Search(const std::string& search_query, | 230 void GDataWapiService::Search(const std::string& search_query, |
233 const GetResourceListCallback& callback) { | 231 const GetResourceListCallback& callback) { |
234 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 232 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
235 DCHECK(!search_query.empty()); | 233 DCHECK(!search_query.empty()); |
236 DCHECK(!callback.is_null()); | 234 DCHECK(!callback.is_null()); |
237 | 235 |
238 runner_->StartOperationWithRetry( | 236 runner_->StartOperationWithRetry( |
239 new GetResourceListOperation( | 237 new GetResourceListOperation(operation_registry(), |
240 operation_registry(), | 238 url_request_context_getter_, |
241 url_request_context_getter_, | 239 url_generator_, |
242 url_generator_, | 240 GURL(), // No override url |
243 GURL(), // No override url | 241 0, // start changestamp |
244 0, // start changestamp | 242 search_query, |
245 search_query, | 243 std::string(), // no directory resource id |
246 "", // no directory resource id | 244 callback)); |
247 callback)); | |
248 } | 245 } |
249 | 246 |
250 void GDataWapiService::SearchInDirectory( | 247 void GDataWapiService::SearchInDirectory( |
251 const std::string& search_query, | 248 const std::string& search_query, |
252 const std::string& directory_resource_id, | 249 const std::string& directory_resource_id, |
253 const GetResourceListCallback& callback) { | 250 const GetResourceListCallback& callback) { |
254 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 251 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
255 DCHECK(!search_query.empty()); | 252 DCHECK(!search_query.empty()); |
256 DCHECK(!directory_resource_id.empty()); | 253 DCHECK(!directory_resource_id.empty()); |
257 DCHECK(!callback.is_null()); | 254 DCHECK(!callback.is_null()); |
258 | 255 |
259 runner_->StartOperationWithRetry( | 256 runner_->StartOperationWithRetry( |
260 new GetResourceListOperation( | 257 new GetResourceListOperation( |
261 operation_registry(), | 258 operation_registry(), |
262 url_request_context_getter_, | 259 url_request_context_getter_, |
263 url_generator_, | 260 url_generator_, |
264 GURL(), // No override url | 261 GURL(), // No override url |
265 0, // start changestamp | 262 0, // start changestamp |
266 search_query, | 263 search_query, |
267 directory_resource_id, | 264 directory_resource_id, |
268 callback)); | 265 callback)); |
269 } | 266 } |
270 | 267 |
271 void GDataWapiService::GetChangeList(int64 start_changestamp, | 268 void GDataWapiService::GetChangeList(int64 start_changestamp, |
272 const GetResourceListCallback& callback) { | 269 const GetResourceListCallback& callback) { |
273 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 270 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
274 DCHECK(!callback.is_null()); | 271 DCHECK(!callback.is_null()); |
275 | 272 |
276 runner_->StartOperationWithRetry( | 273 runner_->StartOperationWithRetry( |
277 new GetResourceListOperation( | 274 new GetResourceListOperation(operation_registry(), |
278 operation_registry(), | 275 url_request_context_getter_, |
279 url_request_context_getter_, | 276 url_generator_, |
280 url_generator_, | 277 GURL(), // No override url |
281 GURL(), // No override url | 278 start_changestamp, |
282 start_changestamp, | 279 std::string(), // empty search query |
283 "", // empty search query | 280 std::string(), // no directory resource id |
284 "", // no directory resource id | 281 callback)); |
285 callback)); | |
286 } | 282 } |
287 | 283 |
288 void GDataWapiService::ContinueGetResourceList( | 284 void GDataWapiService::ContinueGetResourceList( |
289 const GURL& override_url, | 285 const GURL& override_url, |
290 const GetResourceListCallback& callback) { | 286 const GetResourceListCallback& callback) { |
291 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 287 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
292 DCHECK(!override_url.is_empty()); | 288 DCHECK(!override_url.is_empty()); |
293 DCHECK(!callback.is_null()); | 289 DCHECK(!callback.is_null()); |
294 | 290 |
295 runner_->StartOperationWithRetry( | 291 runner_->StartOperationWithRetry( |
296 new GetResourceListOperation( | 292 new GetResourceListOperation(operation_registry(), |
297 operation_registry(), | 293 url_request_context_getter_, |
298 url_request_context_getter_, | 294 url_generator_, |
299 url_generator_, | 295 override_url, |
300 override_url, | 296 0, // start changestamp |
301 0, // start changestamp | 297 std::string(), // empty search query |
302 "", // empty search query | 298 std::string(), // no directory resource id |
303 "", // no directory resource id | 299 callback)); |
304 callback)); | |
305 } | 300 } |
306 | 301 |
307 void GDataWapiService::GetResourceEntry( | 302 void GDataWapiService::GetResourceEntry( |
308 const std::string& resource_id, | 303 const std::string& resource_id, |
309 const GetResourceEntryCallback& callback) { | 304 const GetResourceEntryCallback& callback) { |
310 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 305 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
311 DCHECK(!callback.is_null()); | 306 DCHECK(!callback.is_null()); |
312 | 307 |
313 runner_->StartOperationWithRetry( | 308 runner_->StartOperationWithRetry( |
314 new GetResourceEntryOperation( | 309 new GetResourceEntryOperation( |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 } | 619 } |
625 | 620 |
626 void GDataWapiService::OnProgressUpdate( | 621 void GDataWapiService::OnProgressUpdate( |
627 const OperationProgressStatusList& list) { | 622 const OperationProgressStatusList& list) { |
628 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 623 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
629 FOR_EACH_OBSERVER( | 624 FOR_EACH_OBSERVER( |
630 DriveServiceObserver, observers_, OnProgressUpdate(list)); | 625 DriveServiceObserver, observers_, OnProgressUpdate(list)); |
631 } | 626 } |
632 | 627 |
633 } // namespace google_apis | 628 } // namespace google_apis |
OLD | NEW |