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