| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/directory_loader.h" | 5 #include "chrome/browser/chromeos/drive/directory_loader.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 : loader_(loader), | 99 : loader_(loader), |
| 100 directory_fetch_info_(directory_fetch_info), | 100 directory_fetch_info_(directory_fetch_info), |
| 101 root_folder_id_(root_folder_id), | 101 root_folder_id_(root_folder_id), |
| 102 weak_ptr_factory_(this) { | 102 weak_ptr_factory_(this) { |
| 103 } | 103 } |
| 104 | 104 |
| 105 ~FeedFetcher() { | 105 ~FeedFetcher() { |
| 106 } | 106 } |
| 107 | 107 |
| 108 void Run(const FileOperationCallback& callback) { | 108 void Run(const FileOperationCallback& callback) { |
| 109 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 109 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 110 DCHECK(!callback.is_null()); | 110 DCHECK(!callback.is_null()); |
| 111 DCHECK(!directory_fetch_info_.resource_id().empty()); | 111 DCHECK(!directory_fetch_info_.resource_id().empty()); |
| 112 | 112 |
| 113 // Remember the time stamp for usage stats. | 113 // Remember the time stamp for usage stats. |
| 114 start_time_ = base::TimeTicks::Now(); | 114 start_time_ = base::TimeTicks::Now(); |
| 115 | 115 |
| 116 loader_->scheduler_->GetFileListInDirectory( | 116 loader_->scheduler_->GetFileListInDirectory( |
| 117 directory_fetch_info_.resource_id(), | 117 directory_fetch_info_.resource_id(), |
| 118 base::Bind(&FeedFetcher::OnFileListFetched, | 118 base::Bind(&FeedFetcher::OnFileListFetched, |
| 119 weak_ptr_factory_.GetWeakPtr(), callback)); | 119 weak_ptr_factory_.GetWeakPtr(), callback)); |
| 120 } | 120 } |
| 121 | 121 |
| 122 private: | 122 private: |
| 123 void OnFileListFetched(const FileOperationCallback& callback, | 123 void OnFileListFetched(const FileOperationCallback& callback, |
| 124 google_apis::DriveApiErrorCode status, | 124 google_apis::DriveApiErrorCode status, |
| 125 scoped_ptr<google_apis::FileList> file_list) { | 125 scoped_ptr<google_apis::FileList> file_list) { |
| 126 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 126 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 127 DCHECK(!callback.is_null()); | 127 DCHECK(!callback.is_null()); |
| 128 | 128 |
| 129 FileError error = GDataToFileError(status); | 129 FileError error = GDataToFileError(status); |
| 130 if (error != FILE_ERROR_OK) { | 130 if (error != FILE_ERROR_OK) { |
| 131 callback.Run(error); | 131 callback.Run(error); |
| 132 return; | 132 return; |
| 133 } | 133 } |
| 134 | 134 |
| 135 DCHECK(file_list); | 135 DCHECK(file_list); |
| 136 scoped_ptr<ChangeList> change_list(new ChangeList(*file_list)); | 136 scoped_ptr<ChangeList> change_list(new ChangeList(*file_list)); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 152 callback, | 152 callback, |
| 153 next_url, | 153 next_url, |
| 154 base::Owned(entries)))); | 154 base::Owned(entries)))); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void OnDirectoryRefreshed( | 157 void OnDirectoryRefreshed( |
| 158 const FileOperationCallback& callback, | 158 const FileOperationCallback& callback, |
| 159 const GURL& next_url, | 159 const GURL& next_url, |
| 160 const std::vector<ResourceEntry>* refreshed_entries, | 160 const std::vector<ResourceEntry>* refreshed_entries, |
| 161 FileError error) { | 161 FileError error) { |
| 162 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 162 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 163 DCHECK(!callback.is_null()); | 163 DCHECK(!callback.is_null()); |
| 164 | 164 |
| 165 if (error != FILE_ERROR_OK) { | 165 if (error != FILE_ERROR_OK) { |
| 166 callback.Run(error); | 166 callback.Run(error); |
| 167 return; | 167 return; |
| 168 } | 168 } |
| 169 | 169 |
| 170 loader_->SendEntries(directory_fetch_info_.local_id(), *refreshed_entries); | 170 loader_->SendEntries(directory_fetch_info_.local_id(), *refreshed_entries); |
| 171 | 171 |
| 172 if (!next_url.is_empty()) { | 172 if (!next_url.is_empty()) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 about_resource_loader_(about_resource_loader), | 209 about_resource_loader_(about_resource_loader), |
| 210 loader_controller_(loader_controller), | 210 loader_controller_(loader_controller), |
| 211 weak_ptr_factory_(this) { | 211 weak_ptr_factory_(this) { |
| 212 } | 212 } |
| 213 | 213 |
| 214 DirectoryLoader::~DirectoryLoader() { | 214 DirectoryLoader::~DirectoryLoader() { |
| 215 STLDeleteElements(&fast_fetch_feed_fetcher_set_); | 215 STLDeleteElements(&fast_fetch_feed_fetcher_set_); |
| 216 } | 216 } |
| 217 | 217 |
| 218 void DirectoryLoader::AddObserver(ChangeListLoaderObserver* observer) { | 218 void DirectoryLoader::AddObserver(ChangeListLoaderObserver* observer) { |
| 219 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 219 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 220 observers_.AddObserver(observer); | 220 observers_.AddObserver(observer); |
| 221 } | 221 } |
| 222 | 222 |
| 223 void DirectoryLoader::RemoveObserver(ChangeListLoaderObserver* observer) { | 223 void DirectoryLoader::RemoveObserver(ChangeListLoaderObserver* observer) { |
| 224 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 224 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 225 observers_.RemoveObserver(observer); | 225 observers_.RemoveObserver(observer); |
| 226 } | 226 } |
| 227 | 227 |
| 228 void DirectoryLoader::ReadDirectory( | 228 void DirectoryLoader::ReadDirectory( |
| 229 const base::FilePath& directory_path, | 229 const base::FilePath& directory_path, |
| 230 const ReadDirectoryEntriesCallback& entries_callback, | 230 const ReadDirectoryEntriesCallback& entries_callback, |
| 231 const FileOperationCallback& completion_callback) { | 231 const FileOperationCallback& completion_callback) { |
| 232 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 232 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 233 DCHECK(!completion_callback.is_null()); | 233 DCHECK(!completion_callback.is_null()); |
| 234 | 234 |
| 235 ResourceEntry* entry = new ResourceEntry; | 235 ResourceEntry* entry = new ResourceEntry; |
| 236 base::PostTaskAndReplyWithResult( | 236 base::PostTaskAndReplyWithResult( |
| 237 blocking_task_runner_.get(), | 237 blocking_task_runner_.get(), |
| 238 FROM_HERE, | 238 FROM_HERE, |
| 239 base::Bind(&ResourceMetadata::GetResourceEntryByPath, | 239 base::Bind(&ResourceMetadata::GetResourceEntryByPath, |
| 240 base::Unretained(resource_metadata_), | 240 base::Unretained(resource_metadata_), |
| 241 directory_path, | 241 directory_path, |
| 242 entry), | 242 entry), |
| 243 base::Bind(&DirectoryLoader::ReadDirectoryAfterGetEntry, | 243 base::Bind(&DirectoryLoader::ReadDirectoryAfterGetEntry, |
| 244 weak_ptr_factory_.GetWeakPtr(), | 244 weak_ptr_factory_.GetWeakPtr(), |
| 245 directory_path, | 245 directory_path, |
| 246 entries_callback, | 246 entries_callback, |
| 247 completion_callback, | 247 completion_callback, |
| 248 true, // should_try_loading_parent | 248 true, // should_try_loading_parent |
| 249 base::Owned(entry))); | 249 base::Owned(entry))); |
| 250 } | 250 } |
| 251 | 251 |
| 252 void DirectoryLoader::ReadDirectoryAfterGetEntry( | 252 void DirectoryLoader::ReadDirectoryAfterGetEntry( |
| 253 const base::FilePath& directory_path, | 253 const base::FilePath& directory_path, |
| 254 const ReadDirectoryEntriesCallback& entries_callback, | 254 const ReadDirectoryEntriesCallback& entries_callback, |
| 255 const FileOperationCallback& completion_callback, | 255 const FileOperationCallback& completion_callback, |
| 256 bool should_try_loading_parent, | 256 bool should_try_loading_parent, |
| 257 const ResourceEntry* entry, | 257 const ResourceEntry* entry, |
| 258 FileError error) { | 258 FileError error) { |
| 259 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 259 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 260 DCHECK(!completion_callback.is_null()); | 260 DCHECK(!completion_callback.is_null()); |
| 261 | 261 |
| 262 if (error == FILE_ERROR_NOT_FOUND && | 262 if (error == FILE_ERROR_NOT_FOUND && |
| 263 should_try_loading_parent && | 263 should_try_loading_parent && |
| 264 util::GetDriveGrandRootPath().IsParent(directory_path)) { | 264 util::GetDriveGrandRootPath().IsParent(directory_path)) { |
| 265 // This entry may be found after loading the parent. | 265 // This entry may be found after loading the parent. |
| 266 ReadDirectory(directory_path.DirName(), | 266 ReadDirectory(directory_path.DirName(), |
| 267 ReadDirectoryEntriesCallback(), | 267 ReadDirectoryEntriesCallback(), |
| 268 base::Bind(&DirectoryLoader::ReadDirectoryAfterLoadParent, | 268 base::Bind(&DirectoryLoader::ReadDirectoryAfterLoadParent, |
| 269 weak_ptr_factory_.GetWeakPtr(), | 269 weak_ptr_factory_.GetWeakPtr(), |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 about_resource_loader_->GetAboutResource( | 301 about_resource_loader_->GetAboutResource( |
| 302 base::Bind(&DirectoryLoader::ReadDirectoryAfterGetAboutResource, | 302 base::Bind(&DirectoryLoader::ReadDirectoryAfterGetAboutResource, |
| 303 weak_ptr_factory_.GetWeakPtr(), local_id)); | 303 weak_ptr_factory_.GetWeakPtr(), local_id)); |
| 304 } | 304 } |
| 305 | 305 |
| 306 void DirectoryLoader::ReadDirectoryAfterLoadParent( | 306 void DirectoryLoader::ReadDirectoryAfterLoadParent( |
| 307 const base::FilePath& directory_path, | 307 const base::FilePath& directory_path, |
| 308 const ReadDirectoryEntriesCallback& entries_callback, | 308 const ReadDirectoryEntriesCallback& entries_callback, |
| 309 const FileOperationCallback& completion_callback, | 309 const FileOperationCallback& completion_callback, |
| 310 FileError error) { | 310 FileError error) { |
| 311 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 311 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 312 DCHECK(!completion_callback.is_null()); | 312 DCHECK(!completion_callback.is_null()); |
| 313 | 313 |
| 314 if (error != FILE_ERROR_OK) { | 314 if (error != FILE_ERROR_OK) { |
| 315 completion_callback.Run(error); | 315 completion_callback.Run(error); |
| 316 return; | 316 return; |
| 317 } | 317 } |
| 318 | 318 |
| 319 ResourceEntry* entry = new ResourceEntry; | 319 ResourceEntry* entry = new ResourceEntry; |
| 320 base::PostTaskAndReplyWithResult( | 320 base::PostTaskAndReplyWithResult( |
| 321 blocking_task_runner_.get(), | 321 blocking_task_runner_.get(), |
| 322 FROM_HERE, | 322 FROM_HERE, |
| 323 base::Bind(&ResourceMetadata::GetResourceEntryByPath, | 323 base::Bind(&ResourceMetadata::GetResourceEntryByPath, |
| 324 base::Unretained(resource_metadata_), | 324 base::Unretained(resource_metadata_), |
| 325 directory_path, | 325 directory_path, |
| 326 entry), | 326 entry), |
| 327 base::Bind(&DirectoryLoader::ReadDirectoryAfterGetEntry, | 327 base::Bind(&DirectoryLoader::ReadDirectoryAfterGetEntry, |
| 328 weak_ptr_factory_.GetWeakPtr(), | 328 weak_ptr_factory_.GetWeakPtr(), |
| 329 directory_path, | 329 directory_path, |
| 330 entries_callback, | 330 entries_callback, |
| 331 completion_callback, | 331 completion_callback, |
| 332 false, // should_try_loading_parent | 332 false, // should_try_loading_parent |
| 333 base::Owned(entry))); | 333 base::Owned(entry))); |
| 334 } | 334 } |
| 335 | 335 |
| 336 void DirectoryLoader::ReadDirectoryAfterGetAboutResource( | 336 void DirectoryLoader::ReadDirectoryAfterGetAboutResource( |
| 337 const std::string& local_id, | 337 const std::string& local_id, |
| 338 google_apis::DriveApiErrorCode status, | 338 google_apis::DriveApiErrorCode status, |
| 339 scoped_ptr<google_apis::AboutResource> about_resource) { | 339 scoped_ptr<google_apis::AboutResource> about_resource) { |
| 340 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 340 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 341 | 341 |
| 342 FileError error = GDataToFileError(status); | 342 FileError error = GDataToFileError(status); |
| 343 if (error != FILE_ERROR_OK) { | 343 if (error != FILE_ERROR_OK) { |
| 344 OnDirectoryLoadComplete(local_id, error); | 344 OnDirectoryLoadComplete(local_id, error); |
| 345 return; | 345 return; |
| 346 } | 346 } |
| 347 | 347 |
| 348 DCHECK(about_resource); | 348 DCHECK(about_resource); |
| 349 | 349 |
| 350 // Check the current status of local metadata, and start loading if needed. | 350 // Check the current status of local metadata, and start loading if needed. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 367 base::Owned(entry), | 367 base::Owned(entry), |
| 368 base::Owned(local_changestamp))); | 368 base::Owned(local_changestamp))); |
| 369 } | 369 } |
| 370 | 370 |
| 371 void DirectoryLoader::ReadDirectoryAfterCheckLocalState( | 371 void DirectoryLoader::ReadDirectoryAfterCheckLocalState( |
| 372 scoped_ptr<google_apis::AboutResource> about_resource, | 372 scoped_ptr<google_apis::AboutResource> about_resource, |
| 373 const std::string& local_id, | 373 const std::string& local_id, |
| 374 const ResourceEntry* entry, | 374 const ResourceEntry* entry, |
| 375 const int64* local_changestamp, | 375 const int64* local_changestamp, |
| 376 FileError error) { | 376 FileError error) { |
| 377 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 377 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 378 DCHECK(about_resource); | 378 DCHECK(about_resource); |
| 379 | 379 |
| 380 if (error != FILE_ERROR_OK) { | 380 if (error != FILE_ERROR_OK) { |
| 381 OnDirectoryLoadComplete(local_id, error); | 381 OnDirectoryLoadComplete(local_id, error); |
| 382 return; | 382 return; |
| 383 } | 383 } |
| 384 // This entry does not exist on the server. | 384 // This entry does not exist on the server. |
| 385 if (entry->resource_id().empty()) { | 385 if (entry->resource_id().empty()) { |
| 386 OnDirectoryLoadComplete(local_id, FILE_ERROR_OK); | 386 OnDirectoryLoadComplete(local_id, FILE_ERROR_OK); |
| 387 return; | 387 return; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 405 OnDirectoryLoadComplete(local_id, FILE_ERROR_OK); | 405 OnDirectoryLoadComplete(local_id, FILE_ERROR_OK); |
| 406 } else { | 406 } else { |
| 407 // Start fetching the directory content, and mark it with the changestamp | 407 // Start fetching the directory content, and mark it with the changestamp |
| 408 // |remote_changestamp|. | 408 // |remote_changestamp|. |
| 409 LoadDirectoryFromServer(directory_fetch_info); | 409 LoadDirectoryFromServer(directory_fetch_info); |
| 410 } | 410 } |
| 411 } | 411 } |
| 412 | 412 |
| 413 void DirectoryLoader::OnDirectoryLoadComplete(const std::string& local_id, | 413 void DirectoryLoader::OnDirectoryLoadComplete(const std::string& local_id, |
| 414 FileError error) { | 414 FileError error) { |
| 415 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 415 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 416 | 416 |
| 417 LoadCallbackMap::iterator it = pending_load_callback_.find(local_id); | 417 LoadCallbackMap::iterator it = pending_load_callback_.find(local_id); |
| 418 if (it == pending_load_callback_.end()) | 418 if (it == pending_load_callback_.end()) |
| 419 return; | 419 return; |
| 420 | 420 |
| 421 // No need to read metadata when no one needs entries. | 421 // No need to read metadata when no one needs entries. |
| 422 bool needs_to_send_entries = false; | 422 bool needs_to_send_entries = false; |
| 423 for (size_t i = 0; i < it->second.size(); ++i) { | 423 for (size_t i = 0; i < it->second.size(); ++i) { |
| 424 const ReadDirectoryCallbackState& callback_state = it->second[i]; | 424 const ReadDirectoryCallbackState& callback_state = it->second[i]; |
| 425 if (!callback_state.entries_callback.is_null()) | 425 if (!callback_state.entries_callback.is_null()) |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 callback_state->sent_entry_names.insert(entry.base_name()); | 480 callback_state->sent_entry_names.insert(entry.base_name()); |
| 481 entries_to_send->push_back(entry); | 481 entries_to_send->push_back(entry); |
| 482 } | 482 } |
| 483 } | 483 } |
| 484 callback_state->entries_callback.Run(entries_to_send.Pass()); | 484 callback_state->entries_callback.Run(entries_to_send.Pass()); |
| 485 } | 485 } |
| 486 } | 486 } |
| 487 | 487 |
| 488 void DirectoryLoader::LoadDirectoryFromServer( | 488 void DirectoryLoader::LoadDirectoryFromServer( |
| 489 const DirectoryFetchInfo& directory_fetch_info) { | 489 const DirectoryFetchInfo& directory_fetch_info) { |
| 490 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 490 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 491 DCHECK(!directory_fetch_info.empty()); | 491 DCHECK(!directory_fetch_info.empty()); |
| 492 DVLOG(1) << "Start loading directory: " << directory_fetch_info.ToString(); | 492 DVLOG(1) << "Start loading directory: " << directory_fetch_info.ToString(); |
| 493 | 493 |
| 494 const google_apis::AboutResource* about_resource = | 494 const google_apis::AboutResource* about_resource = |
| 495 about_resource_loader_->cached_about_resource(); | 495 about_resource_loader_->cached_about_resource(); |
| 496 DCHECK(about_resource); | 496 DCHECK(about_resource); |
| 497 | 497 |
| 498 logger_->Log(logging::LOG_INFO, | 498 logger_->Log(logging::LOG_INFO, |
| 499 "Fast-fetch start: %s; Server changestamp: %s", | 499 "Fast-fetch start: %s; Server changestamp: %s", |
| 500 directory_fetch_info.ToString().c_str(), | 500 directory_fetch_info.ToString().c_str(), |
| 501 base::Int64ToString( | 501 base::Int64ToString( |
| 502 about_resource->largest_change_id()).c_str()); | 502 about_resource->largest_change_id()).c_str()); |
| 503 | 503 |
| 504 FeedFetcher* fetcher = new FeedFetcher(this, | 504 FeedFetcher* fetcher = new FeedFetcher(this, |
| 505 directory_fetch_info, | 505 directory_fetch_info, |
| 506 about_resource->root_folder_id()); | 506 about_resource->root_folder_id()); |
| 507 fast_fetch_feed_fetcher_set_.insert(fetcher); | 507 fast_fetch_feed_fetcher_set_.insert(fetcher); |
| 508 fetcher->Run( | 508 fetcher->Run( |
| 509 base::Bind(&DirectoryLoader::LoadDirectoryFromServerAfterLoad, | 509 base::Bind(&DirectoryLoader::LoadDirectoryFromServerAfterLoad, |
| 510 weak_ptr_factory_.GetWeakPtr(), | 510 weak_ptr_factory_.GetWeakPtr(), |
| 511 directory_fetch_info, | 511 directory_fetch_info, |
| 512 fetcher)); | 512 fetcher)); |
| 513 } | 513 } |
| 514 | 514 |
| 515 void DirectoryLoader::LoadDirectoryFromServerAfterLoad( | 515 void DirectoryLoader::LoadDirectoryFromServerAfterLoad( |
| 516 const DirectoryFetchInfo& directory_fetch_info, | 516 const DirectoryFetchInfo& directory_fetch_info, |
| 517 FeedFetcher* fetcher, | 517 FeedFetcher* fetcher, |
| 518 FileError error) { | 518 FileError error) { |
| 519 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 519 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 520 DCHECK(!directory_fetch_info.empty()); | 520 DCHECK(!directory_fetch_info.empty()); |
| 521 | 521 |
| 522 // Delete the fetcher. | 522 // Delete the fetcher. |
| 523 fast_fetch_feed_fetcher_set_.erase(fetcher); | 523 fast_fetch_feed_fetcher_set_.erase(fetcher); |
| 524 delete fetcher; | 524 delete fetcher; |
| 525 | 525 |
| 526 logger_->Log(logging::LOG_INFO, | 526 logger_->Log(logging::LOG_INFO, |
| 527 "Fast-fetch complete: %s => %s", | 527 "Fast-fetch complete: %s => %s", |
| 528 directory_fetch_info.ToString().c_str(), | 528 directory_fetch_info.ToString().c_str(), |
| 529 FileErrorToString(error).c_str()); | 529 FileErrorToString(error).c_str()); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 549 &DirectoryLoader::LoadDirectoryFromServerAfterUpdateChangestamp, | 549 &DirectoryLoader::LoadDirectoryFromServerAfterUpdateChangestamp, |
| 550 weak_ptr_factory_.GetWeakPtr(), | 550 weak_ptr_factory_.GetWeakPtr(), |
| 551 directory_fetch_info, | 551 directory_fetch_info, |
| 552 base::Owned(directory_path))); | 552 base::Owned(directory_path))); |
| 553 } | 553 } |
| 554 | 554 |
| 555 void DirectoryLoader::LoadDirectoryFromServerAfterUpdateChangestamp( | 555 void DirectoryLoader::LoadDirectoryFromServerAfterUpdateChangestamp( |
| 556 const DirectoryFetchInfo& directory_fetch_info, | 556 const DirectoryFetchInfo& directory_fetch_info, |
| 557 const base::FilePath* directory_path, | 557 const base::FilePath* directory_path, |
| 558 FileError error) { | 558 FileError error) { |
| 559 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 559 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 560 | 560 |
| 561 DVLOG(1) << "Directory loaded: " << directory_fetch_info.ToString(); | 561 DVLOG(1) << "Directory loaded: " << directory_fetch_info.ToString(); |
| 562 OnDirectoryLoadComplete(directory_fetch_info.local_id(), error); | 562 OnDirectoryLoadComplete(directory_fetch_info.local_id(), error); |
| 563 | 563 |
| 564 // Also notify the observers. | 564 // Also notify the observers. |
| 565 if (error == FILE_ERROR_OK && !directory_path->empty()) { | 565 if (error == FILE_ERROR_OK && !directory_path->empty()) { |
| 566 FOR_EACH_OBSERVER(ChangeListLoaderObserver, | 566 FOR_EACH_OBSERVER(ChangeListLoaderObserver, |
| 567 observers_, | 567 observers_, |
| 568 OnDirectoryReloaded(*directory_path)); | 568 OnDirectoryReloaded(*directory_path)); |
| 569 } | 569 } |
| 570 } | 570 } |
| 571 | 571 |
| 572 } // namespace internal | 572 } // namespace internal |
| 573 } // namespace drive | 573 } // namespace drive |
| OLD | NEW |