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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_file_system.cc

Issue 10836285: Refactor GDataWapiFeedLoader::LoadFromServer() parameters (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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/gdata/gdata_file_system.h" 5 #include "chrome/browser/chromeos/gdata/gdata_file_system.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 2008 matching lines...) Expand 10 before | Expand all | Expand 10 after
2019 GDataFileError error, 2019 GDataFileError error,
2020 scoped_ptr<GDataEntryProto> entry_proto) { 2020 scoped_ptr<GDataEntryProto> entry_proto) {
2021 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 2021 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
2022 2022
2023 if (error != GDATA_FILE_OK || 2023 if (error != GDATA_FILE_OK ||
2024 !entry_proto->file_info().is_directory()) { 2024 !entry_proto->file_info().is_directory()) {
2025 LOG(ERROR) << "Directory entry not found: " << file_path.value(); 2025 LOG(ERROR) << "Directory entry not found: " << file_path.value();
2026 return; 2026 return;
2027 } 2027 }
2028 2028
2029 feed_loader_->LoadFromServer( 2029 LoadFeedParams param(directory_service_->origin(),
2030 directory_service_->origin(), 2030 base::Bind(&GDataFileSystem::OnRequestDirectoryRefresh,
2031 0, // start_changestamp - Not a delta feed. 2031 ui_weak_ptr_,
2032 0, // root_feed_changestamp - Not used. 2032 file_path));
2033 true, // multiple feeds 2033 param.directory_resource_id = entry_proto->resource_id();
2034 std::string(), // No search query 2034 param.load_finished_callback = FileOperationCallback();
2035 GURL(), // feed_to_load - Feed not explicitly set 2035 feed_loader_->LoadFromServer(param);
2036 entry_proto->resource_id(), // Load the feed for this directory.
2037 FileOperationCallback(), // load_finished_callback.
2038 base::Bind(&GDataFileSystem::OnRequestDirectoryRefresh,
2039 ui_weak_ptr_,
2040 file_path));
2041 } 2036 }
2042 2037
2043 void GDataFileSystem::OnRequestDirectoryRefresh( 2038 void GDataFileSystem::OnRequestDirectoryRefresh(
2044 const FilePath& directory_path, 2039 const FilePath& directory_path,
2045 GetDocumentsParams* params, 2040 GetDocumentsParams* params,
2046 GDataFileError error) { 2041 GDataFileError error) {
2047 DCHECK(params); 2042 DCHECK(params);
2048 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 2043 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
2049 2044
2050 if (error != GDATA_FILE_OK) { 2045 if (error != GDATA_FILE_OK) {
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
2432 2427
2433 void GDataFileSystem::SearchAsyncOnUIThread( 2428 void GDataFileSystem::SearchAsyncOnUIThread(
2434 const std::string& search_query, 2429 const std::string& search_query,
2435 const GURL& next_feed, 2430 const GURL& next_feed,
2436 const SearchCallback& callback) { 2431 const SearchCallback& callback) {
2437 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 2432 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
2438 scoped_ptr<std::vector<DocumentFeed*> > feed_list( 2433 scoped_ptr<std::vector<DocumentFeed*> > feed_list(
2439 new std::vector<DocumentFeed*>); 2434 new std::vector<DocumentFeed*>);
2440 2435
2441 ContentOrigin initial_origin = directory_service_->origin(); 2436 ContentOrigin initial_origin = directory_service_->origin();
2442 feed_loader_->LoadFromServer( 2437 LoadFeedParams param(
2443 initial_origin, 2438 initial_origin,
2444 0, 0, // We don't use change stamps when fetching search
2445 // data; we always fetch the whole result feed.
2446 false, // Stop fetching search results after first feed
2447 // chunk to avoid displaying huge number of search
2448 // results (especially since we don't cache them).
2449 search_query,
2450 next_feed,
2451 std::string(), // No directory resource ID.
2452 FileOperationCallback(), // Not used.
2453 base::Bind(&GDataFileSystem::OnSearch, ui_weak_ptr_, callback)); 2439 base::Bind(&GDataFileSystem::OnSearch, ui_weak_ptr_, callback));
2440 param.search_query = search_query;
2441 param.feed_to_load = next_feed;
2442 feed_loader_->LoadFromServer(param);
2454 } 2443 }
2455 2444
2456 void GDataFileSystem::OnDirectoryChanged(const FilePath& directory_path) { 2445 void GDataFileSystem::OnDirectoryChanged(const FilePath& directory_path) {
2457 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 2446 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
2458 2447
2459 FOR_EACH_OBSERVER(GDataFileSystemInterface::Observer, observers_, 2448 FOR_EACH_OBSERVER(GDataFileSystemInterface::Observer, observers_,
2460 OnDirectoryChanged(directory_path)); 2449 OnDirectoryChanged(directory_path));
2461 } 2450 }
2462 2451
2463 void GDataFileSystem::OnDocumentFeedFetched(int num_accumulated_entries) { 2452 void GDataFileSystem::OnDocumentFeedFetched(int num_accumulated_entries) {
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after
3455 return; 3444 return;
3456 } 3445 }
3457 3446
3458 PlatformFileInfoProto entry_file_info; 3447 PlatformFileInfoProto entry_file_info;
3459 GDataEntry::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); 3448 GDataEntry::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info);
3460 *entry_proto->mutable_file_info() = entry_file_info; 3449 *entry_proto->mutable_file_info() = entry_file_info;
3461 callback.Run(GDATA_FILE_OK, entry_proto.Pass()); 3450 callback.Run(GDATA_FILE_OK, entry_proto.Pass());
3462 } 3451 }
3463 3452
3464 } // namespace gdata 3453 } // namespace gdata
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698