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_FILE_SYSTEM_REMOVE_OPERATION_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_REMOVE_OPERATION_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_REMOVE_OPERATION_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_REMOVE_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" |
11 #include "chrome/browser/chromeos/drive/drive_resource_metadata.h" | 11 #include "chrome/browser/chromeos/drive/drive_resource_metadata.h" |
12 #include "chrome/browser/google_apis/gdata_errorcode.h" | 12 #include "chrome/browser/google_apis/gdata_errorcode.h" |
13 | 13 |
14 class FilePath; | 14 class FilePath; |
15 class GURL; | 15 class GURL; |
16 | 16 |
17 namespace gdata { | 17 namespace drive { |
18 | 18 |
19 class DriveCache; | 19 class DriveCache; |
20 class DriveEntryProto; | 20 class DriveEntryProto; |
21 class DriveFileSystem; | 21 class DriveFileSystem; |
22 class DriveServiceInterface; | 22 class DriveServiceInterface; |
23 | 23 |
24 namespace file_system { | 24 namespace file_system { |
25 | 25 |
26 // This class encapsulates the drive Remove function. It is resposible for | 26 // This class encapsulates the drive Remove function. It is resposible for |
27 // sending the request to the drive API, then updating the local state and | 27 // sending the request to the drive API, then updating the local state and |
(...skipping 22 matching lines...) Expand all Loading... |
50 // Perform the actual delete operation. | 50 // Perform the actual delete operation. |
51 void DoDelete(const FileOperationCallback& callback, | 51 void DoDelete(const FileOperationCallback& callback, |
52 int retry_count, | 52 int retry_count, |
53 scoped_ptr<DriveEntryProto> entry_proto); | 53 scoped_ptr<DriveEntryProto> entry_proto); |
54 | 54 |
55 // Check the result of the delete operation. If it failed due to flooding the | 55 // Check the result of the delete operation. If it failed due to flooding the |
56 // server, retry up to kMaxRetries times. | 56 // server, retry up to kMaxRetries times. |
57 void RetryIfNeeded(const FileOperationCallback& callback, | 57 void RetryIfNeeded(const FileOperationCallback& callback, |
58 int retry_count, | 58 int retry_count, |
59 scoped_ptr<DriveEntryProto> entry_proto, | 59 scoped_ptr<DriveEntryProto> entry_proto, |
60 GDataErrorCode status, | 60 gdata::GDataErrorCode status, |
61 const GURL& /* document_url */); | 61 const GURL& /* document_url */); |
62 | 62 |
63 // Callback for DriveServiceInterface::DeleteDocument. Removes the entry with | 63 // Callback for DriveServiceInterface::DeleteDocument. Removes the entry with |
64 // |resource_id| from the local snapshot of the filesystem and the cache. | 64 // |resource_id| from the local snapshot of the filesystem and the cache. |
65 // |document_url| is unused. |callback| must not be null. | 65 // |document_url| is unused. |callback| must not be null. |
66 void RemoveResourceLocally( | 66 void RemoveResourceLocally( |
67 const FileOperationCallback& callback, | 67 const FileOperationCallback& callback, |
68 const std::string& resource_id, | 68 const std::string& resource_id, |
69 GDataErrorCode status); | 69 gdata::GDataErrorCode status); |
70 | 70 |
71 // Sends notification for directory changes. Notifies of directory changes, | 71 // Sends notification for directory changes. Notifies of directory changes, |
72 // and runs |callback| with |error|. |callback| may be null. | 72 // and runs |callback| with |error|. |callback| may be null. |
73 void NotifyDirectoryChanged( | 73 void NotifyDirectoryChanged( |
74 const FileOperationCallback& callback, | 74 const FileOperationCallback& callback, |
75 DriveFileError error, | 75 DriveFileError error, |
76 const FilePath& directory_path); | 76 const FilePath& directory_path); |
77 | 77 |
78 DriveServiceInterface* drive_service_; | 78 DriveServiceInterface* drive_service_; |
79 DriveFileSystem* file_system_; | 79 DriveFileSystem* file_system_; |
80 DriveCache* cache_; | 80 DriveCache* cache_; |
81 | 81 |
82 // WeakPtrFactory bound to the UI thread. | 82 // WeakPtrFactory bound to the UI thread. |
83 // Note: This should remain the last member so it'll be destroyed and | 83 // Note: This should remain the last member so it'll be destroyed and |
84 // invalidate the weak pointers before any other members are destroyed. | 84 // invalidate the weak pointers before any other members are destroyed. |
85 base::WeakPtrFactory<RemoveOperation> weak_ptr_factory_; | 85 base::WeakPtrFactory<RemoveOperation> weak_ptr_factory_; |
86 | 86 |
87 DISALLOW_COPY_AND_ASSIGN(RemoveOperation); | 87 DISALLOW_COPY_AND_ASSIGN(RemoveOperation); |
88 }; | 88 }; |
89 | 89 |
90 } // namespace file_system | 90 } // namespace file_system |
91 } // namespace gdata | 91 } // namespace drive |
92 | 92 |
93 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_REMOVE_OPERATION_H_ | 93 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_REMOVE_OPERATION_H_ |
OLD | NEW |