| 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/fake_drive_service.h" | 5 #include "chrome/browser/google_apis/fake_drive_service.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 base::Bind(callback, | 333 base::Bind(callback, |
| 334 HTTP_SUCCESS, | 334 HTTP_SUCCESS, |
| 335 base::Passed(&resource_list))); | 335 base::Passed(&resource_list))); |
| 336 } | 336 } |
| 337 | 337 |
| 338 void FakeDriveService::GetAllResourceList( | 338 void FakeDriveService::GetAllResourceList( |
| 339 const GetResourceListCallback& callback) { | 339 const GetResourceListCallback& callback) { |
| 340 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 340 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 341 DCHECK(!callback.is_null()); | 341 DCHECK(!callback.is_null()); |
| 342 | 342 |
| 343 GetResourceList(GURL(), // no next feed | 343 GetResourceList(GURL(), // no next feed |
| 344 0, // start changestamp | 344 0, // start changestamp |
| 345 "", // empty search query | 345 std::string(), // empty search query |
| 346 "", // no directory resource id, | 346 std::string(), // no directory resource id, |
| 347 callback); | 347 callback); |
| 348 } | 348 } |
| 349 | 349 |
| 350 void FakeDriveService::GetResourceListInDirectory( | 350 void FakeDriveService::GetResourceListInDirectory( |
| 351 const std::string& directory_resource_id, | 351 const std::string& directory_resource_id, |
| 352 const GetResourceListCallback& callback) { | 352 const GetResourceListCallback& callback) { |
| 353 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 353 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 354 DCHECK(!directory_resource_id.empty()); | 354 DCHECK(!directory_resource_id.empty()); |
| 355 DCHECK(!callback.is_null()); | 355 DCHECK(!callback.is_null()); |
| 356 | 356 |
| 357 GetResourceList(GURL(), // no next feed | 357 GetResourceList(GURL(), // no next feed |
| 358 0, // start changestamp | 358 0, // start changestamp |
| 359 "", // empty search query | 359 std::string(), // empty search query |
| 360 directory_resource_id, | 360 directory_resource_id, |
| 361 callback); | 361 callback); |
| 362 } | 362 } |
| 363 | 363 |
| 364 void FakeDriveService::Search(const std::string& search_query, | 364 void FakeDriveService::Search(const std::string& search_query, |
| 365 const GetResourceListCallback& callback) { | 365 const GetResourceListCallback& callback) { |
| 366 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 366 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 367 DCHECK(!search_query.empty()); | 367 DCHECK(!search_query.empty()); |
| 368 DCHECK(!callback.is_null()); | 368 DCHECK(!callback.is_null()); |
| 369 | 369 |
| 370 GetResourceList(GURL(), // no next feed | 370 GetResourceList(GURL(), // no next feed |
| 371 0, // start changestamp | 371 0, // start changestamp |
| 372 search_query, | 372 search_query, |
| 373 "", // no directory resource id, | 373 std::string(), // no directory resource id, |
| 374 callback); | 374 callback); |
| 375 } | 375 } |
| 376 | 376 |
| 377 void FakeDriveService::SearchInDirectory( | 377 void FakeDriveService::SearchInDirectory( |
| 378 const std::string& search_query, | 378 const std::string& search_query, |
| 379 const std::string& directory_resource_id, | 379 const std::string& directory_resource_id, |
| 380 const GetResourceListCallback& callback) { | 380 const GetResourceListCallback& callback) { |
| 381 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 381 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 382 DCHECK(!search_query.empty()); | 382 DCHECK(!search_query.empty()); |
| 383 DCHECK(!directory_resource_id.empty()); | 383 DCHECK(!directory_resource_id.empty()); |
| 384 DCHECK(!callback.is_null()); | 384 DCHECK(!callback.is_null()); |
| 385 | 385 |
| 386 GetResourceList(GURL(), // no next feed | 386 GetResourceList(GURL(), // no next feed |
| 387 0, // start changestamp | 387 0, // start changestamp |
| 388 search_query, | 388 search_query, |
| 389 directory_resource_id, | 389 directory_resource_id, |
| 390 callback); | 390 callback); |
| 391 } | 391 } |
| 392 | 392 |
| 393 void FakeDriveService::GetChangeList(int64 start_changestamp, | 393 void FakeDriveService::GetChangeList(int64 start_changestamp, |
| 394 const GetResourceListCallback& callback) { | 394 const GetResourceListCallback& callback) { |
| 395 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 395 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 396 DCHECK(!callback.is_null()); | 396 DCHECK(!callback.is_null()); |
| 397 | 397 |
| 398 GetResourceList(GURL(), // no next feed | 398 GetResourceList(GURL(), // no next feed |
| 399 start_changestamp, | 399 start_changestamp, |
| 400 "", // empty search query | 400 std::string(), // empty search query |
| 401 "", // no directory resource id, | 401 std::string(), // no directory resource id, |
| 402 callback); | 402 callback); |
| 403 } | 403 } |
| 404 | 404 |
| 405 void FakeDriveService::ContinueGetResourceList( | 405 void FakeDriveService::ContinueGetResourceList( |
| 406 const GURL& override_url, | 406 const GURL& override_url, |
| 407 const GetResourceListCallback& callback) { | 407 const GetResourceListCallback& callback) { |
| 408 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 408 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 409 DCHECK(!callback.is_null()); | 409 DCHECK(!callback.is_null()); |
| 410 | 410 |
| 411 // TODO(hidehiko): Implement this. | 411 // TODO(hidehiko): Implement this. |
| (...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1240 | 1240 |
| 1241 base::DictionaryValue* raw_new_entry = new_entry.release(); | 1241 base::DictionaryValue* raw_new_entry = new_entry.release(); |
| 1242 base::ListValue* entries = NULL; | 1242 base::ListValue* entries = NULL; |
| 1243 if (resource_list_dict->GetList("entry", &entries)) | 1243 if (resource_list_dict->GetList("entry", &entries)) |
| 1244 entries->Append(raw_new_entry); | 1244 entries->Append(raw_new_entry); |
| 1245 | 1245 |
| 1246 return raw_new_entry; | 1246 return raw_new_entry; |
| 1247 } | 1247 } |
| 1248 | 1248 |
| 1249 } // namespace google_apis | 1249 } // namespace google_apis |
| OLD | NEW |