Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: chrome/browser/chromeos/drive/drive_file_system.cc

Issue 14067009: drive: Call LoadIfNeeded before CreateDirectory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/drive_file_system.h" 5 #include "chrome/browser/chromeos/drive/drive_file_system.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/message_loop_proxy.h" 9 #include "base/message_loop_proxy.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 } 382 }
383 383
384 void DriveFileSystem::CreateDirectory( 384 void DriveFileSystem::CreateDirectory(
385 const base::FilePath& directory_path, 385 const base::FilePath& directory_path,
386 bool is_exclusive, 386 bool is_exclusive,
387 bool is_recursive, 387 bool is_recursive,
388 const FileOperationCallback& callback) { 388 const FileOperationCallback& callback) {
389 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 389 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
390 DCHECK(!callback.is_null()); 390 DCHECK(!callback.is_null());
391 391
392 change_list_loader_->LoadIfNeeded(
393 DirectoryFetchInfo(),
394 base::Bind(&DriveFileSystem::CreateDirectoryAfterLoad,
395 weak_ptr_factory_.GetWeakPtr(),
396 directory_path, is_exclusive, is_recursive, callback));
397 }
398
399 void DriveFileSystem::CreateDirectoryAfterLoad(
400 const base::FilePath& directory_path,
401 bool is_exclusive,
402 bool is_recursive,
403 const FileOperationCallback& callback,
404 FileError load_error) {
405 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
406 DCHECK(!callback.is_null());
407
408 if (load_error != FILE_ERROR_OK) {
409 callback.Run(load_error);
410 return;
411 }
412
392 drive_operations_.CreateDirectory( 413 drive_operations_.CreateDirectory(
393 directory_path, is_exclusive, is_recursive, callback); 414 directory_path, is_exclusive, is_recursive, callback);
394 } 415 }
395 416
396 void DriveFileSystem::CreateFile(const base::FilePath& file_path, 417 void DriveFileSystem::CreateFile(const base::FilePath& file_path,
397 bool is_exclusive, 418 bool is_exclusive,
398 const FileOperationCallback& callback) { 419 const FileOperationCallback& callback) {
399 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 420 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
400 DCHECK(!callback.is_null()); 421 DCHECK(!callback.is_null());
401 422
(...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after
1788 return; 1809 return;
1789 } 1810 }
1790 1811
1791 PlatformFileInfoProto entry_file_info; 1812 PlatformFileInfoProto entry_file_info;
1792 util::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); 1813 util::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info);
1793 *entry_proto->mutable_file_info() = entry_file_info; 1814 *entry_proto->mutable_file_info() = entry_file_info;
1794 callback.Run(FILE_ERROR_OK, entry_proto.Pass()); 1815 callback.Run(FILE_ERROR_OK, entry_proto.Pass());
1795 } 1816 }
1796 1817
1797 } // namespace drive 1818 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/drive_file_system.h ('k') | chrome/browser/chromeos/drive/drive_file_system_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698