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

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

Issue 23258006: drive: Move RefreshDirectory from ResourceMetadata to ChangeListLoader (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comment fix Created 7 years, 4 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/file_system.h" 5 #include "chrome/browser/chromeos/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/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "base/platform_file.h" 10 #include "base/platform_file.h"
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 void FileSystem::ReloadAfterReset(FileError error) { 235 void FileSystem::ReloadAfterReset(FileError error) {
236 if (error != FILE_ERROR_OK) { 236 if (error != FILE_ERROR_OK) {
237 LOG(ERROR) << "Failed to reset the resource metadata: " 237 LOG(ERROR) << "Failed to reset the resource metadata: "
238 << FileErrorToString(error); 238 << FileErrorToString(error);
239 return; 239 return;
240 } 240 }
241 241
242 SetupChangeListLoader(); 242 SetupChangeListLoader();
243 243
244 change_list_loader_->LoadIfNeeded( 244 change_list_loader_->LoadIfNeeded(
245 DirectoryFetchInfo(), 245 internal::DirectoryFetchInfo(),
246 base::Bind(&FileSystem::OnUpdateChecked, 246 base::Bind(&FileSystem::OnUpdateChecked,
247 weak_ptr_factory_.GetWeakPtr())); 247 weak_ptr_factory_.GetWeakPtr()));
248 } 248 }
249 249
250 void FileSystem::SetupChangeListLoader() { 250 void FileSystem::SetupChangeListLoader() {
251 change_list_loader_.reset(new internal::ChangeListLoader( 251 change_list_loader_.reset(new internal::ChangeListLoader(
252 blocking_task_runner_.get(), resource_metadata_, scheduler_)); 252 blocking_task_runner_.get(), resource_metadata_, scheduler_));
253 change_list_loader_->AddObserver(this); 253 change_list_loader_->AddObserver(this);
254 } 254 }
255 255
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 326
327 void FileSystem::CreateDirectory( 327 void FileSystem::CreateDirectory(
328 const base::FilePath& directory_path, 328 const base::FilePath& directory_path,
329 bool is_exclusive, 329 bool is_exclusive,
330 bool is_recursive, 330 bool is_recursive,
331 const FileOperationCallback& callback) { 331 const FileOperationCallback& callback) {
332 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 332 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
333 DCHECK(!callback.is_null()); 333 DCHECK(!callback.is_null());
334 334
335 change_list_loader_->LoadIfNeeded( 335 change_list_loader_->LoadIfNeeded(
336 DirectoryFetchInfo(), 336 internal::DirectoryFetchInfo(),
337 base::Bind(&FileSystem::CreateDirectoryAfterLoad, 337 base::Bind(&FileSystem::CreateDirectoryAfterLoad,
338 weak_ptr_factory_.GetWeakPtr(), 338 weak_ptr_factory_.GetWeakPtr(),
339 directory_path, is_exclusive, is_recursive, callback)); 339 directory_path, is_exclusive, is_recursive, callback));
340 } 340 }
341 341
342 void FileSystem::CreateDirectoryAfterLoad( 342 void FileSystem::CreateDirectoryAfterLoad(
343 const base::FilePath& directory_path, 343 const base::FilePath& directory_path,
344 bool is_exclusive, 344 bool is_exclusive,
345 bool is_recursive, 345 bool is_recursive,
346 const FileOperationCallback& callback, 346 const FileOperationCallback& callback,
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 FileError error, 628 FileError error,
629 scoped_ptr<ResourceEntry> entry) { 629 scoped_ptr<ResourceEntry> entry) {
630 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 630 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
631 DCHECK(!callback.is_null()); 631 DCHECK(!callback.is_null());
632 632
633 if (error != FILE_ERROR_OK || 633 if (error != FILE_ERROR_OK ||
634 entry->resource_id() == util::kDriveOtherDirSpecialResourceId) { 634 entry->resource_id() == util::kDriveOtherDirSpecialResourceId) {
635 // If we don't know about the directory, or it is the "drive/other" 635 // If we don't know about the directory, or it is the "drive/other"
636 // directory that has to gather all orphan entries, start loading full 636 // directory that has to gather all orphan entries, start loading full
637 // resource list. 637 // resource list.
638 change_list_loader_->LoadIfNeeded(DirectoryFetchInfo(), callback); 638 change_list_loader_->LoadIfNeeded(internal::DirectoryFetchInfo(), callback);
639 return; 639 return;
640 } 640 }
641 641
642 if (!entry->file_info().is_directory()) { 642 if (!entry->file_info().is_directory()) {
643 callback.Run(FILE_ERROR_NOT_A_DIRECTORY); 643 callback.Run(FILE_ERROR_NOT_A_DIRECTORY);
644 return; 644 return;
645 } 645 }
646 646
647 // Pass the directory fetch info so we can fetch the contents of the 647 // Pass the directory fetch info so we can fetch the contents of the
648 // directory before loading change lists. 648 // directory before loading change lists.
649 DirectoryFetchInfo directory_fetch_info( 649 internal::DirectoryFetchInfo directory_fetch_info(
650 entry->resource_id(), 650 entry->resource_id(),
651 entry->directory_specific_info().changestamp()); 651 entry->directory_specific_info().changestamp());
652 change_list_loader_->LoadIfNeeded(directory_fetch_info, callback); 652 change_list_loader_->LoadIfNeeded(directory_fetch_info, callback);
653 } 653 }
654 654
655 void FileSystem::ReadDirectoryByPathAfterLoad( 655 void FileSystem::ReadDirectoryByPathAfterLoad(
656 const base::FilePath& directory_path, 656 const base::FilePath& directory_path,
657 const ReadDirectoryCallback& callback, 657 const ReadDirectoryCallback& callback,
658 FileError error) { 658 FileError error) {
659 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 659 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 OpenMode open_mode, 950 OpenMode open_mode,
951 const std::string& mime_type, 951 const std::string& mime_type,
952 const OpenFileCallback& callback) { 952 const OpenFileCallback& callback) {
953 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 953 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
954 DCHECK(!callback.is_null()); 954 DCHECK(!callback.is_null());
955 955
956 open_file_operation_->OpenFile(file_path, open_mode, mime_type, callback); 956 open_file_operation_->OpenFile(file_path, open_mode, mime_type, callback);
957 } 957 }
958 958
959 } // namespace drive 959 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698