Chromium Code Reviews| 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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 250 hide_hosted_docs_ = pref_service->GetBoolean(prefs::kDisableDriveHostedFiles); | 250 hide_hosted_docs_ = pref_service->GetBoolean(prefs::kDisableDriveHostedFiles); |
| 251 | 251 |
| 252 scheduler_->Initialize(); | 252 scheduler_->Initialize(); |
| 253 | 253 |
| 254 InitializePreferenceObserver(); | 254 InitializePreferenceObserver(); |
| 255 } | 255 } |
| 256 | 256 |
| 257 void DriveFileSystem::ReloadAfterReset() { | 257 void DriveFileSystem::ReloadAfterReset() { |
| 258 SetupChangeListLoader(); | 258 SetupChangeListLoader(); |
| 259 | 259 |
| 260 change_list_loader_->LoadFromServerIfNeeded( | 260 change_list_loader_->LoadIfNeeded( |
|
kinaba
2013/04/16 08:54:28
Reload() is, at least originally, meant to be a fe
| |
| 261 DirectoryFetchInfo(), | 261 DirectoryFetchInfo(), |
| 262 base::Bind(&DriveFileSystem::OnUpdateChecked, | 262 base::Bind(&DriveFileSystem::OnUpdateChecked, |
| 263 weak_ptr_factory_.GetWeakPtr())); | 263 weak_ptr_factory_.GetWeakPtr())); |
| 264 } | 264 } |
| 265 | 265 |
| 266 void DriveFileSystem::SetupChangeListLoader() { | 266 void DriveFileSystem::SetupChangeListLoader() { |
| 267 change_list_loader_.reset(new ChangeListLoader(resource_metadata_, | 267 change_list_loader_.reset(new ChangeListLoader(resource_metadata_, |
| 268 scheduler_.get(), | 268 scheduler_.get(), |
| 269 webapps_registry_)); | 269 webapps_registry_)); |
| 270 change_list_loader_->AddObserver(this); | 270 change_list_loader_->AddObserver(this); |
| 271 } | 271 } |
| 272 | 272 |
| 273 void DriveFileSystem::CheckForUpdates() { | 273 void DriveFileSystem::CheckForUpdates() { |
| 274 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 274 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 275 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
| 276 DVLOG(1) << "CheckForUpdates"; | 275 DVLOG(1) << "CheckForUpdates"; |
| 277 | 276 |
| 278 if (change_list_loader_ && | 277 if (change_list_loader_) { |
| 279 change_list_loader_->loaded() && | 278 change_list_loader_->CheckForUpdates( |
| 280 !change_list_loader_->refreshing()) { | |
| 281 change_list_loader_->LoadFromServerIfNeeded( | |
| 282 DirectoryFetchInfo(), | |
| 283 base::Bind(&DriveFileSystem::OnUpdateChecked, | 279 base::Bind(&DriveFileSystem::OnUpdateChecked, |
| 284 weak_ptr_factory_.GetWeakPtr())); | 280 weak_ptr_factory_.GetWeakPtr())); |
| 285 } | 281 } |
| 286 } | 282 } |
| 287 | 283 |
| 288 void DriveFileSystem::OnUpdateChecked(DriveFileError error) { | 284 void DriveFileSystem::OnUpdateChecked(DriveFileError error) { |
| 289 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 285 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 290 DVLOG(1) << "CheckForUpdates finished: " << DriveFileErrorToString(error); | 286 DVLOG(1) << "CheckForUpdates finished: " << DriveFileErrorToString(error); |
| 291 last_update_check_time_ = base::Time::Now(); | 287 last_update_check_time_ = base::Time::Now(); |
| 292 last_update_check_error_ = error; | 288 last_update_check_error_ = error; |
| (...skipping 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1706 return; | 1702 return; |
| 1707 } | 1703 } |
| 1708 | 1704 |
| 1709 PlatformFileInfoProto entry_file_info; | 1705 PlatformFileInfoProto entry_file_info; |
| 1710 util::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); | 1706 util::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); |
| 1711 *entry_proto->mutable_file_info() = entry_file_info; | 1707 *entry_proto->mutable_file_info() = entry_file_info; |
| 1712 callback.Run(DRIVE_FILE_OK, entry_proto.Pass()); | 1708 callback.Run(DRIVE_FILE_OK, entry_proto.Pass()); |
| 1713 } | 1709 } |
| 1714 | 1710 |
| 1715 } // namespace drive | 1711 } // namespace drive |
| OLD | NEW |