OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_DIRECTORY_OPERATION_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_CREATE_DIRECTORY_OPERATION_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_CREATE_DIRECTORY_OPERATION_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_CREATE_DIRECTORY_OPERATION_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "chrome/browser/chromeos/drive/file_errors.h" | 13 #include "chrome/browser/chromeos/drive/file_errors.h" |
14 #include "chrome/browser/google_apis/gdata_errorcode.h" | 14 #include "chrome/browser/google_apis/gdata_errorcode.h" |
15 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
16 | 16 |
17 namespace google_apis { | 17 namespace google_apis { |
18 | 18 |
19 class ResourceEntry; | 19 class ResourceEntry; |
20 | 20 |
21 } // namespace google_apis | 21 } // namespace google_apis |
22 | 22 |
23 namespace drive { | 23 namespace drive { |
24 | 24 |
25 class DriveEntryProto; | 25 class DriveEntryProto; |
26 class DriveResourceMetadata; | 26 class DriveResourceMetadata; |
27 class DriveScheduler; | 27 class JobScheduler; |
28 | 28 |
29 namespace file_system { | 29 namespace file_system { |
30 | 30 |
31 class OperationObserver; | 31 class OperationObserver; |
32 | 32 |
33 // This class encapsulates the drive Create Directory function. It is | 33 // This class encapsulates the drive Create Directory function. It is |
34 // responsible for sending the request to the drive API, then updating the | 34 // responsible for sending the request to the drive API, then updating the |
35 // local state and metadata to reflect the new state. | 35 // local state and metadata to reflect the new state. |
36 class CreateDirectoryOperation { | 36 class CreateDirectoryOperation { |
37 public: | 37 public: |
38 CreateDirectoryOperation(DriveScheduler* drive_scheduler, | 38 CreateDirectoryOperation(JobScheduler* job_scheduler, |
39 DriveResourceMetadata* metadata, | 39 DriveResourceMetadata* metadata, |
40 OperationObserver* observer); | 40 OperationObserver* observer); |
41 ~CreateDirectoryOperation(); | 41 ~CreateDirectoryOperation(); |
42 | 42 |
43 // Creates a new directory at |directory_path|. | 43 // Creates a new directory at |directory_path|. |
44 // If |is_exclusive| is true, an error is raised in case a directory exists | 44 // If |is_exclusive| is true, an error is raised in case a directory exists |
45 // already at the |directory_path|. | 45 // already at the |directory_path|. |
46 // If |is_recursive| is true, the invocation creates parent directories as | 46 // If |is_recursive| is true, the invocation creates parent directories as |
47 // needed just like mkdir -p does. | 47 // needed just like mkdir -p does. |
48 // Invokes |callback| when finished with the result of the operation. | 48 // Invokes |callback| when finished with the result of the operation. |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 void FindFirstMissingParentDirectoryInternal( | 134 void FindFirstMissingParentDirectoryInternal( |
135 scoped_ptr<FindFirstMissingParentDirectoryParams> params); | 135 scoped_ptr<FindFirstMissingParentDirectoryParams> params); |
136 | 136 |
137 // Callback for ResourceMetadata::GetEntryInfoByPath from | 137 // Callback for ResourceMetadata::GetEntryInfoByPath from |
138 // FindFirstMissingParentDirectory. | 138 // FindFirstMissingParentDirectory. |
139 void ContinueFindFirstMissingParentDirectory( | 139 void ContinueFindFirstMissingParentDirectory( |
140 scoped_ptr<FindFirstMissingParentDirectoryParams> params, | 140 scoped_ptr<FindFirstMissingParentDirectoryParams> params, |
141 FileError error, | 141 FileError error, |
142 scoped_ptr<DriveEntryProto> entry_proto); | 142 scoped_ptr<DriveEntryProto> entry_proto); |
143 | 143 |
144 DriveScheduler* drive_scheduler_; | 144 JobScheduler* job_scheduler_; |
145 DriveResourceMetadata* metadata_; | 145 DriveResourceMetadata* metadata_; |
146 OperationObserver* observer_; | 146 OperationObserver* observer_; |
147 | 147 |
148 // WeakPtrFactory bound to the UI thread. | 148 // WeakPtrFactory bound to the UI thread. |
149 // Note: This should remain the last member so it'll be destroyed and | 149 // Note: This should remain the last member so it'll be destroyed and |
150 // invalidate the weak pointers before any other members are destroyed. | 150 // invalidate the weak pointers before any other members are destroyed. |
151 base::WeakPtrFactory<CreateDirectoryOperation> weak_ptr_factory_; | 151 base::WeakPtrFactory<CreateDirectoryOperation> weak_ptr_factory_; |
152 | 152 |
153 DISALLOW_COPY_AND_ASSIGN(CreateDirectoryOperation); | 153 DISALLOW_COPY_AND_ASSIGN(CreateDirectoryOperation); |
154 }; | 154 }; |
155 | 155 |
156 } // namespace file_system | 156 } // namespace file_system |
157 } // namespace drive | 157 } // namespace drive |
158 | 158 |
159 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_CREATE_DIRECTORY_OPERATION_
H_ | 159 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_CREATE_DIRECTORY_OPERATION_
H_ |
OLD | NEW |