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 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_DOWNLOAD_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_DOWNLOAD_HANDLER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_DOWNLOAD_HANDLER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_DOWNLOAD_HANDLER_H_ |
7 | 7 |
8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "chrome/browser/chromeos/drive/drive_file_error.h" | 10 #include "chrome/browser/chromeos/drive/drive_file_error.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 const FilePath& drive_path, | 47 const FilePath& drive_path, |
48 content::DownloadItem* download, | 48 content::DownloadItem* download, |
49 const SubstituteDriveDownloadPathCallback& callback); | 49 const SubstituteDriveDownloadPathCallback& callback); |
50 | 50 |
51 // Sets drive path, for example, '/special/drive/MyFolder/MyFile', | 51 // Sets drive path, for example, '/special/drive/MyFolder/MyFile', |
52 // to external data in |download|. Also sets display name and | 52 // to external data in |download|. Also sets display name and |
53 // makes |download| a temporary. | 53 // makes |download| a temporary. |
54 void SetDownloadParams(const FilePath& drive_path, | 54 void SetDownloadParams(const FilePath& drive_path, |
55 content::DownloadItem* download); | 55 content::DownloadItem* download); |
56 | 56 |
57 // Gets the drive_path from external data in |download|. | 57 // Gets the target drive path from external data in |download|. |
58 // GetDrivePath may return an empty path in case SetDrivePath was not | 58 FilePath GetTargetPath(const content::DownloadItem* download); |
59 // previously called or there was some other internal error | |
60 // (there is a DCHECK for this). | |
61 FilePath GetDrivePath(const content::DownloadItem* download); | |
62 | 59 |
63 // Checks if there is a Drive upload associated with |download| | 60 // Checks if there is a Drive upload associated with |download| |
64 bool IsDriveDownload(const content::DownloadItem* download); | 61 bool IsDriveDownload(const content::DownloadItem* download); |
65 | 62 |
66 private: | 63 private: |
67 // AllDownloadItemNotifier::Observer | 64 // AllDownloadItemNotifier::Observer |
68 virtual void OnDownloadUpdated(content::DownloadManager* manager, | 65 virtual void OnDownloadUpdated(content::DownloadManager* manager, |
69 content::DownloadItem* download) OVERRIDE; | 66 content::DownloadItem* download) OVERRIDE; |
70 | 67 |
71 // Callback for DriveFileSystem::GetEntryInfoByPath(). | 68 // Callback for DriveFileSystem::GetEntryInfoByPath(). |
(...skipping 23 matching lines...) Expand all Loading... |
95 // Note: This should remain the last member so it'll be destroyed and | 92 // Note: This should remain the last member so it'll be destroyed and |
96 // invalidate its weak pointers before any other members are destroyed. | 93 // invalidate its weak pointers before any other members are destroyed. |
97 base::WeakPtrFactory<DriveDownloadHandler> weak_ptr_factory_; | 94 base::WeakPtrFactory<DriveDownloadHandler> weak_ptr_factory_; |
98 | 95 |
99 DISALLOW_COPY_AND_ASSIGN(DriveDownloadHandler); | 96 DISALLOW_COPY_AND_ASSIGN(DriveDownloadHandler); |
100 }; | 97 }; |
101 | 98 |
102 } // namespace drive | 99 } // namespace drive |
103 | 100 |
104 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_DOWNLOAD_HANDLER_H_ | 101 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_DOWNLOAD_HANDLER_H_ |
OLD | NEW |