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_UPDATE_OPERATION_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_UPDATE_OPERATION_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_UPDATE_OPERATION_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_UPDATE_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_file_system_interface.h" | 11 #include "chrome/browser/chromeos/drive/drive_file_system_interface.h" |
12 #include "chrome/browser/chromeos/drive/drive_resource_metadata.h" | 12 #include "chrome/browser/chromeos/drive/drive_resource_metadata.h" |
13 #include "chrome/browser/google_apis/gdata_errorcode.h" | 13 #include "chrome/browser/google_apis/gdata_errorcode.h" |
14 | 14 |
15 class GURL; | 15 class GURL; |
16 | 16 |
17 namespace base { | 17 namespace base { |
18 class FilePath; | 18 class FilePath; |
19 } | 19 } |
20 | 20 |
21 namespace drive { | 21 namespace drive { |
22 | 22 |
23 class DriveCache; | 23 class DriveCache; |
24 class DriveEntryProto; | 24 class DriveEntryProto; |
25 class DriveScheduler; | 25 class JobScheduler; |
26 | 26 |
27 namespace file_system { | 27 namespace file_system { |
28 | 28 |
29 class OperationObserver; | 29 class OperationObserver; |
30 | 30 |
31 // This class encapsulates the drive Update function. It is responsible for | 31 // This class encapsulates the drive Update function. It is responsible for |
32 // sending the request to the drive API, then updating the local state and | 32 // sending the request to the drive API, then updating the local state and |
33 // metadata to reflect the new state. | 33 // metadata to reflect the new state. |
34 class UpdateOperation { | 34 class UpdateOperation { |
35 public: | 35 public: |
36 UpdateOperation(DriveCache* cache, | 36 UpdateOperation(DriveCache* cache, |
37 DriveResourceMetadata* metadata, | 37 DriveResourceMetadata* metadata, |
38 DriveScheduler* scheduler, | 38 JobScheduler* scheduler, |
39 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner, | 39 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner, |
40 OperationObserver* observer); | 40 OperationObserver* observer); |
41 virtual ~UpdateOperation(); | 41 virtual ~UpdateOperation(); |
42 | 42 |
43 // Updates a file by the given |resource_id| on the Drive server by | 43 // Updates a file by the given |resource_id| on the Drive server by |
44 // uploading an updated version. Used for uploading dirty files. The file | 44 // uploading an updated version. Used for uploading dirty files. The file |
45 // should already be present in the cache. | 45 // should already be present in the cache. |
46 // | 46 // |
47 // TODO(satorux): As of now, the function only handles files with the dirty | 47 // TODO(satorux): As of now, the function only handles files with the dirty |
48 // bit committed. We should eliminate the restriction. crbug.com/134558. | 48 // bit committed. We should eliminate the restriction. crbug.com/134558. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 // Part of UpdateFileByResourceId(). | 90 // Part of UpdateFileByResourceId(). |
91 // |callback| must not be null. | 91 // |callback| must not be null. |
92 void OnUpdatedFileRefreshed(const FileOperationCallback& callback, | 92 void OnUpdatedFileRefreshed(const FileOperationCallback& callback, |
93 FileError error, | 93 FileError error, |
94 const base::FilePath& drive_file_path, | 94 const base::FilePath& drive_file_path, |
95 scoped_ptr<DriveEntryProto> entry_proto); | 95 scoped_ptr<DriveEntryProto> entry_proto); |
96 | 96 |
97 DriveCache* cache_; | 97 DriveCache* cache_; |
98 DriveResourceMetadata* metadata_; | 98 DriveResourceMetadata* metadata_; |
99 DriveScheduler* scheduler_; | 99 JobScheduler* scheduler_; |
100 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 100 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
101 OperationObserver* observer_; | 101 OperationObserver* observer_; |
102 | 102 |
103 // WeakPtrFactory bound to the UI thread. | 103 // WeakPtrFactory bound to the UI thread. |
104 // Note: This should remain the last member so it'll be destroyed and | 104 // Note: This should remain the last member so it'll be destroyed and |
105 // invalidate the weak pointers before any other members are destroyed. | 105 // invalidate the weak pointers before any other members are destroyed. |
106 base::WeakPtrFactory<UpdateOperation> weak_ptr_factory_; | 106 base::WeakPtrFactory<UpdateOperation> weak_ptr_factory_; |
107 | 107 |
108 DISALLOW_COPY_AND_ASSIGN(UpdateOperation); | 108 DISALLOW_COPY_AND_ASSIGN(UpdateOperation); |
109 }; | 109 }; |
110 | 110 |
111 } // namespace file_system | 111 } // namespace file_system |
112 } // namespace drive | 112 } // namespace drive |
113 | 113 |
114 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_UPDATE_OPERATION_H_ | 114 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_UPDATE_OPERATION_H_ |
OLD | NEW |