| 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/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/json/json_file_value_serializer.h" | 9 #include "base/json/json_file_value_serializer.h" | 
| 10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" | 
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 380       blocking_task_runner_(blocking_task_runner), | 380       blocking_task_runner_(blocking_task_runner), | 
| 381       scheduler_(new DriveScheduler(profile, &drive_operations_)), | 381       scheduler_(new DriveScheduler(profile, &drive_operations_)), | 
| 382       ALLOW_THIS_IN_INITIALIZER_LIST(ui_weak_ptr_factory_(this)), | 382       ALLOW_THIS_IN_INITIALIZER_LIST(ui_weak_ptr_factory_(this)), | 
| 383       ui_weak_ptr_(ui_weak_ptr_factory_.GetWeakPtr()), | 383       ui_weak_ptr_(ui_weak_ptr_factory_.GetWeakPtr()), | 
| 384       polling_interval_sec_(kFastPollingIntervalInSec) { | 384       polling_interval_sec_(kFastPollingIntervalInSec) { | 
| 385   // Should be created from the file browser extension API on UI thread. | 385   // Should be created from the file browser extension API on UI thread. | 
| 386   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 386   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 
| 387 } | 387 } | 
| 388 | 388 | 
| 389 void DriveFileSystem::Reload() { | 389 void DriveFileSystem::Reload() { | 
| 390   InitializeResourceMetadtaAndFeedLoader(); | 390   InitializeResourceMetadataAndFeedLoader(); | 
| 391 | 391 | 
| 392   feed_loader_->ReloadFromServerIfNeeded( | 392   feed_loader_->ReloadFromServerIfNeeded( | 
| 393       resource_metadata_->largest_changestamp(), | 393       resource_metadata_->largest_changestamp(), | 
| 394       base::Bind(&DriveFileSystem::NotifyInitialLoadFinishedAndRun, | 394       base::Bind(&DriveFileSystem::NotifyInitialLoadFinishedAndRun, | 
| 395                  ui_weak_ptr_, | 395                  ui_weak_ptr_, | 
| 396                  base::Bind(&DriveFileSystem::OnUpdateChecked, | 396                  base::Bind(&DriveFileSystem::OnUpdateChecked, | 
| 397                             ui_weak_ptr_))); | 397                             ui_weak_ptr_))); | 
| 398 } | 398 } | 
| 399 | 399 | 
| 400 void DriveFileSystem::Initialize() { | 400 void DriveFileSystem::Initialize() { | 
| 401   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 401   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 
| 402 | 402 | 
| 403   drive_service_->Initialize(profile_); | 403   drive_service_->Initialize(profile_); | 
| 404 | 404 | 
| 405   InitializeResourceMetadtaAndFeedLoader(); | 405   InitializeResourceMetadataAndFeedLoader(); | 
| 406 | 406 | 
| 407   // Allocate the drive operation handlers. | 407   // Allocate the drive operation handlers. | 
| 408   drive_operations_.Init(drive_service_, | 408   drive_operations_.Init(drive_service_, | 
| 409                          this,  // DriveFileSystemInterface | 409                          this,  // DriveFileSystemInterface | 
| 410                          cache_, | 410                          cache_, | 
| 411                          resource_metadata_.get(), | 411                          resource_metadata_.get(), | 
| 412                          uploader_, | 412                          uploader_, | 
| 413                          blocking_task_runner_, | 413                          blocking_task_runner_, | 
| 414                          this);  // OperationObserver | 414                          this);  // OperationObserver | 
| 415 | 415 | 
| 416   PrefService* pref_service = profile_->GetPrefs(); | 416   PrefService* pref_service = profile_->GetPrefs(); | 
| 417   hide_hosted_docs_ = pref_service->GetBoolean(prefs::kDisableDriveHostedFiles); | 417   hide_hosted_docs_ = pref_service->GetBoolean(prefs::kDisableDriveHostedFiles); | 
| 418 | 418 | 
| 419   scheduler_->Initialize(); | 419   scheduler_->Initialize(); | 
| 420 | 420 | 
| 421   InitializePreferenceObserver(); | 421   InitializePreferenceObserver(); | 
| 422 } | 422 } | 
| 423 | 423 | 
| 424 void DriveFileSystem::InitializeResourceMetadtaAndFeedLoader() { | 424 void DriveFileSystem::InitializeResourceMetadataAndFeedLoader() { | 
| 425   resource_metadata_.reset(new DriveResourceMetadata); | 425   resource_metadata_.reset(new DriveResourceMetadata); | 
| 426   feed_loader_.reset(new DriveFeedLoader(resource_metadata_.get(), | 426   feed_loader_.reset(new DriveFeedLoader(resource_metadata_.get(), | 
| 427                                          drive_service_, | 427                                          drive_service_, | 
| 428                                          webapps_registry_, | 428                                          webapps_registry_, | 
| 429                                          cache_, | 429                                          cache_, | 
| 430                                          blocking_task_runner_)); | 430                                          blocking_task_runner_)); | 
| 431   feed_loader_->AddObserver(this); | 431   feed_loader_->AddObserver(this); | 
| 432 } | 432 } | 
| 433 | 433 | 
| 434 void DriveFileSystem::CheckForUpdates() { | 434 void DriveFileSystem::CheckForUpdates() { | 
| (...skipping 2095 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2530     return; | 2530     return; | 
| 2531   } | 2531   } | 
| 2532 | 2532 | 
| 2533   PlatformFileInfoProto entry_file_info; | 2533   PlatformFileInfoProto entry_file_info; | 
| 2534   DriveEntry::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); | 2534   DriveEntry::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); | 
| 2535   *entry_proto->mutable_file_info() = entry_file_info; | 2535   *entry_proto->mutable_file_info() = entry_file_info; | 
| 2536   callback.Run(DRIVE_FILE_OK, entry_proto.Pass()); | 2536   callback.Run(DRIVE_FILE_OK, entry_proto.Pass()); | 
| 2537 } | 2537 } | 
| 2538 | 2538 | 
| 2539 }  // namespace drive | 2539 }  // namespace drive | 
| OLD | NEW | 
|---|