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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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::GDataErrorCode 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(BrowserThread::CurrentlyOn(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 |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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::GDataErrorCode 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(BrowserThread::CurrentlyOn(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); |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |