Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Side by Side Diff: chrome/browser/chromeos/drive/download_handler.h

Issue 23050014: Convert drive::FileWriteHelper to a single function for simplification. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/chromeos/drive/download_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_DOWNLOAD_HANDLER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DOWNLOAD_HANDLER_H_
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DOWNLOAD_HANDLER_H_ 6 #define CHROME_BROWSER_CHROMEOS_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/file_errors.h" 10 #include "chrome/browser/chromeos/drive/file_errors.h"
11 #include "chrome/browser/download/all_download_item_notifier.h" 11 #include "chrome/browser/download/all_download_item_notifier.h"
12 #include "content/public/browser/download_manager_delegate.h" 12 #include "content/public/browser/download_manager_delegate.h"
13 13
14 class Profile; 14 class Profile;
15 15
16 namespace content { 16 namespace content {
17 class DownloadItem; 17 class DownloadItem;
18 class DownloadManager; 18 class DownloadManager;
19 } 19 }
20 20
21 namespace drive { 21 namespace drive {
22 22
23 class FileSystemInterface; 23 class FileSystemInterface;
24 class FileWriteHelper;
25 class ResourceEntry; 24 class ResourceEntry;
26 25
27 // Observes downloads to temporary local drive folder. Schedules these 26 // Observes downloads to temporary local drive folder. Schedules these
28 // downloads for upload to drive service. 27 // downloads for upload to drive service.
29 class DownloadHandler : public AllDownloadItemNotifier::Observer { 28 class DownloadHandler : public AllDownloadItemNotifier::Observer {
30 public: 29 public:
31 DownloadHandler(FileWriteHelper* file_write_helper, 30 explicit DownloadHandler(FileSystemInterface* file_system);
32 FileSystemInterface* file_system);
33 virtual ~DownloadHandler(); 31 virtual ~DownloadHandler();
34 32
35 // Utility method to get DownloadHandler with profile. 33 // Utility method to get DownloadHandler with profile.
36 static DownloadHandler* GetForProfile(Profile* profile); 34 static DownloadHandler* GetForProfile(Profile* profile);
37 35
38 // Become an observer of DownloadManager. 36 // Become an observer of DownloadManager.
39 void Initialize(content::DownloadManager* download_manager, 37 void Initialize(content::DownloadManager* download_manager,
40 const base::FilePath& drive_tmp_download_path); 38 const base::FilePath& drive_tmp_download_path);
41 39
42 // Callback used to return results from SubstituteDriveDownloadPath. 40 // Callback used to return results from SubstituteDriveDownloadPath.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 scoped_ptr<ResourceEntry> entry); 82 scoped_ptr<ResourceEntry> entry);
85 83
86 // Callback for FileSystem::CreateDirectory(). 84 // Callback for FileSystem::CreateDirectory().
87 // Used to implement SubstituteDriveDownloadPath(). 85 // Used to implement SubstituteDriveDownloadPath().
88 void OnCreateDirectory(const SubstituteDriveDownloadPathCallback& callback, 86 void OnCreateDirectory(const SubstituteDriveDownloadPathCallback& callback,
89 FileError error); 87 FileError error);
90 88
91 // Starts the upload of a downloaded/downloading file. 89 // Starts the upload of a downloaded/downloading file.
92 void UploadDownloadItem(content::DownloadItem* download); 90 void UploadDownloadItem(content::DownloadItem* download);
93 91
94 FileWriteHelper* file_write_helper_;
95 FileSystemInterface* file_system_; // Owned by DriveIntegrationService. 92 FileSystemInterface* file_system_; // Owned by DriveIntegrationService.
96 // Observe the DownloadManager for new downloads. 93 // Observe the DownloadManager for new downloads.
97 scoped_ptr<AllDownloadItemNotifier> notifier_; 94 scoped_ptr<AllDownloadItemNotifier> notifier_;
98 95
99 // Temporary download location directory. 96 // Temporary download location directory.
100 base::FilePath drive_tmp_download_path_; 97 base::FilePath drive_tmp_download_path_;
101 98
102 // Note: This should remain the last member so it'll be destroyed and 99 // Note: This should remain the last member so it'll be destroyed and
103 // invalidate its weak pointers before any other members are destroyed. 100 // invalidate its weak pointers before any other members are destroyed.
104 base::WeakPtrFactory<DownloadHandler> weak_ptr_factory_; 101 base::WeakPtrFactory<DownloadHandler> weak_ptr_factory_;
105 102
106 DISALLOW_COPY_AND_ASSIGN(DownloadHandler); 103 DISALLOW_COPY_AND_ASSIGN(DownloadHandler);
107 }; 104 };
108 105
109 } // namespace drive 106 } // namespace drive
110 107
111 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DOWNLOAD_HANDLER_H_ 108 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DOWNLOAD_HANDLER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/drive/download_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698