| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/chromeos/drive/fake_file_system.h" | 5 #include "chrome/browser/chromeos/drive/fake_file_system.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 completion_callback.Run(error); | 288 completion_callback.Run(error); |
| 289 return; | 289 return; |
| 290 } | 290 } |
| 291 DCHECK(gdata_entry); | 291 DCHECK(gdata_entry); |
| 292 | 292 |
| 293 scoped_ptr<ResourceEntry> entry( | 293 scoped_ptr<ResourceEntry> entry( |
| 294 new ResourceEntry(ConvertToResourceEntry(*gdata_entry))); | 294 new ResourceEntry(ConvertToResourceEntry(*gdata_entry))); |
| 295 | 295 |
| 296 base::FilePath cache_path = | 296 base::FilePath cache_path = |
| 297 cache_dir_.path().AppendASCII(entry->resource_id()); | 297 cache_dir_.path().AppendASCII(entry->resource_id()); |
| 298 if (file_util::PathExists(cache_path)) { | 298 if (base::PathExists(cache_path)) { |
| 299 // Cache file is found. | 299 // Cache file is found. |
| 300 initialized_callback.Run(FILE_ERROR_OK, entry.Pass(), cache_path, | 300 initialized_callback.Run(FILE_ERROR_OK, entry.Pass(), cache_path, |
| 301 base::Closure()); | 301 base::Closure()); |
| 302 completion_callback.Run(FILE_ERROR_OK); | 302 completion_callback.Run(FILE_ERROR_OK); |
| 303 return; | 303 return; |
| 304 } | 304 } |
| 305 | 305 |
| 306 initialized_callback.Run(FILE_ERROR_OK, entry.Pass(), base::FilePath(), | 306 initialized_callback.Run(FILE_ERROR_OK, entry.Pass(), base::FilePath(), |
| 307 base::Bind(&base::DoNothing)); | 307 base::Bind(&base::DoNothing)); |
| 308 drive_service_->DownloadFile( | 308 drive_service_->DownloadFile( |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 callback.Run(FILE_ERROR_OK, entry.Pass()); | 388 callback.Run(FILE_ERROR_OK, entry.Pass()); |
| 389 return; | 389 return; |
| 390 } | 390 } |
| 391 } | 391 } |
| 392 | 392 |
| 393 callback.Run(FILE_ERROR_NOT_FOUND, scoped_ptr<ResourceEntry>()); | 393 callback.Run(FILE_ERROR_NOT_FOUND, scoped_ptr<ResourceEntry>()); |
| 394 } | 394 } |
| 395 | 395 |
| 396 } // namespace test_util | 396 } // namespace test_util |
| 397 } // namespace drive | 397 } // namespace drive |
| OLD | NEW |