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 #include "chrome/browser/chromeos/drive/file_system/create_file_operation.h" | 5 #include "chrome/browser/chromeos/drive/file_system/create_file_operation.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "chrome/browser/chromeos/drive/drive.pb.h" | 9 #include "chrome/browser/chromeos/drive/drive.pb.h" |
10 #include "chrome/browser/chromeos/drive/file_cache.h" | 10 #include "chrome/browser/chromeos/drive/file_cache.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 if (error != FILE_ERROR_NOT_FOUND) { | 168 if (error != FILE_ERROR_NOT_FOUND) { |
169 callback.Run(error); | 169 callback.Run(error); |
170 return; | 170 return; |
171 } | 171 } |
172 | 172 |
173 scheduler_->CreateFile( | 173 scheduler_->CreateFile( |
174 *parent_resource_id, | 174 *parent_resource_id, |
175 file_path, | 175 file_path, |
176 file_path.BaseName().value(), | 176 file_path.BaseName().value(), |
177 *mime_type, | 177 *mime_type, |
178 DriveClientContext(USER_INITIATED), | 178 ClientContext(USER_INITIATED), |
179 base::Bind(&CreateFileOperation::CreateFileAfterUpload, | 179 base::Bind(&CreateFileOperation::CreateFileAfterUpload, |
180 weak_ptr_factory_.GetWeakPtr(), | 180 weak_ptr_factory_.GetWeakPtr(), |
181 callback)); | 181 callback)); |
182 } | 182 } |
183 | 183 |
184 void CreateFileOperation::CreateFileAfterUpload( | 184 void CreateFileOperation::CreateFileAfterUpload( |
185 const FileOperationCallback& callback, | 185 const FileOperationCallback& callback, |
186 google_apis::GDataErrorCode gdata_error, | 186 google_apis::GDataErrorCode gdata_error, |
187 scoped_ptr<google_apis::ResourceEntry> resource_entry) { | 187 scoped_ptr<google_apis::ResourceEntry> resource_entry) { |
188 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 188 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
(...skipping 27 matching lines...) Expand all Loading... |
216 | 216 |
217 // Notify observer if the file creation process is successfully done. | 217 // Notify observer if the file creation process is successfully done. |
218 if (error == FILE_ERROR_OK) | 218 if (error == FILE_ERROR_OK) |
219 observer_->OnDirectoryChangedByOperation(file_path->DirName()); | 219 observer_->OnDirectoryChangedByOperation(file_path->DirName()); |
220 | 220 |
221 callback.Run(error); | 221 callback.Run(error); |
222 } | 222 } |
223 | 223 |
224 } // namespace file_system | 224 } // namespace file_system |
225 } // namespace drive | 225 } // namespace drive |
OLD | NEW |