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 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_CREATE_FILE_OPERATION_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_CREATE_FILE_OPERATION_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_CREATE_FILE_OPERATION_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_CREATE_FILE_OPERATION_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 // This class encapsulates the drive CreateFile function. It is responsible for | 30 // This class encapsulates the drive CreateFile function. It is responsible for |
31 // sending the request to the drive API, then updating the local state and | 31 // sending the request to the drive API, then updating the local state and |
32 // metadata to reflect the new state. | 32 // metadata to reflect the new state. |
33 // | 33 // |
34 // TODO(kinaba): crbug.com/236771 remove dependency to DriveFileSystemInterface. | 34 // TODO(kinaba): crbug.com/236771 remove dependency to DriveFileSystemInterface. |
35 class CreateFileOperation { | 35 class CreateFileOperation { |
36 public: | 36 public: |
37 CreateFileOperation( | 37 CreateFileOperation( |
38 JobScheduler* job_scheduler, | 38 JobScheduler* job_scheduler, |
39 DriveFileSystemInterface* drive_file_system, | 39 DriveFileSystemInterface* file_system, |
40 internal::ResourceMetadata* metadata, | 40 internal::ResourceMetadata* metadata, |
41 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner); | 41 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner); |
42 ~CreateFileOperation(); | 42 ~CreateFileOperation(); |
43 | 43 |
44 // Creates an empty file at |file_path| in the remote server. When the file | 44 // Creates an empty file at |file_path| in the remote server. When the file |
45 // already exists at that path, the operation fails if |is_exclusive| is true, | 45 // already exists at that path, the operation fails if |is_exclusive| is true, |
46 // and it succeeds without doing anything if the flag is false. | 46 // and it succeeds without doing anything if the flag is false. |
47 // | 47 // |
48 // |callback| must not be null. | 48 // |callback| must not be null. |
49 void CreateFile(const base::FilePath& file_path, | 49 void CreateFile(const base::FilePath& file_path, |
(...skipping 13 matching lines...) Expand all Loading... |
63 bool got_content_type); | 63 bool got_content_type); |
64 | 64 |
65 void CreateFileAfterUpload( | 65 void CreateFileAfterUpload( |
66 const FileOperationCallback& callback, | 66 const FileOperationCallback& callback, |
67 google_apis::GDataErrorCode error, | 67 google_apis::GDataErrorCode error, |
68 const base::FilePath& drive_path, | 68 const base::FilePath& drive_path, |
69 const base::FilePath& local_path, | 69 const base::FilePath& local_path, |
70 scoped_ptr<google_apis::ResourceEntry> resource_entry); | 70 scoped_ptr<google_apis::ResourceEntry> resource_entry); |
71 | 71 |
72 JobScheduler* job_scheduler_; | 72 JobScheduler* job_scheduler_; |
73 DriveFileSystemInterface* drive_file_system_; | 73 DriveFileSystemInterface* file_system_; |
74 internal::ResourceMetadata* metadata_; | 74 internal::ResourceMetadata* metadata_; |
75 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 75 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
76 | 76 |
77 // Note: This should remain the last member so it'll be destroyed and | 77 // Note: This should remain the last member so it'll be destroyed and |
78 // invalidate the weak pointers before any other members are destroyed. | 78 // invalidate the weak pointers before any other members are destroyed. |
79 base::WeakPtrFactory<CreateFileOperation> weak_ptr_factory_; | 79 base::WeakPtrFactory<CreateFileOperation> weak_ptr_factory_; |
80 DISALLOW_COPY_AND_ASSIGN(CreateFileOperation); | 80 DISALLOW_COPY_AND_ASSIGN(CreateFileOperation); |
81 }; | 81 }; |
82 | 82 |
83 } // namespace file_system | 83 } // namespace file_system |
84 } // namespace drive | 84 } // namespace drive |
85 | 85 |
86 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_CREATE_FILE_OPERATION_H_ | 86 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_CREATE_FILE_OPERATION_H_ |
OLD | NEW |