| 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/chromeos/gdata/gdata_download_observer.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 11 #include "base/supports_user_data.h" | 11 #include "base/supports_user_data.h" |
| 12 #include "chrome/browser/chromeos/gdata/drive.pb.h" | 12 #include "chrome/browser/chromeos/gdata/drive.pb.h" |
| 13 #include "chrome/browser/chromeos/gdata/drive_file_system_interface.h" | 13 #include "chrome/browser/chromeos/gdata/drive_file_system_interface.h" |
| 14 #include "chrome/browser/chromeos/gdata/drive_service_interface.h" | 14 #include "chrome/browser/chromeos/gdata/drive_service_interface.h" |
| 15 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" | 15 #include "chrome/browser/chromeos/gdata/drive_system_service.h" |
| 16 #include "chrome/browser/chromeos/gdata/gdata_upload_file_info.h" | 16 #include "chrome/browser/chromeos/gdata/gdata_upload_file_info.h" |
| 17 #include "chrome/browser/chromeos/gdata/gdata_uploader.h" | 17 #include "chrome/browser/chromeos/gdata/gdata_uploader.h" |
| 18 #include "chrome/browser/chromeos/gdata/gdata_util.h" | 18 #include "chrome/browser/chromeos/gdata/gdata_util.h" |
| 19 #include "chrome/browser/chromeos/gdata/gdata_wapi_parser.h" | 19 #include "chrome/browser/chromeos/gdata/gdata_wapi_parser.h" |
| 20 #include "chrome/browser/download/download_completion_blocker.h" | 20 #include "chrome/browser/download/download_completion_blocker.h" |
| 21 #include "chrome/browser/profiles/profile_manager.h" | 21 #include "chrome/browser/profiles/profile_manager.h" |
| 22 #include "net/base/net_util.h" | 22 #include "net/base/net_util.h" |
| 23 | 23 |
| 24 using content::BrowserThread; | 24 using content::BrowserThread; |
| 25 using content::DownloadManager; | 25 using content::DownloadManager; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 return static_cast<GDataUserData*>( | 96 return static_cast<GDataUserData*>( |
| 97 download->GetUserData(&kGDataPathKey)); | 97 download->GetUserData(&kGDataPathKey)); |
| 98 } | 98 } |
| 99 | 99 |
| 100 void RunSubstituteGDataDownloadCallback( | 100 void RunSubstituteGDataDownloadCallback( |
| 101 const GDataDownloadObserver::SubstituteGDataDownloadPathCallback& callback, | 101 const GDataDownloadObserver::SubstituteGDataDownloadPathCallback& callback, |
| 102 const FilePath* file_path) { | 102 const FilePath* file_path) { |
| 103 callback.Run(*file_path); | 103 callback.Run(*file_path); |
| 104 } | 104 } |
| 105 | 105 |
| 106 GDataSystemService* GetSystemService(Profile* profile) { | 106 DriveSystemService* GetSystemService(Profile* profile) { |
| 107 GDataSystemService* system_service = | 107 DriveSystemService* system_service = |
| 108 GDataSystemServiceFactory::GetForProfile( | 108 DriveSystemServiceFactory::GetForProfile( |
| 109 profile ? profile : ProfileManager::GetDefaultProfile()); | 109 profile ? profile : ProfileManager::GetDefaultProfile()); |
| 110 DCHECK(system_service); | 110 DCHECK(system_service); |
| 111 return system_service; | 111 return system_service; |
| 112 } | 112 } |
| 113 | 113 |
| 114 // Substitutes virtual gdata path for local temporary path. | 114 // Substitutes virtual gdata path for local temporary path. |
| 115 void SubstituteGDataDownloadPathInternal(Profile* profile, | 115 void SubstituteGDataDownloadPathInternal(Profile* profile, |
| 116 const GDataDownloadObserver::SubstituteGDataDownloadPathCallback& | 116 const GDataDownloadObserver::SubstituteGDataDownloadPathCallback& |
| 117 callback) { | 117 callback) { |
| 118 DVLOG(1) << "SubstituteGDataDownloadPathInternal"; | 118 DVLOG(1) << "SubstituteGDataDownloadPathInternal"; |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 file_system_->AddUploadedFile(UPLOAD_NEW_FILE, | 665 file_system_->AddUploadedFile(UPLOAD_NEW_FILE, |
| 666 upload_data->virtual_dir_path(), | 666 upload_data->virtual_dir_path(), |
| 667 entry.Pass(), | 667 entry.Pass(), |
| 668 download->GetTargetFilePath(), | 668 download->GetTargetFilePath(), |
| 669 DriveCache::FILE_OPERATION_MOVE, | 669 DriveCache::FILE_OPERATION_MOVE, |
| 670 base::Bind(&base::DoNothing)); | 670 base::Bind(&base::DoNothing)); |
| 671 } | 671 } |
| 672 } | 672 } |
| 673 | 673 |
| 674 } // namespace gdata | 674 } // namespace gdata |
| OLD | NEW |