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 #include "chrome/browser/chromeos/drive/file_system/update_operation.h" | 5 #include "chrome/browser/chromeos/drive/file_system/update_operation.h" |
6 | 6 |
7 #include "chrome/browser/chromeos/drive/drive.pb.h" | 7 #include "chrome/browser/chromeos/drive/drive.pb.h" |
8 #include "chrome/browser/chromeos/drive/file_cache.h" | 8 #include "chrome/browser/chromeos/drive/file_cache.h" |
9 #include "chrome/browser/chromeos/drive/file_system/operation_observer.h" | 9 #include "chrome/browser/chromeos/drive/file_system/operation_observer.h" |
10 #include "chrome/browser/chromeos/drive/file_system_util.h" | 10 #include "chrome/browser/chromeos/drive/file_system_util.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 weak_ptr_factory_(this) { | 82 weak_ptr_factory_(this) { |
83 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 83 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
84 } | 84 } |
85 | 85 |
86 UpdateOperation::~UpdateOperation() { | 86 UpdateOperation::~UpdateOperation() { |
87 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 87 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
88 } | 88 } |
89 | 89 |
90 void UpdateOperation::UpdateFileByResourceId( | 90 void UpdateOperation::UpdateFileByResourceId( |
91 const std::string& resource_id, | 91 const std::string& resource_id, |
92 DriveClientContext context, | 92 const ClientContext& context, |
93 const FileOperationCallback& callback) { | 93 const FileOperationCallback& callback) { |
94 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 94 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
95 DCHECK(!callback.is_null()); | 95 DCHECK(!callback.is_null()); |
96 | 96 |
97 ResourceEntry* entry = new ResourceEntry; | 97 ResourceEntry* entry = new ResourceEntry; |
98 base::FilePath* drive_file_path = new base::FilePath; | 98 base::FilePath* drive_file_path = new base::FilePath; |
99 base::FilePath* cache_file_path = new base::FilePath; | 99 base::FilePath* cache_file_path = new base::FilePath; |
100 base::PostTaskAndReplyWithResult( | 100 base::PostTaskAndReplyWithResult( |
101 blocking_task_runner_, | 101 blocking_task_runner_, |
102 FROM_HERE, | 102 FROM_HERE, |
103 base::Bind(&GetFileLocalState, | 103 base::Bind(&GetFileLocalState, |
104 metadata_, | 104 metadata_, |
105 cache_, | 105 cache_, |
106 resource_id, | 106 resource_id, |
107 entry, | 107 entry, |
108 drive_file_path, | 108 drive_file_path, |
109 cache_file_path), | 109 cache_file_path), |
110 base::Bind(&UpdateOperation::UpdateFileAfterGetLocalState, | 110 base::Bind(&UpdateOperation::UpdateFileAfterGetLocalState, |
111 weak_ptr_factory_.GetWeakPtr(), | 111 weak_ptr_factory_.GetWeakPtr(), |
112 context, | 112 context, |
113 callback, | 113 callback, |
114 base::Owned(entry), | 114 base::Owned(entry), |
115 base::Owned(drive_file_path), | 115 base::Owned(drive_file_path), |
116 base::Owned(cache_file_path))); | 116 base::Owned(cache_file_path))); |
117 } | 117 } |
118 | 118 |
119 void UpdateOperation::UpdateFileAfterGetLocalState( | 119 void UpdateOperation::UpdateFileAfterGetLocalState( |
120 DriveClientContext context, | 120 const ClientContext& context, |
121 const FileOperationCallback& callback, | 121 const FileOperationCallback& callback, |
122 const ResourceEntry* entry, | 122 const ResourceEntry* entry, |
123 const base::FilePath* drive_file_path, | 123 const base::FilePath* drive_file_path, |
124 const base::FilePath* cache_file_path, | 124 const base::FilePath* cache_file_path, |
125 FileError error) { | 125 FileError error) { |
126 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 126 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
127 DCHECK(!callback.is_null()); | 127 DCHECK(!callback.is_null()); |
128 | 128 |
129 if (error != FILE_ERROR_OK) { | 129 if (error != FILE_ERROR_OK) { |
130 callback.Run(error); | 130 callback.Run(error); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 if (error != FILE_ERROR_OK) { | 181 if (error != FILE_ERROR_OK) { |
182 callback.Run(error); | 182 callback.Run(error); |
183 return; | 183 return; |
184 } | 184 } |
185 observer_->OnDirectoryChangedByOperation(drive_file_path->DirName()); | 185 observer_->OnDirectoryChangedByOperation(drive_file_path->DirName()); |
186 callback.Run(FILE_ERROR_OK); | 186 callback.Run(FILE_ERROR_OK); |
187 } | 187 } |
188 | 188 |
189 } // namespace file_system | 189 } // namespace file_system |
190 } // namespace drive | 190 } // namespace drive |
OLD | NEW |