| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/extensions/file_manager/private_api_drive.h" | 5 #include "chrome/browser/chromeos/extensions/file_manager/private_api_drive.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> |
| 9 | 10 |
| 10 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 11 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/chromeos/drive/drive_integration_service.h" | 13 #include "chrome/browser/chromeos/drive/drive_integration_service.h" |
| 13 #include "chrome/browser/chromeos/drive/file_system_util.h" | 14 #include "chrome/browser/chromeos/drive/file_system_util.h" |
| 14 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" | 15 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" |
| 15 #include "chrome/browser/chromeos/file_manager/file_tasks.h" | 16 #include "chrome/browser/chromeos/file_manager/file_tasks.h" |
| 16 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" | 17 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" |
| 17 #include "chrome/browser/chromeos/file_manager/url_util.h" | 18 #include "chrome/browser/chromeos/file_manager/url_util.h" |
| 18 #include "chrome/browser/chromeos/file_system_provider/mount_path_util.h" | 19 #include "chrome/browser/chromeos/file_system_provider/mount_path_util.h" |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 } | 363 } |
| 363 } | 364 } |
| 364 | 365 |
| 365 CompleteGetEntryProperties(drive::FILE_ERROR_OK); | 366 CompleteGetEntryProperties(drive::FILE_ERROR_OK); |
| 366 } | 367 } |
| 367 | 368 |
| 368 void CompleteGetEntryProperties(drive::FileError error) { | 369 void CompleteGetEntryProperties(drive::FileError error) { |
| 369 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 370 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 370 DCHECK(!callback_.is_null()); | 371 DCHECK(!callback_.is_null()); |
| 371 | 372 |
| 372 callback_.Run(properties_.Pass(), drive::FileErrorToBaseFileError(error)); | 373 callback_.Run(std::move(properties_), |
| 374 drive::FileErrorToBaseFileError(error)); |
| 373 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, this); | 375 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, this); |
| 374 } | 376 } |
| 375 | 377 |
| 376 // Given parameters. | 378 // Given parameters. |
| 377 const ResultCallback callback_; | 379 const ResultCallback callback_; |
| 378 const base::FilePath local_path_; | 380 const base::FilePath local_path_; |
| 379 Profile* const running_profile_; | 381 Profile* const running_profile_; |
| 380 | 382 |
| 381 // Values used in the process. | 383 // Values used in the process. |
| 382 scoped_ptr<EntryProperties> properties_; | 384 scoped_ptr<EntryProperties> properties_; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 properties_->thumbnail_url.reset(new std::string(*metadata->thumbnail)); | 498 properties_->thumbnail_url.reset(new std::string(*metadata->thumbnail)); |
| 497 } | 499 } |
| 498 | 500 |
| 499 CompleteGetEntryProperties(base::File::FILE_OK); | 501 CompleteGetEntryProperties(base::File::FILE_OK); |
| 500 } | 502 } |
| 501 | 503 |
| 502 void CompleteGetEntryProperties(base::File::Error result) { | 504 void CompleteGetEntryProperties(base::File::Error result) { |
| 503 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 505 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 504 DCHECK(!callback_.is_null()); | 506 DCHECK(!callback_.is_null()); |
| 505 | 507 |
| 506 callback_.Run(properties_.Pass(), result); | 508 callback_.Run(std::move(properties_), result); |
| 507 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, this); | 509 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, this); |
| 508 } | 510 } |
| 509 | 511 |
| 510 // Given parameters. | 512 // Given parameters. |
| 511 const ResultCallback callback_; | 513 const ResultCallback callback_; |
| 512 const storage::FileSystemURL file_system_url_; | 514 const storage::FileSystemURL file_system_url_; |
| 513 const std::set<EntryPropertyName> names_; | 515 const std::set<EntryPropertyName> names_; |
| 514 | 516 |
| 515 // Values used in the process. | 517 // Values used in the process. |
| 516 scoped_ptr<EntryProperties> properties_; | 518 scoped_ptr<EntryProperties> properties_; |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1133 } | 1135 } |
| 1134 | 1136 |
| 1135 const std::string url = | 1137 const std::string url = |
| 1136 download_url_.Resolve("?access_token=" + access_token).spec(); | 1138 download_url_.Resolve("?access_token=" + access_token).spec(); |
| 1137 SetResult(new base::StringValue(url)); | 1139 SetResult(new base::StringValue(url)); |
| 1138 | 1140 |
| 1139 SendResponse(true); | 1141 SendResponse(true); |
| 1140 } | 1142 } |
| 1141 | 1143 |
| 1142 } // namespace extensions | 1144 } // namespace extensions |
| OLD | NEW |