diff options
author | yoshiki@chromium.org <yoshiki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-02 16:39:38 +0000 |
---|---|---|
committer | yoshiki@chromium.org <yoshiki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-02 16:39:38 +0000 |
commit | 5ba42e7bc3aae726dedf6ae3ed52ca69019bfa4e (patch) | |
tree | 65211a0ae346244326c01b98c71cabf693c461a0 /chrome/browser | |
parent | 1b19c9a1e537331bccb1c215aa779339e17ba71e (diff) | |
download | chromium_src-5ba42e7bc3aae726dedf6ae3ed52ca69019bfa4e.zip chromium_src-5ba42e7bc3aae726dedf6ae3ed52ca69019bfa4e.tar.gz chromium_src-5ba42e7bc3aae726dedf6ae3ed52ca69019bfa4e.tar.bz2 |
Drive: Remove 'feed' from class/funciton/variable names from Drive code
- FeedLink -> ResourceLink
- FeedEntry -> CommonMetadata
- AccountMetadataFeed -> AccountMetadata
- DriveFeedLoader -> ChangeListLoader
- DriveFeedLoaderObserver -> ChangeListLoaderObserver
- DriveFeedProcessor -> ChangeListProcessor
- FeedToEntryProtoMapUMAStats -> ChangeListToEntryProtoMapUMAStats
% grep -h 'class .*Feed' google_apis/**/*.{h,cc} chromeos/drive/**/*.{h,cc} | wc -l
0
BUG=165395
TEST=build success.
NOTRY=True
R=satorux@chromium.org, tzik@chromium.org
TBR=sky@chromium.org
# TBRing for *.gypi changes.
Review URL: https://chromiumcodereview.appspot.com/12377010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@185703 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
37 files changed, 336 insertions, 332 deletions
diff --git a/chrome/browser/chromeos/drive/drive_feed_loader.cc b/chrome/browser/chromeos/drive/change_list_loader.cc index 301b746..e2b3dd7 100644 --- a/chrome/browser/chromeos/drive/drive_feed_loader.cc +++ b/chrome/browser/chromeos/drive/change_list_loader.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/drive/drive_feed_loader.h" +#include "chrome/browser/chromeos/drive/change_list_loader.h" #include <set> @@ -14,9 +14,9 @@ #include "base/stringprintf.h" #include "base/threading/sequenced_worker_pool.h" #include "base/values.h" +#include "chrome/browser/chromeos/drive/change_list_loader_observer.h" +#include "chrome/browser/chromeos/drive/change_list_processor.h" #include "chrome/browser/chromeos/drive/drive_cache.h" -#include "chrome/browser/chromeos/drive/drive_feed_loader_observer.h" -#include "chrome/browser/chromeos/drive/drive_feed_processor.h" #include "chrome/browser/chromeos/drive/drive_file_system_util.h" #include "chrome/browser/chromeos/drive/drive_scheduler.h" #include "chrome/browser/chromeos/drive/drive_webapps_registry.h" @@ -134,7 +134,7 @@ scoped_ptr<google_apis::ResourceList> ParseFeedOnBlockingPool( // // When all feeds are loaded, |feed_load_callback| is invoked with the retrieved // feeds. |feed_load_callback| must not be null. -struct DriveFeedLoader::LoadFeedParams { +struct ChangeListLoader::LoadFeedParams { explicit LoadFeedParams(const LoadFeedListCallback& feed_load_callback) : start_changestamp(0), shared_with_me(false), @@ -162,7 +162,7 @@ struct DriveFeedLoader::LoadFeedParams { }; // Defines set of parameters sent to callback OnProtoLoaded(). -struct DriveFeedLoader::LoadRootFeedParams { +struct ChangeListLoader::LoadRootFeedParams { explicit LoadRootFeedParams(const FileOperationCallback& callback) : load_start_time(base::Time::Now()), callback(callback) {} @@ -181,7 +181,7 @@ struct DriveFeedLoader::LoadRootFeedParams { // // On initial feed load for Drive API, remember root ID for // DriveResourceData initialization later in UpdateFromFeed(). -struct DriveFeedLoader::UpdateMetadataParams { +struct ChangeListLoader::UpdateMetadataParams { UpdateMetadataParams(bool is_delta_feed, int64 feed_changestamp, const FileOperationCallback& callback) @@ -201,7 +201,7 @@ struct DriveFeedLoader::UpdateMetadataParams { // the current update state. In order to make users comfortable, // we increment the number of fetched documents with more frequent but smaller // steps than actual fetching. -struct DriveFeedLoader::GetResourceListUiState { +struct ChangeListLoader::GetResourceListUiState { explicit GetResourceListUiState(base::TimeTicks start_time) : num_fetched_documents(0), num_showing_documents(0), @@ -224,7 +224,7 @@ struct DriveFeedLoader::GetResourceListUiState { base::WeakPtrFactory<GetResourceListUiState> weak_ptr_factory; }; -DriveFeedLoader::DriveFeedLoader( +ChangeListLoader::ChangeListLoader( DriveResourceMetadata* resource_metadata, DriveScheduler* scheduler, DriveWebAppsRegistry* webapps_registry, @@ -239,20 +239,20 @@ DriveFeedLoader::DriveFeedLoader( ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { } -DriveFeedLoader::~DriveFeedLoader() { +ChangeListLoader::~ChangeListLoader() { } -void DriveFeedLoader::AddObserver(DriveFeedLoaderObserver* observer) { +void ChangeListLoader::AddObserver(ChangeListLoaderObserver* observer) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); observers_.AddObserver(observer); } -void DriveFeedLoader::RemoveObserver(DriveFeedLoaderObserver* observer) { +void ChangeListLoader::RemoveObserver(ChangeListLoaderObserver* observer) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); observers_.RemoveObserver(observer); } -void DriveFeedLoader::ReloadFromServerIfNeeded( +void ChangeListLoader::ReloadFromServerIfNeeded( const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -268,22 +268,22 @@ void DriveFeedLoader::ReloadFromServerIfNeeded( // TODO(haruki): Application list rarely changes and is not necessarily // refreshed as often as files. scheduler_->GetAppList( - base::Bind(&DriveFeedLoader::OnGetAppList, + base::Bind(&ChangeListLoader::OnGetAppList, weak_ptr_factory_.GetWeakPtr())); } // First fetch the latest changestamp to see if there were any new changes // there at all. scheduler_->GetAccountMetadata( - base::Bind(&DriveFeedLoader::OnGetAccountMetadata, + base::Bind(&ChangeListLoader::OnGetAccountMetadata, weak_ptr_factory_.GetWeakPtr(), callback)); } -void DriveFeedLoader::OnGetAccountMetadata( +void ChangeListLoader::OnGetAccountMetadata( const FileOperationCallback& callback, google_apis::GDataErrorCode status, - scoped_ptr<google_apis::AccountMetadataFeed> account_metadata) { + scoped_ptr<google_apis::AccountMetadata> account_metadata) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); DCHECK(refreshing_); @@ -297,13 +297,13 @@ void DriveFeedLoader::OnGetAccountMetadata( } resource_metadata_->GetLargestChangestamp( - base::Bind(&DriveFeedLoader::CompareChangestampsAndLoadIfNeeded, + base::Bind(&ChangeListLoader::CompareChangestampsAndLoadIfNeeded, weak_ptr_factory_.GetWeakPtr(), callback, remote_changestamp)); } -void DriveFeedLoader::CompareChangestampsAndLoadIfNeeded( +void ChangeListLoader::CompareChangestampsAndLoadIfNeeded( const FileOperationCallback& callback, int64 remote_changestamp, int64 local_changestamp) { @@ -328,7 +328,7 @@ void DriveFeedLoader::CompareChangestampsAndLoadIfNeeded( // Load changes from the server. int64 start_changestamp = local_changestamp > 0 ? local_changestamp + 1 : 0; scoped_ptr<LoadFeedParams> load_params(new LoadFeedParams( - base::Bind(&DriveFeedLoader::UpdateMetadataFromFeedAfterLoadFromServer, + base::Bind(&ChangeListLoader::UpdateMetadataFromFeedAfterLoadFromServer, weak_ptr_factory_.GetWeakPtr(), UpdateMetadataParams(start_changestamp != 0, // is_delta_feed remote_changestamp, @@ -337,7 +337,7 @@ void DriveFeedLoader::CompareChangestampsAndLoadIfNeeded( LoadFromServer(load_params.Pass()); } -void DriveFeedLoader::OnGetAppList(google_apis::GDataErrorCode status, +void ChangeListLoader::OnGetAppList(google_apis::GDataErrorCode status, scoped_ptr<google_apis::AppList> app_list) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -350,7 +350,7 @@ void DriveFeedLoader::OnGetAppList(google_apis::GDataErrorCode status, } } -void DriveFeedLoader::LoadFromServer(scoped_ptr<LoadFeedParams> params) { +void ChangeListLoader::LoadFromServer(scoped_ptr<LoadFeedParams> params) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); const base::TimeTicks start_time = base::TimeTicks::Now(); @@ -363,13 +363,13 @@ void DriveFeedLoader::LoadFromServer(scoped_ptr<LoadFeedParams> params) { params_ptr->search_query, params_ptr->shared_with_me, params_ptr->directory_resource_id, - base::Bind(&DriveFeedLoader::OnGetResourceList, + base::Bind(&ChangeListLoader::OnGetResourceList, weak_ptr_factory_.GetWeakPtr(), base::Passed(¶ms), start_time)); } -void DriveFeedLoader::LoadDirectoryFromServer( +void ChangeListLoader::LoadDirectoryFromServer( const std::string& directory_resource_id, const LoadFeedListCallback& feed_load_callback) { DCHECK(!feed_load_callback.is_null()); @@ -379,7 +379,7 @@ void DriveFeedLoader::LoadDirectoryFromServer( LoadFromServer(params.Pass()); } -void DriveFeedLoader::SearchFromServer( +void ChangeListLoader::SearchFromServer( const std::string& search_query, bool shared_with_me, const GURL& next_feed, @@ -394,7 +394,7 @@ void DriveFeedLoader::SearchFromServer( LoadFromServer(params.Pass()); } -void DriveFeedLoader::UpdateMetadataFromFeedAfterLoadFromServer( +void ChangeListLoader::UpdateMetadataFromFeedAfterLoadFromServer( const UpdateMetadataParams& params, const ScopedVector<google_apis::ResourceList>& feed_list, DriveFileError error) { @@ -411,12 +411,12 @@ void DriveFeedLoader::UpdateMetadataFromFeedAfterLoadFromServer( UpdateFromFeed(feed_list, params.is_delta_feed, params.feed_changestamp, - base::Bind(&DriveFeedLoader::OnUpdateFromFeed, + base::Bind(&ChangeListLoader::OnUpdateFromFeed, weak_ptr_factory_.GetWeakPtr(), params.callback)); } -void DriveFeedLoader::OnGetResourceList( +void ChangeListLoader::OnGetResourceList( scoped_ptr<LoadFeedParams> params, base::TimeTicks start_time, google_apis::GDataErrorCode status, @@ -463,7 +463,7 @@ void DriveFeedLoader::OnGetResourceList( // Currently the UI update is stopped. Start UI periodic callback. base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(&DriveFeedLoader::OnNotifyResourceListFetched, + base::Bind(&ChangeListLoader::OnNotifyResourceListFetched, weak_ptr_factory_.GetWeakPtr(), ui_state->weak_ptr_factory.GetWeakPtr())); } @@ -480,7 +480,7 @@ void DriveFeedLoader::OnGetResourceList( params_ptr->search_query, params_ptr->shared_with_me, params_ptr->directory_resource_id, - base::Bind(&DriveFeedLoader::OnGetResourceList, + base::Bind(&ChangeListLoader::OnGetResourceList, weak_ptr_factory_.GetWeakPtr(), base::Passed(¶ms), start_time)); @@ -488,7 +488,7 @@ void DriveFeedLoader::OnGetResourceList( } // Notify the observers that all document feeds are fetched. - FOR_EACH_OBSERVER(DriveFeedLoaderObserver, observers_, + FOR_EACH_OBSERVER(ChangeListLoaderObserver, observers_, OnResourceListFetched(num_accumulated_entries)); UMA_HISTOGRAM_TIMES("Drive.EntireFeedLoadTime", @@ -498,7 +498,7 @@ void DriveFeedLoader::OnGetResourceList( params->RunFeedLoadCallback(DRIVE_FILE_OK); } -void DriveFeedLoader::OnNotifyResourceListFetched( +void ChangeListLoader::OnNotifyResourceListFetched( base::WeakPtr<GetResourceListUiState> ui_state) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -514,7 +514,7 @@ void DriveFeedLoader::OnNotifyResourceListFetched( if (ui_state->num_showing_documents + kFetchUiUpdateStep <= ui_state->num_fetched_documents) { ui_state->num_showing_documents += kFetchUiUpdateStep; - FOR_EACH_OBSERVER(DriveFeedLoaderObserver, observers_, + FOR_EACH_OBSERVER(ChangeListLoaderObserver, observers_, OnResourceListFetched(ui_state->num_showing_documents)); int num_remaining_ui_updates = @@ -534,7 +534,7 @@ void DriveFeedLoader::OnNotifyResourceListFetched( base::MessageLoopProxy::current()->PostDelayedTask( FROM_HERE, - base::Bind(&DriveFeedLoader::OnNotifyResourceListFetched, + base::Bind(&ChangeListLoader::OnNotifyResourceListFetched, weak_ptr_factory_.GetWeakPtr(), ui_state->weak_ptr_factory.GetWeakPtr()), interval); @@ -542,7 +542,7 @@ void DriveFeedLoader::OnNotifyResourceListFetched( } } -void DriveFeedLoader::LoadFromCache(const FileOperationCallback& callback) { +void ChangeListLoader::LoadFromCache(const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); DCHECK(!resource_metadata_->loaded()); @@ -561,7 +561,7 @@ void DriveFeedLoader::LoadFromCache(const FileOperationCallback& callback) { path = path.Append(kResourceMetadataDBFile); resource_metadata_->InitFromDB(path, blocking_task_runner_, base::Bind( - &DriveFeedLoader::ContinueWithInitializedResourceMetadata, + &ChangeListLoader::ContinueWithInitializedResourceMetadata, weak_ptr_factory_.GetWeakPtr(), base::Owned(params))); } else { @@ -571,13 +571,13 @@ void DriveFeedLoader::LoadFromCache(const FileOperationCallback& callback) { FROM_HERE, base::Bind(&LoadProtoOnBlockingPool, path, ¶ms->last_modified, ¶ms->proto), - base::Bind(&DriveFeedLoader::OnProtoLoaded, + base::Bind(&ChangeListLoader::OnProtoLoaded, weak_ptr_factory_.GetWeakPtr(), base::Owned(params))); } } -void DriveFeedLoader::OnProtoLoaded(LoadRootFeedParams* params, +void ChangeListLoader::OnProtoLoaded(LoadRootFeedParams* params, DriveFileError error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(refreshing_); @@ -598,7 +598,7 @@ void DriveFeedLoader::OnProtoLoaded(LoadRootFeedParams* params, ContinueWithInitializedResourceMetadata(params, error); } -void DriveFeedLoader::ContinueWithInitializedResourceMetadata( +void ChangeListLoader::ContinueWithInitializedResourceMetadata( LoadRootFeedParams* params, DriveFileError error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -612,7 +612,7 @@ void DriveFeedLoader::ContinueWithInitializedResourceMetadata( params->callback.Run(error); } -void DriveFeedLoader::SaveFileSystem() { +void ChangeListLoader::SaveFileSystem() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (!ShouldSerializeFileSystemNow(resource_metadata_->serialized_size(), @@ -637,7 +637,7 @@ void DriveFeedLoader::SaveFileSystem() { } } -void DriveFeedLoader::UpdateFromFeed( +void ChangeListLoader::UpdateFromFeed( const ScopedVector<google_apis::ResourceList>& feed_list, bool is_delta_feed, int64 root_feed_changestamp, @@ -646,44 +646,44 @@ void DriveFeedLoader::UpdateFromFeed( DCHECK(!update_finished_callback.is_null()); DVLOG(1) << "Updating directory with a feed"; - feed_processor_.reset(new DriveFeedProcessor(resource_metadata_)); + change_list_processor_.reset(new ChangeListProcessor(resource_metadata_)); // Don't send directory content change notification while performing // the initial content retrieval. const bool should_notify_changed_directories = is_delta_feed; - feed_processor_->ApplyFeeds( + change_list_processor_->ApplyFeeds( feed_list, is_delta_feed, root_feed_changestamp, - base::Bind(&DriveFeedLoader::NotifyDirectoryChanged, + base::Bind(&ChangeListLoader::NotifyDirectoryChanged, weak_ptr_factory_.GetWeakPtr(), should_notify_changed_directories, update_finished_callback)); } -void DriveFeedLoader::NotifyDirectoryChanged( +void ChangeListLoader::NotifyDirectoryChanged( bool should_notify_changed_directories, const base::Closure& update_finished_callback) { - DCHECK(feed_processor_.get()); + DCHECK(change_list_processor_.get()); DCHECK(!update_finished_callback.is_null()); if (should_notify_changed_directories) { for (std::set<base::FilePath>::iterator dir_iter = - feed_processor_->changed_dirs().begin(); - dir_iter != feed_processor_->changed_dirs().end(); + change_list_processor_->changed_dirs().begin(); + dir_iter != change_list_processor_->changed_dirs().end(); ++dir_iter) { - FOR_EACH_OBSERVER(DriveFeedLoaderObserver, observers_, + FOR_EACH_OBSERVER(ChangeListLoaderObserver, observers_, OnDirectoryChanged(*dir_iter)); } } update_finished_callback.Run(); - // Cannot delete feed_processor_ yet because we are in on_complete_callback_, - // which is owned by feed_processor_. + // Cannot delete change_list_processor_ yet because we are in + // on_complete_callback_, which is owned by change_list_processor_. } -void DriveFeedLoader::OnUpdateFromFeed( +void ChangeListLoader::OnUpdateFromFeed( const FileOperationCallback& load_finished_callback) { DCHECK(!load_finished_callback.is_null()); @@ -695,7 +695,7 @@ void DriveFeedLoader::OnUpdateFromFeed( // Run the callback now that the filesystem is ready. load_finished_callback.Run(DRIVE_FILE_OK); - FOR_EACH_OBSERVER(DriveFeedLoaderObserver, + FOR_EACH_OBSERVER(ChangeListLoaderObserver, observers_, OnFeedFromServerLoaded()); } diff --git a/chrome/browser/chromeos/drive/drive_feed_loader.h b/chrome/browser/chromeos/drive/change_list_loader.h index a6f3fe8..2118f9d 100644 --- a/chrome/browser/chromeos/drive/drive_feed_loader.h +++ b/chrome/browser/chromeos/drive/change_list_loader.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FEED_LOADER_H_ -#define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FEED_LOADER_H_ +#ifndef CHROME_BROWSER_CHROMEOS_DRIVE_CHANGE_LIST_LOADER_H_ +#define CHROME_BROWSER_CHROMEOS_DRIVE_CHANGE_LIST_LOADER_H_ #include <string> @@ -20,15 +20,15 @@ class Value; namespace google_apis { class AppList; -class AccountMetadataFeed; +class AccountMetadata; class ResourceList; } namespace drive { class DriveCache; -class DriveFeedLoaderObserver; -class DriveFeedProcessor; +class ChangeListLoaderObserver; +class ChangeListProcessor; class DriveScheduler; class DriveWebAppsRegistry; @@ -37,21 +37,21 @@ typedef base::Callback< void(const ScopedVector<google_apis::ResourceList>& feed_list, DriveFileError error)> LoadFeedListCallback; -// DriveFeedLoader is used to load feeds from WAPI (codename for +// ChangeListLoader is used to load feeds from WAPI (codename for // Documents List API) and load the cached proto file. -class DriveFeedLoader { +class ChangeListLoader { public: - DriveFeedLoader( + ChangeListLoader( DriveResourceMetadata* resource_metadata, DriveScheduler* scheduler, DriveWebAppsRegistry* webapps_registry, DriveCache* cache, scoped_refptr<base::SequencedTaskRunner> blocking_task_runner); - ~DriveFeedLoader(); + ~ChangeListLoader(); // Adds and removes the observer. - void AddObserver(DriveFeedLoaderObserver* observer); - void RemoveObserver(DriveFeedLoaderObserver* observer); + void AddObserver(ChangeListLoaderObserver* observer); + void RemoveObserver(ChangeListLoaderObserver* observer); // Starts root feed load from the cache, and runs |callback| to tell the // result to the caller. @@ -84,7 +84,7 @@ class DriveFeedLoader { // Updates whole directory structure feeds collected in |feed_list|. // Record file statistics as UMA histograms. // - // See comments at DriveFeedProcessor::ApplyFeeds() for + // See comments at ChangeListProcessor::ApplyFeeds() for // |is_delta_feed| and |root_feed_changestamp|. // |update_finished_callback| must not be null. void UpdateFromFeed(const ScopedVector<google_apis::ResourceList>& feed_list, @@ -118,7 +118,7 @@ class DriveFeedLoader { void OnGetAccountMetadata( const FileOperationCallback& callback, google_apis::GDataErrorCode status, - scoped_ptr<google_apis::AccountMetadataFeed> account_metadata); + scoped_ptr<google_apis::AccountMetadata> account_metadata); // Callback for DriveResourceMetadata::GetLargestChangestamp. // Compares |remote_changestamp| and |local_changestamp| and triggers @@ -159,7 +159,7 @@ class DriveFeedLoader { void OnNotifyResourceListFetched( base::WeakPtr<GetResourceListUiState> ui_state); - // Callback for DriveFeedProcessor::ApplyFeeds. + // Callback for ChangeListProcessor::ApplyFeeds. void NotifyDirectoryChanged(bool should_notify, const base::Closure& update_finished_callback); @@ -171,18 +171,18 @@ class DriveFeedLoader { DriveWebAppsRegistry* webapps_registry_; // Not owned. DriveCache* cache_; // Not owned. scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; - ObserverList<DriveFeedLoaderObserver> observers_; - scoped_ptr<DriveFeedProcessor> feed_processor_; + ObserverList<ChangeListLoaderObserver> observers_; + scoped_ptr<ChangeListProcessor> change_list_processor_; // Indicates whether there is a feed refreshing server request is in flight. bool refreshing_; // Note: This should remain the last member so it'll be destroyed and // invalidate its weak pointers before any other members are destroyed. - base::WeakPtrFactory<DriveFeedLoader> weak_ptr_factory_; - DISALLOW_COPY_AND_ASSIGN(DriveFeedLoader); + base::WeakPtrFactory<ChangeListLoader> weak_ptr_factory_; + DISALLOW_COPY_AND_ASSIGN(ChangeListLoader); }; } // namespace drive -#endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FEED_LOADER_H_ +#endif // CHROME_BROWSER_CHROMEOS_DRIVE_CHANGE_LIST_LOADER_H_ diff --git a/chrome/browser/chromeos/drive/drive_feed_loader_observer.h b/chrome/browser/chromeos/drive/change_list_loader_observer.h index 857c57b..ad96ff8 100644 --- a/chrome/browser/chromeos/drive/drive_feed_loader_observer.h +++ b/chrome/browser/chromeos/drive/change_list_loader_observer.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FEED_LOADER_OBSERVER_H_ -#define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FEED_LOADER_OBSERVER_H_ +#ifndef CHROME_BROWSER_CHROMEOS_DRIVE_CHANGE_LIST_LOADER_OBSERVER_H_ +#define CHROME_BROWSER_CHROMEOS_DRIVE_CHANGE_LIST_LOADER_OBSERVER_H_ namespace base { class FilePath; @@ -11,9 +11,9 @@ class FilePath; namespace drive { -// Interface for classes that need to observe events from DriveFeedLoader. +// Interface for classes that need to observe events from ChangeListLoader. // All events are notified on UI thread. -class DriveFeedLoaderObserver { +class ChangeListLoaderObserver { public: // Triggered when a content of a directory has been changed. // |directory_path| is a virtual directory path representing the @@ -31,9 +31,9 @@ class DriveFeedLoaderObserver { } protected: - virtual ~DriveFeedLoaderObserver() {} + virtual ~ChangeListLoaderObserver() {} }; } // namespace drive -#endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FEED_LOADER_OBSERVER_H_ +#endif // CHROME_BROWSER_CHROMEOS_DRIVE_CHANGE_LIST_LOADER_OBSERVER_H_ diff --git a/chrome/browser/chromeos/drive/drive_feed_processor.cc b/chrome/browser/chromeos/drive/change_list_processor.cc index dde43bc..630b256 100644 --- a/chrome/browser/chromeos/drive/drive_feed_processor.cc +++ b/chrome/browser/chromeos/drive/change_list_processor.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/drive/drive_feed_processor.h" +#include "chrome/browser/chromeos/drive/change_list_processor.h" #include <utility> @@ -32,9 +32,9 @@ void RunOnCompleteCallback(const base::Closure& on_complete_callback, } // namespace -class DriveFeedProcessor::FeedToEntryProtoMapUMAStats { +class ChangeListProcessor::ChangeListToEntryProtoMapUMAStats { public: - FeedToEntryProtoMapUMAStats() + ChangeListToEntryProtoMapUMAStats() : num_regular_files_(0), num_hosted_documents_(0) { } @@ -58,16 +58,17 @@ class DriveFeedProcessor::FeedToEntryProtoMapUMAStats { int num_hosted_documents_; }; -DriveFeedProcessor::DriveFeedProcessor(DriveResourceMetadata* resource_metadata) +ChangeListProcessor::ChangeListProcessor( + DriveResourceMetadata* resource_metadata) : resource_metadata_(resource_metadata), largest_changestamp_(0), ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { } -DriveFeedProcessor::~DriveFeedProcessor() { +ChangeListProcessor::~ChangeListProcessor() { } -void DriveFeedProcessor::ApplyFeeds( +void ChangeListProcessor::ApplyFeeds( const ScopedVector<google_apis::ResourceList>& feed_list, bool is_delta_feed, int64 root_feed_changestamp, @@ -76,7 +77,7 @@ void DriveFeedProcessor::ApplyFeeds( DCHECK(!on_complete_callback.is_null()); int64 delta_feed_changestamp = 0; - FeedToEntryProtoMapUMAStats uma_stats; + ChangeListToEntryProtoMapUMAStats uma_stats; FeedToEntryProtoMap(feed_list, &delta_feed_changestamp, &uma_stats); // Note FeedToEntryProtoMap calls Clear() which resets on_complete_callback_. on_complete_callback_ = on_complete_callback; @@ -89,13 +90,13 @@ void DriveFeedProcessor::ApplyFeeds( uma_stats.UpdateFileCountUmaHistograms(); } -void DriveFeedProcessor::ApplyEntryProtoMap(bool is_delta_feed) { +void ChangeListProcessor::ApplyEntryProtoMap(bool is_delta_feed) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (!is_delta_feed) { // Full update. changed_dirs_.insert(base::FilePath(kDriveRootDirectory)); resource_metadata_->RemoveAll( - base::Bind(&DriveFeedProcessor::ApplyNextEntryProtoAsync, + base::Bind(&ChangeListProcessor::ApplyNextEntryProtoAsync, weak_ptr_factory_.GetWeakPtr())); } else { // Go through all entries generated by the feed and apply them to the local @@ -104,16 +105,16 @@ void DriveFeedProcessor::ApplyEntryProtoMap(bool is_delta_feed) { } } -void DriveFeedProcessor::ApplyNextEntryProtoAsync() { +void ChangeListProcessor::ApplyNextEntryProtoAsync() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(&DriveFeedProcessor::ApplyNextEntryProto, + base::Bind(&ChangeListProcessor::ApplyNextEntryProto, weak_ptr_factory_.GetWeakPtr())); } -void DriveFeedProcessor::ApplyNextEntryProto() { +void ChangeListProcessor::ApplyNextEntryProto() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (!entry_proto_map_.empty()) @@ -124,7 +125,7 @@ void DriveFeedProcessor::ApplyNextEntryProto() { OnComplete(); // Finished. } -void DriveFeedProcessor::ApplyNextByIterator(DriveEntryProtoMap::iterator it) { +void ChangeListProcessor::ApplyNextByIterator(DriveEntryProtoMap::iterator it) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DriveEntryProto entry_proto = it->second; @@ -138,7 +139,7 @@ void DriveFeedProcessor::ApplyNextByIterator(DriveEntryProtoMap::iterator it) { if (parent_it != entry_proto_map_.end()) { base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(&DriveFeedProcessor::ApplyNextByIterator, + base::Bind(&ChangeListProcessor::ApplyNextByIterator, weak_ptr_factory_.GetWeakPtr(), parent_it)); } else { @@ -148,18 +149,18 @@ void DriveFeedProcessor::ApplyNextByIterator(DriveEntryProtoMap::iterator it) { } } -void DriveFeedProcessor::ApplyEntryProto(const DriveEntryProto& entry_proto) { +void ChangeListProcessor::ApplyEntryProto(const DriveEntryProto& entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // Lookup the entry. resource_metadata_->GetEntryInfoByResourceId( entry_proto.resource_id(), - base::Bind(&DriveFeedProcessor::ContinueApplyEntryProto, + base::Bind(&ChangeListProcessor::ContinueApplyEntryProto, weak_ptr_factory_.GetWeakPtr(), entry_proto)); } -void DriveFeedProcessor::ContinueApplyEntryProto( +void ChangeListProcessor::ContinueApplyEntryProto( const DriveEntryProto& entry_proto, DriveFileError error, const base::FilePath& file_path, @@ -183,17 +184,17 @@ void DriveFeedProcessor::ContinueApplyEntryProto( } } -void DriveFeedProcessor::AddEntryToParent(const DriveEntryProto& entry_proto) { +void ChangeListProcessor::AddEntryToParent(const DriveEntryProto& entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); resource_metadata_->AddEntryToParent( entry_proto, - base::Bind(&DriveFeedProcessor::NotifyForAddEntryToParent, + base::Bind(&ChangeListProcessor::NotifyForAddEntryToParent, weak_ptr_factory_.GetWeakPtr(), entry_proto.file_info().is_directory())); } -void DriveFeedProcessor::NotifyForAddEntryToParent( +void ChangeListProcessor::NotifyForAddEntryToParent( bool is_directory, DriveFileError error, const base::FilePath& file_path) { @@ -212,7 +213,7 @@ void DriveFeedProcessor::NotifyForAddEntryToParent( ApplyNextEntryProtoAsync(); } -void DriveFeedProcessor::RemoveEntryFromParent( +void ChangeListProcessor::RemoveEntryFromParent( const DriveEntryProto& entry_proto, const base::FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -225,14 +226,14 @@ void DriveFeedProcessor::RemoveEntryFromParent( // If entry is a directory, notify its children. resource_metadata_->GetChildDirectories( entry_proto.resource_id(), - base::Bind(&DriveFeedProcessor::OnGetChildrenForRemove, + base::Bind(&ChangeListProcessor::OnGetChildrenForRemove, weak_ptr_factory_.GetWeakPtr(), entry_proto, file_path)); } } -void DriveFeedProcessor::OnGetChildrenForRemove( +void ChangeListProcessor::OnGetChildrenForRemove( const DriveEntryProto& entry_proto, const base::FilePath& file_path, const std::set<base::FilePath>& child_directories) { @@ -241,14 +242,14 @@ void DriveFeedProcessor::OnGetChildrenForRemove( resource_metadata_->RemoveEntryFromParent( entry_proto.resource_id(), - base::Bind(&DriveFeedProcessor::NotifyForRemoveEntryFromParent, + base::Bind(&ChangeListProcessor::NotifyForRemoveEntryFromParent, weak_ptr_factory_.GetWeakPtr(), entry_proto.file_info().is_directory(), file_path, child_directories)); } -void DriveFeedProcessor::NotifyForRemoveEntryFromParent( +void ChangeListProcessor::NotifyForRemoveEntryFromParent( bool is_directory, const base::FilePath& file_path, const std::set<base::FilePath>& child_directories, @@ -274,18 +275,18 @@ void DriveFeedProcessor::NotifyForRemoveEntryFromParent( ApplyNextEntryProtoAsync(); } -void DriveFeedProcessor::RefreshEntry(const DriveEntryProto& entry_proto, +void ChangeListProcessor::RefreshEntry(const DriveEntryProto& entry_proto, const base::FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); resource_metadata_->RefreshEntry( entry_proto, - base::Bind(&DriveFeedProcessor::NotifyForRefreshEntry, + base::Bind(&ChangeListProcessor::NotifyForRefreshEntry, weak_ptr_factory_.GetWeakPtr(), file_path)); } -void DriveFeedProcessor::NotifyForRefreshEntry( +void ChangeListProcessor::NotifyForRefreshEntry( const base::FilePath& old_file_path, DriveFileError error, const base::FilePath& file_path, @@ -312,10 +313,10 @@ void DriveFeedProcessor::NotifyForRefreshEntry( ApplyNextEntryProtoAsync(); } -void DriveFeedProcessor::FeedToEntryProtoMap( +void ChangeListProcessor::FeedToEntryProtoMap( const ScopedVector<google_apis::ResourceList>& feed_list, int64* feed_changestamp, - FeedToEntryProtoMapUMAStats* uma_stats) { + ChangeListToEntryProtoMapUMAStats* uma_stats) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); Clear(); @@ -357,17 +358,17 @@ void DriveFeedProcessor::FeedToEntryProtoMap( } } -void DriveFeedProcessor::UpdateRootUploadUrl() { +void ChangeListProcessor::UpdateRootUploadUrl() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(root_upload_url_.is_valid()); resource_metadata_->GetEntryInfoByPath( base::FilePath(kDriveRootDirectory), - base::Bind(&DriveFeedProcessor::OnGetRootEntryProto, + base::Bind(&ChangeListProcessor::OnGetRootEntryProto, weak_ptr_factory_.GetWeakPtr())); } -void DriveFeedProcessor::OnGetRootEntryProto( +void ChangeListProcessor::OnGetRootEntryProto( DriveFileError error, scoped_ptr<DriveEntryProto> root_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -382,11 +383,11 @@ void DriveFeedProcessor::OnGetRootEntryProto( root_proto->set_upload_url(root_upload_url_.spec()); resource_metadata_->RefreshEntry( *root_proto, - base::Bind(&DriveFeedProcessor::OnUpdateRootUploadUrl, + base::Bind(&ChangeListProcessor::OnUpdateRootUploadUrl, weak_ptr_factory_.GetWeakPtr())); } -void DriveFeedProcessor::OnUpdateRootUploadUrl( +void ChangeListProcessor::OnUpdateRootUploadUrl( DriveFileError error, const base::FilePath& /* root_path */, scoped_ptr<DriveEntryProto> /* root_proto */) { @@ -396,7 +397,7 @@ void DriveFeedProcessor::OnUpdateRootUploadUrl( OnComplete(); } -void DriveFeedProcessor::OnComplete() { +void ChangeListProcessor::OnComplete() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); resource_metadata_->set_loaded(true); @@ -405,7 +406,7 @@ void DriveFeedProcessor::OnComplete() { base::Bind(&RunOnCompleteCallback, on_complete_callback_)); } -void DriveFeedProcessor::Clear() { +void ChangeListProcessor::Clear() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); entry_proto_map_.clear(); diff --git a/chrome/browser/chromeos/drive/drive_feed_processor.h b/chrome/browser/chromeos/drive/change_list_processor.h index e4de483..656ddba 100644 --- a/chrome/browser/chromeos/drive/drive_feed_processor.h +++ b/chrome/browser/chromeos/drive/change_list_processor.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FEED_PROCESSOR_H_ -#define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FEED_PROCESSOR_H_ +#ifndef CHROME_BROWSER_CHROMEOS_DRIVE_CHANGE_LIST_PROCESSOR_H_ +#define CHROME_BROWSER_CHROMEOS_DRIVE_CHANGE_LIST_PROCESSOR_H_ #include <map> #include <set> @@ -26,18 +26,18 @@ namespace drive { class DriveEntryProto; class DriveResourceMetadata; -// DriveFeedProcessor is used to process feeds from WAPI (codename for +// ChangeListProcessor is used to process feeds from WAPI (codename for // Documents List API). -class DriveFeedProcessor { +class ChangeListProcessor { public: typedef std::map<std::string /* resource_id */, DriveEntryProto> DriveEntryProtoMap; // Class used to record UMA stats with FeedToEntryProtoMap(). - class FeedToEntryProtoMapUMAStats; + class ChangeListToEntryProtoMapUMAStats; - explicit DriveFeedProcessor(DriveResourceMetadata* resource_metadata); - ~DriveFeedProcessor(); + explicit ChangeListProcessor(DriveResourceMetadata* resource_metadata); + ~ChangeListProcessor(); // Applies the documents feeds to the file system using |resource_metadata_|. // @@ -46,7 +46,7 @@ class DriveFeedProcessor { // // In the case of processing the root feeds |root_feed_changestamp| is used // as its initial changestamp value. The value comes from - // google_apis::AccountMetadataFeed. + // google_apis::AccountMetadata. // |on_complete_callback| is run after the feed is applied. // |on_complete_callback| must not be null. // TODO(achuith): Change the type of on_complete_callback to @@ -63,7 +63,7 @@ class DriveFeedProcessor { void FeedToEntryProtoMap( const ScopedVector<google_apis::ResourceList>& feed_list, int64* feed_changestamp, - FeedToEntryProtoMapUMAStats* uma_stats); + ChangeListToEntryProtoMapUMAStats* uma_stats); // A map of DriveEntryProto's representing a feed. const DriveEntryProtoMap& entry_proto_map() const { return entry_proto_map_; } @@ -166,10 +166,10 @@ class DriveFeedProcessor { // Note: This should remain the last member so it'll be destroyed and // invalidate its weak pointers before any other members are destroyed. - base::WeakPtrFactory<DriveFeedProcessor> weak_ptr_factory_; - DISALLOW_COPY_AND_ASSIGN(DriveFeedProcessor); + base::WeakPtrFactory<ChangeListProcessor> weak_ptr_factory_; + DISALLOW_COPY_AND_ASSIGN(ChangeListProcessor); }; } // namespace drive -#endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FEED_PROCESSOR_H_ +#endif // CHROME_BROWSER_CHROMEOS_DRIVE_CHANGE_LIST_PROCESSOR_H_ diff --git a/chrome/browser/chromeos/drive/drive_file_system.cc b/chrome/browser/chromeos/drive/drive_file_system.cc index c731d7e..ac1b54b 100644 --- a/chrome/browser/chromeos/drive/drive_file_system.cc +++ b/chrome/browser/chromeos/drive/drive_file_system.cc @@ -15,10 +15,10 @@ #include "base/stringprintf.h" #include "base/threading/sequenced_worker_pool.h" #include "base/values.h" +#include "chrome/browser/chromeos/drive/change_list_loader.h" +#include "chrome/browser/chromeos/drive/change_list_processor.h" #include "chrome/browser/chromeos/drive/drive.pb.h" #include "chrome/browser/chromeos/drive/drive_cache.h" -#include "chrome/browser/chromeos/drive/drive_feed_loader.h" -#include "chrome/browser/chromeos/drive/drive_feed_processor.h" #include "chrome/browser/chromeos/drive/drive_file_system_observer.h" #include "chrome/browser/chromeos/drive/drive_file_system_util.h" #include "chrome/browser/chromeos/drive/drive_scheduler.h" @@ -266,7 +266,7 @@ DriveFileSystem::DriveFileSystem( void DriveFileSystem::Reload() { ResetResourceMetadata(); - feed_loader_->ReloadFromServerIfNeeded( + change_list_loader_->ReloadFromServerIfNeeded( base::Bind(&DriveFileSystem::NotifyInitialLoadFinishedAndRun, weak_ptr_factory_.GetWeakPtr(), base::Bind(&DriveFileSystem::OnUpdateChecked, @@ -289,12 +289,12 @@ void DriveFileSystem::Initialize() { void DriveFileSystem::ResetResourceMetadata() { resource_metadata_.reset( new DriveResourceMetadata(drive_service_->GetRootResourceId())); - feed_loader_.reset(new DriveFeedLoader(resource_metadata_.get(), + change_list_loader_.reset(new ChangeListLoader(resource_metadata_.get(), scheduler_.get(), webapps_registry_, cache_, blocking_task_runner_)); - feed_loader_->AddObserver(this); + change_list_loader_->AddObserver(this); // Allocate the drive operation handlers. drive_operations_.Init(scheduler_.get(), @@ -310,8 +310,8 @@ void DriveFileSystem::CheckForUpdates() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DVLOG(1) << "CheckForUpdates"; - if (resource_metadata_->loaded() && !feed_loader_->refreshing()) { - feed_loader_->ReloadFromServerIfNeeded( + if (resource_metadata_->loaded() && !change_list_loader_->refreshing()) { + change_list_loader_->ReloadFromServerIfNeeded( base::Bind(&DriveFileSystem::OnUpdateChecked, weak_ptr_factory_.GetWeakPtr())); } @@ -328,7 +328,7 @@ DriveFileSystem::~DriveFileSystem() { // This should be called from UI thread, from DriveSystemService shutdown. DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - feed_loader_->RemoveObserver(this); + change_list_loader_->RemoveObserver(this); // Cancel all the in-flight operations. // This asynchronously cancels the URL fetch operations. @@ -436,7 +436,7 @@ void DriveFileSystem::LoadFeedIfNeeded(const FileOperationCallback& callback) { return; } - if (feed_loader_->refreshing()) { + if (change_list_loader_->refreshing()) { // If root feed is not loaded but the initialization process has // already started, add an observer to execute the remaining task after // the end of the initialization. @@ -446,9 +446,10 @@ void DriveFileSystem::LoadFeedIfNeeded(const FileOperationCallback& callback) { } // Load root feed from the disk cache. - feed_loader_->LoadFromCache(base::Bind(&DriveFileSystem::OnFeedCacheLoaded, - weak_ptr_factory_.GetWeakPtr(), - callback)); + change_list_loader_->LoadFromCache( + base::Bind(&DriveFileSystem::OnFeedCacheLoaded, + weak_ptr_factory_.GetWeakPtr(), + callback)); } void DriveFileSystem::TransferFileFromRemoteToLocal( @@ -965,7 +966,7 @@ void DriveFileSystem::RequestDirectoryRefreshAfterGetEntryInfo( return; } - feed_loader_->LoadDirectoryFromServer( + change_list_loader_->LoadDirectoryFromServer( entry_proto->resource_id(), base::Bind(&DriveFileSystem::OnRequestDirectoryRefresh, weak_ptr_factory_.GetWeakPtr(), @@ -986,11 +987,11 @@ void DriveFileSystem::OnRequestDirectoryRefresh( return; } - DriveFeedProcessor feed_processor(resource_metadata_.get()); - feed_processor.FeedToEntryProtoMap(feed_list, NULL, NULL); + ChangeListProcessor change_list_processor(resource_metadata_.get()); + change_list_processor.FeedToEntryProtoMap(feed_list, NULL, NULL); resource_metadata_->RefreshDirectory( directory_resource_id, - feed_processor.entry_proto_map(), + change_list_processor.entry_proto_map(), base::Bind(&DriveFileSystem::OnDirectoryChangeFileMoveCallback, weak_ptr_factory_.GetWeakPtr())); } @@ -1019,7 +1020,7 @@ void DriveFileSystem::GetAvailableSpace( void DriveFileSystem::OnGetAccountMetadata( const GetAvailableSpaceCallback& callback, google_apis::GDataErrorCode status, - scoped_ptr<google_apis::AccountMetadataFeed> account_metadata) { + scoped_ptr<google_apis::AccountMetadata> account_metadata) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -1137,7 +1138,7 @@ void DriveFileSystem::Search(const std::string& search_query, DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); - feed_loader_->SearchFromServer( + change_list_loader_->SearchFromServer( search_query, shared_with_me, next_feed, @@ -1177,7 +1178,7 @@ void DriveFileSystem::LoadRootFeedFromCacheForTesting( const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - feed_loader_->LoadFromCache(callback); + change_list_loader_->LoadFromCache(callback); } void DriveFileSystem::OnFileDownloaded( @@ -1299,7 +1300,7 @@ void DriveFileSystem::OnFeedCacheLoaded(const FileOperationCallback& callback, if (error != DRIVE_FILE_OK) { // If cache cannot be loaded, try to load from server directly. - feed_loader_->ReloadFromServerIfNeeded( + change_list_loader_->ReloadFromServerIfNeeded( base::Bind(&DriveFileSystem::NotifyInitialLoadFinishedAndRun, weak_ptr_factory_.GetWeakPtr(), callback)); @@ -1380,7 +1381,7 @@ void DriveFileSystem::GetMetadata( DriveFileSystemMetadata metadata; metadata.loaded = resource_metadata_->loaded(); - metadata.refreshing = feed_loader_->refreshing(); + metadata.refreshing = change_list_loader_->refreshing(); // Metadata related to delta update. metadata.push_notification_enabled = push_notification_enabled_; diff --git a/chrome/browser/chromeos/drive/drive_file_system.h b/chrome/browser/chromeos/drive/drive_file_system.h index e9748a5..eebf980 100644 --- a/chrome/browser/chromeos/drive/drive_file_system.h +++ b/chrome/browser/chromeos/drive/drive_file_system.h @@ -12,7 +12,7 @@ #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "base/timer.h" -#include "chrome/browser/chromeos/drive/drive_feed_loader_observer.h" +#include "chrome/browser/chromeos/drive/change_list_loader_observer.h" #include "chrome/browser/chromeos/drive/drive_file_system_interface.h" #include "chrome/browser/chromeos/drive/file_system/drive_operations.h" #include "chrome/browser/chromeos/drive/file_system/operation_observer.h" @@ -28,7 +28,7 @@ class SequencedTaskRunner; namespace google_apis { class ResourceEntry; -class AccountMetadataFeed; +class AccountMetadata; class ResourceList; class DriveServiceInterface; class DriveUploaderInterface; @@ -42,7 +42,7 @@ class DriveFunctionRemove; class DriveResourceMetadata; class DriveScheduler; class DriveWebAppsRegistry; -class DriveFeedLoader; +class ChangeListLoader; namespace file_system { class CopyOperation; @@ -52,7 +52,7 @@ class RemoveOperation; // The production implementation of DriveFileSystemInterface. class DriveFileSystem : public DriveFileSystemInterface, - public DriveFeedLoaderObserver, + public ChangeListLoaderObserver, public file_system::OperationObserver { public: DriveFileSystem(Profile* profile, @@ -142,8 +142,8 @@ class DriveFileSystem : public DriveFileSystemInterface, virtual void OnDirectoryChangedByOperation( const base::FilePath& directory_path) OVERRIDE; - // DriveFeedLoader::Observer overrides. - // Used to propagate events from DriveFeedLoader. + // ChangeListLoader::Observer overrides. + // Used to propagate events from ChangeListLoader. virtual void OnDirectoryChanged(const base::FilePath& directory_path) OVERRIDE; virtual void OnResourceListFetched(int num_accumulated_entries) OVERRIDE; virtual void OnFeedFromServerLoaded() OVERRIDE; @@ -152,8 +152,8 @@ class DriveFileSystem : public DriveFileSystemInterface, void LoadRootFeedFromCacheForTesting(const FileOperationCallback& callback); // Used in tests to update the file system from |feed_list|. - // See also the comment at DriveFeedLoader::UpdateFromFeed(). - DriveFeedLoader* feed_loader() { return feed_loader_.get(); } + // See also the comment at ChangeListLoader::UpdateFromFeed(). + ChangeListLoader* change_list_loader() { return change_list_loader_.get(); } private: friend class DriveFileSystemTest; @@ -169,17 +169,17 @@ class DriveFileSystem : public DriveFileSystemInterface, // Struct used for AddUploadedFile. struct AddUploadedFileParams; - // Initializes DriveResourceMetadata and related instances (DriveFeedLoader + // Initializes DriveResourceMetadata and related instances (ChangeListLoader // and DriveOperations). This is a part of the initialization. void ResetResourceMetadata(); // Called on preference change. void OnDisableDriveHostedFilesChanged(); - // Callback passed to DriveFeedLoader from |Search| method. + // Callback passed to ChangeListLoader from |Search| method. // |callback| is that should be run with data received. It must not be null. // |feed_list| is the document feed for content search. - // |error| is the error code returned by DriveFeedLoader. + // |error| is the error code returned by ChangeListLoader. void OnSearch(bool shared_with_me, const SearchCallback& callback, const ScopedVector<google_apis::ResourceList>& feed_list, @@ -275,7 +275,7 @@ class DriveFileSystem : public DriveFileSystemInterface, void OnGetAccountMetadata( const GetAvailableSpaceCallback& callback, google_apis::GDataErrorCode status, - scoped_ptr<google_apis::AccountMetadataFeed> account_metadata); + scoped_ptr<google_apis::AccountMetadata> account_metadata); // Callback for handling file downloading requests. void OnFileDownloaded(const GetFileFromCacheParams& params, @@ -490,8 +490,8 @@ class DriveFileSystem : public DriveFileSystemInterface, scoped_ptr<PrefChangeRegistrar> pref_registrar_; - // The loader is used to load the feeds. - scoped_ptr<DriveFeedLoader> feed_loader_; + // The loader is used to load the change lists. + scoped_ptr<ChangeListLoader> change_list_loader_; ObserverList<DriveFileSystemObserver> observers_; diff --git a/chrome/browser/chromeos/drive/drive_file_system_unittest.cc b/chrome/browser/chromeos/drive/drive_file_system_unittest.cc index ddd62af..e59f5a5 100644 --- a/chrome/browser/chromeos/drive/drive_file_system_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_file_system_unittest.cc @@ -265,7 +265,7 @@ class DriveFileSystemTest : public testing::Test { bool LoadFeed(const std::string& filename, bool is_delta_feed) { if (!test_util::LoadChangeFeed(filename, - file_system_->feed_loader(), + file_system_->change_list_loader(), is_delta_feed, root_feed_changestamp_)) { return false; @@ -2090,7 +2090,7 @@ TEST_F(DriveFileSystemTest, OpenAndCloseFile) { } // TODO(satorux): Testing if WebAppsRegistry is loaded here is awkward. We -// should move this to drive_feed_loader_unittest.cc. crbug.com/161703 +// should move this to change_list_loader_unittest.cc. crbug.com/161703 TEST_F(DriveFileSystemTest, WebAppsRegistryIsLoaded) { SaveTestFileSystem(USE_SERVER_TIMESTAMP); diff --git a/chrome/browser/chromeos/drive/drive_files.h b/chrome/browser/chromeos/drive/drive_files.h index 9c3b750..e8da178 100644 --- a/chrome/browser/chromeos/drive/drive_files.h +++ b/chrome/browser/chromeos/drive/drive_files.h @@ -207,7 +207,7 @@ class DriveDirectory : public DriveEntry { // TODO(satorux): Remove the friend statements. crbug.com/139649 friend class DriveResourceMetadata; friend class DriveResourceMetadataTest; - friend class DriveFeedProcessor; + friend class ChangeListProcessor; explicit DriveDirectory(DriveResourceMetadata* resource_metadata); virtual DriveDirectory* AsDriveDirectory() OVERRIDE; diff --git a/chrome/browser/chromeos/drive/drive_scheduler.cc b/chrome/browser/chromeos/drive/drive_scheduler.cc index 49f3f9f..31441a2 100644 --- a/chrome/browser/chromeos/drive/drive_scheduler.cc +++ b/chrome/browser/chromeos/drive/drive_scheduler.cc @@ -619,7 +619,7 @@ void DriveScheduler::OnGetResourceEntryJobDone( void DriveScheduler::OnGetAccountMetadataJobDone( scoped_ptr<QueueEntry> queue_entry, google_apis::GDataErrorCode error, - scoped_ptr<google_apis::AccountMetadataFeed> account_metadata) { + scoped_ptr<google_apis::AccountMetadata> account_metadata) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DriveFileError drive_error(util::GDataToDriveFileError(error)); diff --git a/chrome/browser/chromeos/drive/drive_scheduler.h b/chrome/browser/chromeos/drive/drive_scheduler.h index 0a49da1..05c5ce8 100644 --- a/chrome/browser/chromeos/drive/drive_scheduler.h +++ b/chrome/browser/chromeos/drive/drive_scheduler.h @@ -319,7 +319,7 @@ class DriveScheduler void OnGetAccountMetadataJobDone( scoped_ptr<QueueEntry> queue_entry, google_apis::GDataErrorCode error, - scoped_ptr<google_apis::AccountMetadataFeed> account_metadata); + scoped_ptr<google_apis::AccountMetadata> account_metadata); // Callback for job finishing with a GetAppListCallback. void OnGetAppListJobDone( diff --git a/chrome/browser/chromeos/drive/drive_scheduler_unittest.cc b/chrome/browser/chromeos/drive/drive_scheduler_unittest.cc index 9a03d02..553b579 100644 --- a/chrome/browser/chromeos/drive/drive_scheduler_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_scheduler_unittest.cc @@ -169,7 +169,7 @@ TEST_F(DriveSchedulerTest, GetAccountMetadata) { ConnectToWifi(); google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; - scoped_ptr<google_apis::AccountMetadataFeed> account_metadata; + scoped_ptr<google_apis::AccountMetadata> account_metadata; scheduler_->GetAccountMetadata( base::Bind( @@ -418,7 +418,7 @@ TEST_F(DriveSchedulerTest, DownloadFileCellularDisabled) { google_apis::GetContentCallback()); // Metadata should still work google_apis::GDataErrorCode metadata_error = google_apis::GDATA_OTHER_ERROR; - scoped_ptr<google_apis::AccountMetadataFeed> account_metadata; + scoped_ptr<google_apis::AccountMetadata> account_metadata; // Try to get the metadata scheduler_->GetAccountMetadata( @@ -476,7 +476,7 @@ TEST_F(DriveSchedulerTest, DownloadFileWimaxDisabled) { google_apis::GetContentCallback()); // Metadata should still work google_apis::GDataErrorCode metadata_error = google_apis::GDATA_OTHER_ERROR; - scoped_ptr<google_apis::AccountMetadataFeed> account_metadata; + scoped_ptr<google_apis::AccountMetadata> account_metadata; // Try to get the metadata scheduler_->GetAccountMetadata( @@ -534,7 +534,7 @@ TEST_F(DriveSchedulerTest, DownloadFileCellularEnabled) { google_apis::GetContentCallback()); // Metadata should still work google_apis::GDataErrorCode metadata_error = google_apis::GDATA_OTHER_ERROR; - scoped_ptr<google_apis::AccountMetadataFeed> account_metadata; + scoped_ptr<google_apis::AccountMetadata> account_metadata; // Try to get the metadata scheduler_->GetAccountMetadata( @@ -584,7 +584,7 @@ TEST_F(DriveSchedulerTest, DownloadFileWimaxEnabled) { google_apis::GetContentCallback()); // Metadata should still work google_apis::GDataErrorCode metadata_error = google_apis::GDATA_OTHER_ERROR; - scoped_ptr<google_apis::AccountMetadataFeed> account_metadata; + scoped_ptr<google_apis::AccountMetadata> account_metadata; // Try to get the metadata scheduler_->GetAccountMetadata( diff --git a/chrome/browser/chromeos/drive/drive_test_util.cc b/chrome/browser/chromeos/drive/drive_test_util.cc index 24b0cac..8151cfd 100644 --- a/chrome/browser/chromeos/drive/drive_test_util.cc +++ b/chrome/browser/chromeos/drive/drive_test_util.cc @@ -10,8 +10,8 @@ #include "base/bind_helpers.h" #include "base/json/json_file_value_serializer.h" #include "base/message_loop.h" +#include "chrome/browser/chromeos/drive/change_list_loader.h" #include "chrome/browser/chromeos/drive/drive.pb.h" -#include "chrome/browser/chromeos/drive/drive_feed_loader.h" #include "chrome/browser/google_apis/drive_api_parser.h" namespace drive { @@ -199,7 +199,7 @@ void CopyResultsFromCloseFileCallbackAndQuit(DriveFileError* out_error, } bool LoadChangeFeed(const std::string& relative_path, - DriveFeedLoader* feed_loader, + ChangeListLoader* change_list_loader, bool is_delta_feed, int64 root_feed_changestamp) { scoped_ptr<Value> document = @@ -217,12 +217,12 @@ bool LoadChangeFeed(const std::string& relative_path, ScopedVector<google_apis::ResourceList> feed_list; feed_list.push_back(document_feed.release()); - feed_loader->UpdateFromFeed( + change_list_loader->UpdateFromFeed( feed_list, is_delta_feed, root_feed_changestamp, base::Bind(&base::DoNothing)); - // DriveFeedLoader::UpdateFromFeed is asynchronous, so wait for it to finish. + // ChangeListLoader::UpdateFromFeed is asynchronous, so wait for it to finish. google_apis::test_util::RunBlockingPoolTask(); return true; diff --git a/chrome/browser/chromeos/drive/drive_test_util.h b/chrome/browser/chromeos/drive/drive_test_util.h index ddbb12c..c043ed7 100644 --- a/chrome/browser/chromeos/drive/drive_test_util.h +++ b/chrome/browser/chromeos/drive/drive_test_util.h @@ -20,7 +20,7 @@ namespace drive { class DriveCacheEntry; class DriveEntryProto; -class DriveFeedLoader; +class ChangeListLoader; typedef std::vector<DriveEntryProto> DriveEntryProtoVector; @@ -164,7 +164,7 @@ void CopyResultsFromCloseFileCallbackAndQuit(DriveFileError* out_error, // Loads a test json file as root ("/drive") element from a test file stored // under chrome/test/data/chromeos. Returns true on success. bool LoadChangeFeed(const std::string& relative_path, - DriveFeedLoader* feed_loader, + ChangeListLoader* change_list_loader, bool is_delta_feed, int64 root_feed_changestamp); diff --git a/chrome/browser/chromeos/drive/drive_webapps_registry.cc b/chrome/browser/chromeos/drive/drive_webapps_registry.cc index 0737eff..0edbd8d 100644 --- a/chrome/browser/chromeos/drive/drive_webapps_registry.cc +++ b/chrome/browser/chromeos/drive/drive_webapps_registry.cc @@ -146,7 +146,7 @@ std::set<std::string> DriveWebAppsRegistry::GetExtensionsForWebStoreApp( } void DriveWebAppsRegistry::UpdateFromFeed( - const google_apis::AccountMetadataFeed& metadata) { + const google_apis::AccountMetadata& metadata) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); url_to_name_map_.clear(); diff --git a/chrome/browser/chromeos/drive/drive_webapps_registry.h b/chrome/browser/chromeos/drive/drive_webapps_registry.h index 60d3733..c009f9c 100644 --- a/chrome/browser/chromeos/drive/drive_webapps_registry.h +++ b/chrome/browser/chromeos/drive/drive_webapps_registry.h @@ -65,7 +65,7 @@ class DriveWebAppsRegistry { virtual std::set<std::string> GetExtensionsForWebStoreApp( const std::string& web_store_id); virtual void UpdateFromFeed( - const google_apis::AccountMetadataFeed& metadata); + const google_apis::AccountMetadata& metadata); virtual void UpdateFromAppList(const google_apis::AppList& applist); private: diff --git a/chrome/browser/chromeos/drive/drive_webapps_registry_unittest.cc b/chrome/browser/chromeos/drive/drive_webapps_registry_unittest.cc index ae6547b..4461814 100644 --- a/chrome/browser/chromeos/drive/drive_webapps_registry_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_webapps_registry_unittest.cc @@ -84,11 +84,11 @@ TEST_F(DriveWebAppsRegistryTest, LoadAndFindWebApps) { ASSERT_TRUE(entry_value); // Load feed. - scoped_ptr<google_apis::AccountMetadataFeed> feed( - google_apis::AccountMetadataFeed::CreateFrom(*document)); - ASSERT_TRUE(feed.get()); + scoped_ptr<google_apis::AccountMetadata> metadata( + google_apis::AccountMetadata::CreateFrom(*document)); + ASSERT_TRUE(metadata.get()); scoped_ptr<DriveWebAppsRegistry> web_apps(new DriveWebAppsRegistry); - web_apps->UpdateFromFeed(*feed.get()); + web_apps->UpdateFromFeed(*metadata.get()); // Find by extension 'ext_1'. ScopedVector<DriveWebAppInfo> ext_1_results; diff --git a/chrome/browser/chromeos/drive/file_system/create_directory_operation_unittest.cc b/chrome/browser/chromeos/drive/file_system/create_directory_operation_unittest.cc index 2780e12..0adf973 100644 --- a/chrome/browser/chromeos/drive/file_system/create_directory_operation_unittest.cc +++ b/chrome/browser/chromeos/drive/file_system/create_directory_operation_unittest.cc @@ -6,8 +6,8 @@ #include "base/message_loop.h" #include "base/threading/sequenced_worker_pool.h" +#include "chrome/browser/chromeos/drive/change_list_loader.h" #include "chrome/browser/chromeos/drive/drive_cache.h" -#include "chrome/browser/chromeos/drive/drive_feed_loader.h" #include "chrome/browser/chromeos/drive/drive_resource_metadata.h" #include "chrome/browser/chromeos/drive/drive_scheduler.h" #include "chrome/browser/chromeos/drive/drive_test_util.h" @@ -59,12 +59,12 @@ class CreateDirectoryOperationTest blocking_task_runner_, fake_free_disk_space_getter_.get()); - drive_feed_loader_.reset(new DriveFeedLoader( + change_list_loader_.reset(new ChangeListLoader( metadata_.get(), scheduler_.get(), drive_web_apps_registry_.get(), cache_, blocking_task_runner_)); DriveFileError error = DRIVE_FILE_OK; - drive_feed_loader_->ReloadFromServerIfNeeded( + change_list_loader_->ReloadFromServerIfNeeded( base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error)); cache_->RequestInitializeForTesting(); @@ -76,7 +76,7 @@ class CreateDirectoryOperationTest virtual void TearDown() OVERRIDE { operation_.reset(); - drive_feed_loader_.reset(); + change_list_loader_.reset(); cache_->Destroy(); // The cache destruction requires to post a task to the blocking pool. @@ -109,7 +109,7 @@ class CreateDirectoryOperationTest bool LoadRootFeedDocument(const std::string& filename) { return test_util::LoadChangeFeed(filename, - drive_feed_loader_.get(), + change_list_loader_.get(), false, // is_delta_feed 0); } @@ -136,7 +136,7 @@ class CreateDirectoryOperationTest // The way to delete the DriveCache instance is a bit tricky, so here we use // a raw point. See TearDown method for how to delete it. DriveCache* cache_; - scoped_ptr<DriveFeedLoader> drive_feed_loader_; + scoped_ptr<ChangeListLoader> change_list_loader_; scoped_ptr<CreateDirectoryOperation> operation_; }; diff --git a/chrome/browser/chromeos/drive/search_metadata_unittest.cc b/chrome/browser/chromeos/drive/search_metadata_unittest.cc index 6204326..012f303 100644 --- a/chrome/browser/chromeos/drive/search_metadata_unittest.cc +++ b/chrome/browser/chromeos/drive/search_metadata_unittest.cc @@ -45,7 +45,7 @@ class SearchMetadataTest : public testing::Test { blocking_task_runner_)); file_system_->Initialize(); ASSERT_TRUE(test_util::LoadChangeFeed("gdata/root_feed.json", - file_system_->feed_loader(), + file_system_->change_list_loader(), false, 1)); } diff --git a/chrome/browser/google_apis/drive_api_service.cc b/chrome/browser/google_apis/drive_api_service.cc index 57e48f7..1e058e5 100644 --- a/chrome/browser/google_apis/drive_api_service.cc +++ b/chrome/browser/google_apis/drive_api_service.cc @@ -111,7 +111,7 @@ void ParseResourceEntryAndRun( callback.Run(error, entry.Pass()); } -// Parses the AboutResource value to AccountMetadataFeed and runs |callback| +// Parses the AboutResource value to AccountMetadata and runs |callback| // on the UI thread once parsing is done. void ParseAccountMetadataAndRun( const GetAccountMetadataCallback& callback, @@ -121,13 +121,13 @@ void ParseAccountMetadataAndRun( DCHECK(!callback.is_null()); if (!value) { - callback.Run(error, scoped_ptr<AccountMetadataFeed>()); + callback.Run(error, scoped_ptr<AccountMetadata>()); return; } - // TODO(satorux): Convert AboutResource to AccountMetadataFeed. + // TODO(satorux): Convert AboutResource to AccountMetadata. // For now just returning an error. crbug.com/165621 - callback.Run(GDATA_PARSE_ERROR, scoped_ptr<AccountMetadataFeed>()); + callback.Run(GDATA_PARSE_ERROR, scoped_ptr<AccountMetadata>()); } // Parses the JSON value to AppList runs |callback| on the UI thread diff --git a/chrome/browser/google_apis/drive_service_interface.h b/chrome/browser/google_apis/drive_service_interface.h index 3007586..0bad72e 100644 --- a/chrome/browser/google_apis/drive_service_interface.h +++ b/chrome/browser/google_apis/drive_service_interface.h @@ -21,7 +21,7 @@ class IOBuffer; namespace google_apis { class AboutResource; -class AccountMetadataFeed; +class AccountMetadata; class AppList; class OperationRegistry; class ResourceEntry; @@ -55,7 +55,7 @@ typedef base::Callback<void(GDataErrorCode error, // Callback used for GetAccountMetadata(). typedef base::Callback<void(GDataErrorCode error, - scoped_ptr<AccountMetadataFeed> account_metadata)> + scoped_ptr<AccountMetadata> account_metadata)> GetAccountMetadataCallback; // Callback used for GetAboutResource(). diff --git a/chrome/browser/google_apis/fake_drive_service.cc b/chrome/browser/google_apis/fake_drive_service.cc index c289147..129fc3e 100644 --- a/chrome/browser/google_apis/fake_drive_service.cc +++ b/chrome/browser/google_apis/fake_drive_service.cc @@ -107,8 +107,8 @@ bool FakeDriveService::LoadAccountMetadataForWapi( account_metadata_value_ = test_util::LoadJSONFile(relative_path); // Update the largest_changestamp_. - scoped_ptr<AccountMetadataFeed> account_metadata = - AccountMetadataFeed::CreateFrom(*account_metadata_value_); + scoped_ptr<AccountMetadata> account_metadata = + AccountMetadata::CreateFrom(*account_metadata_value_); largest_changestamp_ = account_metadata->largest_changestamp(); // Add the largest changestamp to the existing entries. @@ -351,7 +351,7 @@ void FakeDriveService::GetAccountMetadata( DCHECK(!callback.is_null()); if (offline_) { - scoped_ptr<AccountMetadataFeed> null; + scoped_ptr<AccountMetadata> null; MessageLoop::current()->PostTask( FROM_HERE, base::Bind(callback, @@ -361,8 +361,8 @@ void FakeDriveService::GetAccountMetadata( } ++account_metadata_load_count_; - scoped_ptr<AccountMetadataFeed> account_metadata = - AccountMetadataFeed::CreateFrom(*account_metadata_value_); + scoped_ptr<AccountMetadata> account_metadata = + AccountMetadata::CreateFrom(*account_metadata_value_); MessageLoop::current()->PostTask( FROM_HERE, base::Bind(callback, @@ -388,8 +388,8 @@ void FakeDriveService::GetAboutResource( } ++about_resource_load_count_; - scoped_ptr<AccountMetadataFeed> account_metadata = - AccountMetadataFeed::CreateFrom(*account_metadata_value_); + scoped_ptr<AccountMetadata> account_metadata = + AccountMetadata::CreateFrom(*account_metadata_value_); scoped_ptr<AboutResource> about_resource(new AboutResource); about_resource->set_largest_change_id( account_metadata->largest_changestamp()); diff --git a/chrome/browser/google_apis/fake_drive_service_unittest.cc b/chrome/browser/google_apis/fake_drive_service_unittest.cc index f0610ef..765ced5 100644 --- a/chrome/browser/google_apis/fake_drive_service_unittest.cc +++ b/chrome/browser/google_apis/fake_drive_service_unittest.cc @@ -374,7 +374,7 @@ TEST_F(FakeDriveServiceTest, GetAccountMetadata) { "gdata/account_metadata.json")); GDataErrorCode error = GDATA_OTHER_ERROR; - scoped_ptr<AccountMetadataFeed> account_metadata; + scoped_ptr<AccountMetadata> account_metadata; fake_service_.GetAccountMetadata( base::Bind(&test_util::CopyResultsFromGetAccountMetadataCallback, &error, @@ -395,7 +395,7 @@ TEST_F(FakeDriveServiceTest, GetAccountMetadata_Offline) { fake_service_.set_offline(true); GDataErrorCode error = GDATA_OTHER_ERROR; - scoped_ptr<AccountMetadataFeed> account_metadata; + scoped_ptr<AccountMetadata> account_metadata; fake_service_.GetAccountMetadata( base::Bind(&test_util::CopyResultsFromGetAccountMetadataCallback, &error, diff --git a/chrome/browser/google_apis/gdata_wapi_operations.cc b/chrome/browser/google_apis/gdata_wapi_operations.cc index ba73ded..15b1844 100644 --- a/chrome/browser/google_apis/gdata_wapi_operations.cc +++ b/chrome/browser/google_apis/gdata_wapi_operations.cc @@ -31,7 +31,7 @@ const char kFeedField[] = "feed"; // Templates for file uploading. const char kUploadResponseRange[] = "range"; -// Parses the JSON value to AccountMetadataFeed and runs |callback| on the UI +// Parses the JSON value to AccountMetadata and runs |callback| on the UI // thread once parsing is done. void ParseAccounetMetadataAndRun(const GetAccountMetadataCallback& callback, GDataErrorCode error, @@ -40,15 +40,15 @@ void ParseAccounetMetadataAndRun(const GetAccountMetadataCallback& callback, DCHECK(!callback.is_null()); if (!value) { - callback.Run(error, scoped_ptr<AccountMetadataFeed>()); + callback.Run(error, scoped_ptr<AccountMetadata>()); return; } - // Parsing AccountMetadataFeed is cheap enough to do on UI thread. - scoped_ptr<AccountMetadataFeed> entry = - google_apis::AccountMetadataFeed::CreateFrom(*value); + // Parsing AccountMetadata is cheap enough to do on UI thread. + scoped_ptr<AccountMetadata> entry = + google_apis::AccountMetadata::CreateFrom(*value); if (!entry) { - callback.Run(GDATA_PARSE_ERROR, scoped_ptr<AccountMetadataFeed>()); + callback.Run(GDATA_PARSE_ERROR, scoped_ptr<AccountMetadata>()); return; } diff --git a/chrome/browser/google_apis/gdata_wapi_operations_unittest.cc b/chrome/browser/google_apis/gdata_wapi_operations_unittest.cc index 29f528c..da654a2 100644 --- a/chrome/browser/google_apis/gdata_wapi_operations_unittest.cc +++ b/chrome/browser/google_apis/gdata_wapi_operations_unittest.cc @@ -477,7 +477,7 @@ TEST_F(GDataWapiOperationsTest, GetResourceEntryOperation_InvalidResourceId) { TEST_F(GDataWapiOperationsTest, GetAccountMetadataOperation) { GDataErrorCode result_code = GDATA_OTHER_ERROR; - scoped_ptr<AccountMetadataFeed> result_data; + scoped_ptr<AccountMetadata> result_data; GetAccountMetadataOperation* operation = new GetAccountMetadataOperation( &operation_registry_, @@ -494,8 +494,8 @@ TEST_F(GDataWapiOperationsTest, GetAccountMetadataOperation) { EXPECT_EQ("/feeds/metadata/default?v=3&alt=json&include-installed-apps=true", http_request_.relative_url); - scoped_ptr<AccountMetadataFeed> expected( - AccountMetadataFeed::CreateFrom( + scoped_ptr<AccountMetadata> expected( + AccountMetadata::CreateFrom( *test_util::LoadJSONFile("gdata/account_metadata.json"))); ASSERT_TRUE(result_data.get()); diff --git a/chrome/browser/google_apis/gdata_wapi_parser.cc b/chrome/browser/google_apis/gdata_wapi_parser.cc index fd034f7..add8cdb 100644 --- a/chrome/browser/google_apis/gdata_wapi_parser.cc +++ b/chrome/browser/google_apis/gdata_wapi_parser.cc @@ -210,15 +210,15 @@ const LinkTypeMap kLinkTypeMap[] = { "http://schemas.google.com/docs/2007#share"}, }; -struct FeedLinkTypeMap { - FeedLink::FeedLinkType type; +struct ResourceLinkTypeMap { + ResourceLink::ResourceLinkType type; const char* rel; }; -const FeedLinkTypeMap kFeedLinkTypeMap[] = { - { FeedLink::FEED_LINK_ACL, +const ResourceLinkTypeMap kFeedLinkTypeMap[] = { + { ResourceLink::FEED_LINK_ACL, "http://schemas.google.com/acl/2007#accessControlList" }, - { FeedLink::FEED_LINK_REVISIONS, + { ResourceLink::FEED_LINK_REVISIONS, "http://schemas.google.com/docs/2007/revisions" }, }; @@ -347,14 +347,14 @@ void Link::RegisterJSONConverter(base::JSONValueConverter<Link>* converter) { } //////////////////////////////////////////////////////////////////////////////// -// FeedLink implementation +// ResourceLink implementation -FeedLink::FeedLink() : type_(FeedLink::FEED_LINK_UNKNOWN) { +ResourceLink::ResourceLink() : type_(ResourceLink::FEED_LINK_UNKNOWN) { } // static. -bool FeedLink::GetFeedLinkType( - const base::StringPiece& rel, FeedLink::FeedLinkType* result) { +bool ResourceLink::GetFeedLinkType( + const base::StringPiece& rel, ResourceLink::ResourceLinkType* result) { for (size_t i = 0; i < arraysize(kFeedLinkTypeMap); i++) { if (rel == kFeedLinkTypeMap[i].rel) { *result = kFeedLinkTypeMap[i].type; @@ -366,12 +366,12 @@ bool FeedLink::GetFeedLinkType( } // static -void FeedLink::RegisterJSONConverter( - base::JSONValueConverter<FeedLink>* converter) { - converter->RegisterCustomField<FeedLink::FeedLinkType>( - kRelField, &FeedLink::type_, &FeedLink::GetFeedLinkType); +void ResourceLink::RegisterJSONConverter( + base::JSONValueConverter<ResourceLink>* converter) { + converter->RegisterCustomField<ResourceLink::ResourceLinkType>( + kRelField, &ResourceLink::type_, &ResourceLink::GetFeedLinkType); converter->RegisterCustomField( - kHrefField, &FeedLink::href_, &GetGURLFromString); + kHrefField, &ResourceLink::href_, &GetGURLFromString); } //////////////////////////////////////////////////////////////////////////////// @@ -402,7 +402,7 @@ void Category::RegisterJSONConverter( converter->RegisterStringField(kTermField, &Category::term_); } -const Link* FeedEntry::GetLinkByType(Link::LinkType type) const { +const Link* CommonMetadata::GetLinkByType(Link::LinkType type) const { for (size_t i = 0; i < links_.size(); ++i) { if (links_[i]->type() == type) return links_[i]; @@ -467,27 +467,27 @@ bool AppIcon::GetIconCategory(const base::StringPiece& category, } //////////////////////////////////////////////////////////////////////////////// -// FeedEntry implementation +// CommonMetadata implementation -FeedEntry::FeedEntry() { +CommonMetadata::CommonMetadata() { } -FeedEntry::~FeedEntry() { +CommonMetadata::~CommonMetadata() { } // static -template<typename FeedEntryDescendant> -void FeedEntry::RegisterJSONConverter( - base::JSONValueConverter<FeedEntryDescendant>* converter) { - converter->RegisterStringField(kETagField, &FeedEntry::etag_); +template<typename CommonMetadataDescendant> +void CommonMetadata::RegisterJSONConverter( + base::JSONValueConverter<CommonMetadataDescendant>* converter) { + converter->RegisterStringField(kETagField, &CommonMetadata::etag_); converter->template RegisterRepeatedMessage<Author>( - kAuthorField, &FeedEntry::authors_); + kAuthorField, &CommonMetadata::authors_); converter->template RegisterRepeatedMessage<Link>( - kLinkField, &FeedEntry::links_); + kLinkField, &CommonMetadata::links_); converter->template RegisterRepeatedMessage<Category>( - kCategoryField, &FeedEntry::categories_); + kCategoryField, &CommonMetadata::categories_); converter->template RegisterCustomField<base::Time>( - kUpdatedField, &FeedEntry::updated_time_, &util::GetTimeFromString); + kUpdatedField, &CommonMetadata::updated_time_, &util::GetTimeFromString); } //////////////////////////////////////////////////////////////////////////////// @@ -530,7 +530,7 @@ bool ResourceEntry::ParseChangestamp(const base::Value* value, void ResourceEntry::RegisterJSONConverter( base::JSONValueConverter<ResourceEntry>* converter) { // Inherit the parent registrations. - FeedEntry::RegisterJSONConverter(converter); + CommonMetadata::RegisterJSONConverter(converter); converter->RegisterStringField( kResourceIdField, &ResourceEntry::resource_id_); converter->RegisterStringField(kIDField, &ResourceEntry::id_); @@ -542,7 +542,7 @@ void ResourceEntry::RegisterJSONConverter( kLastViewedField, &ResourceEntry::last_viewed_time_, &util::GetTimeFromString); converter->RegisterRepeatedMessage( - kFeedLinkField, &ResourceEntry::feed_links_); + kFeedLinkField, &ResourceEntry::resource_links_); converter->RegisterNestedField(kContentField, &ResourceEntry::content_); // File properties. If the resource type is not a normal file, then @@ -708,7 +708,7 @@ scoped_ptr<ResourceEntry> ResourceEntry::CreateFromFileResource( // This should be the url to download the file. entry->content_.url_ = file.download_url(); entry->content_.mime_type_ = file.mime_type(); - // TODO(kochi): entry->feed_links_ + // TODO(kochi): entry->resource_links_ // For file entries entry->filename_ = file.title(); @@ -721,7 +721,7 @@ scoped_ptr<ResourceEntry> ResourceEntry::CreateFromFileResource( // file entry still exists but with its "trashed" label true. entry->deleted_ = file.labels().is_trashed(); - // FeedEntry + // CommonMetadata entry->etag_ = file.etag(); // entry->authors_ // entry->links_. @@ -796,7 +796,7 @@ ResourceList::~ResourceList() { void ResourceList::RegisterJSONConverter( base::JSONValueConverter<ResourceList>* converter) { // inheritance - FeedEntry::RegisterJSONConverter(converter); + CommonMetadata::RegisterJSONConverter(converter); // TODO(zelidrag): Once we figure out where these will be used, we should // check for valid start_index_ and items_per_page_ values. converter->RegisterCustomField<int>( @@ -965,54 +965,54 @@ void InstalledApp::RegisterJSONConverter( } //////////////////////////////////////////////////////////////////////////////// -// AccountMetadataFeed implementation +// AccountMetadata implementation -AccountMetadataFeed::AccountMetadataFeed() +AccountMetadata::AccountMetadata() : quota_bytes_total_(0), quota_bytes_used_(0), largest_changestamp_(0) { } -AccountMetadataFeed::~AccountMetadataFeed() { +AccountMetadata::~AccountMetadata() { } // static -void AccountMetadataFeed::RegisterJSONConverter( - base::JSONValueConverter<AccountMetadataFeed>* converter) { +void AccountMetadata::RegisterJSONConverter( + base::JSONValueConverter<AccountMetadata>* converter) { converter->RegisterCustomField<int64>( kQuotaBytesTotalField, - &AccountMetadataFeed::quota_bytes_total_, + &AccountMetadata::quota_bytes_total_, &base::StringToInt64); converter->RegisterCustomField<int64>( kQuotaBytesUsedField, - &AccountMetadataFeed::quota_bytes_used_, + &AccountMetadata::quota_bytes_used_, &base::StringToInt64); converter->RegisterCustomField<int64>( kLargestChangestampField, - &AccountMetadataFeed::largest_changestamp_, + &AccountMetadata::largest_changestamp_, &base::StringToInt64); converter->RegisterRepeatedMessage(kInstalledAppField, - &AccountMetadataFeed::installed_apps_); + &AccountMetadata::installed_apps_); } // static -scoped_ptr<AccountMetadataFeed> AccountMetadataFeed::CreateFrom( +scoped_ptr<AccountMetadata> AccountMetadata::CreateFrom( const base::Value& value) { - scoped_ptr<AccountMetadataFeed> feed(new AccountMetadataFeed()); + scoped_ptr<AccountMetadata> metadata(new AccountMetadata()); const base::DictionaryValue* dictionary = NULL; const base::Value* entry = NULL; if (!value.GetAsDictionary(&dictionary) || !dictionary->Get(kEntryField, &entry) || - !feed->Parse(*entry)) { + !metadata->Parse(*entry)) { LOG(ERROR) << "Unable to create: Invalid account metadata feed!"; - return scoped_ptr<AccountMetadataFeed>(NULL); + return scoped_ptr<AccountMetadata>(NULL); } - return feed.Pass(); + return metadata.Pass(); } -bool AccountMetadataFeed::Parse(const base::Value& value) { - base::JSONValueConverter<AccountMetadataFeed> converter; +bool AccountMetadata::Parse(const base::Value& value) { + base::JSONValueConverter<AccountMetadata> converter; if (!converter.Convert(value, this)) { LOG(ERROR) << "Unable to parse: Invalid account metadata feed!"; return false; diff --git a/chrome/browser/google_apis/gdata_wapi_parser.h b/chrome/browser/google_apis/gdata_wapi_parser.h index bc5c702..20a7b95 100644 --- a/chrome/browser/google_apis/gdata_wapi_parser.h +++ b/chrome/browser/google_apis/gdata_wapi_parser.h @@ -123,41 +123,41 @@ class Link { // Feed links define links (URLs) to special list of entries (i.e. list of // previous document revisions). -class FeedLink { +class ResourceLink { public: - enum FeedLinkType { + enum ResourceLinkType { FEED_LINK_UNKNOWN, FEED_LINK_ACL, FEED_LINK_REVISIONS, }; - FeedLink(); + ResourceLink(); // Registers the mapping between JSON field names and the members in // this class. static void RegisterJSONConverter( - base::JSONValueConverter<FeedLink>* converter); + base::JSONValueConverter<ResourceLink>* converter); // MIME type of the feed. - FeedLinkType type() const { return type_; } + ResourceLinkType type() const { return type_; } // URL of the feed. const GURL& href() const { return href_; } - void set_type(FeedLinkType type) { type_ = type; } + void set_type(ResourceLinkType type) { type_ = type; } void set_href(const GURL& href) { href_ = href; } private: friend class ResourceEntry; - // Converts value of gd$feedLink.rel into FeedLinkType enum. + // Converts value of gd$feedLink.rel into ResourceLinkType enum. // Outputs to |result| and returns true when |rel| has a valid // value. Otherwise does nothing and returns false. static bool GetFeedLinkType( - const base::StringPiece& rel, FeedLinkType* result); + const base::StringPiece& rel, ResourceLinkType* result); - FeedLinkType type_; + ResourceLinkType type_; GURL href_; - DISALLOW_COPY_AND_ASSIGN(FeedLink); + DISALLOW_COPY_AND_ASSIGN(ResourceLink); }; // Author represents an author of an entity. @@ -315,10 +315,10 @@ class AppIcon { // Base class for feed entries. This class defines fields commonly used by // various feeds. -class FeedEntry { +class CommonMetadata { public: - FeedEntry(); - virtual ~FeedEntry(); + CommonMetadata(); + virtual ~CommonMetadata(); // Returns a link of a given |type| for this entry. If not found, it returns // NULL. @@ -357,9 +357,9 @@ class FeedEntry { protected: // Registers the mapping between JSON field names and the members in // this class. - template<typename FeedEntryDescendant> + template<typename CommonMetadataDescendant> static void RegisterJSONConverter( - base::JSONValueConverter<FeedEntryDescendant>* converter); + base::JSONValueConverter<CommonMetadataDescendant>* converter); std::string etag_; ScopedVector<Author> authors_; @@ -367,12 +367,12 @@ class FeedEntry { ScopedVector<Category> categories_; base::Time updated_time_; - DISALLOW_COPY_AND_ASSIGN(FeedEntry); + DISALLOW_COPY_AND_ASSIGN(CommonMetadata); }; // This class represents a resource entry. A resource is a generic term which // refers to a file and a directory. -class ResourceEntry : public FeedEntry { +class ResourceEntry : public CommonMetadata { public: ResourceEntry(); virtual ~ResourceEntry(); @@ -447,10 +447,12 @@ class ResourceEntry : public FeedEntry { const std::string& content_mime_type() const { return content_.mime_type(); } - // The feed links contain extra links for revisions and access control, + // The resource links contain extra links for revisions and access control, // etc. Note that links() contain more basic links like edit URL, // alternative URL, etc. - const ScopedVector<FeedLink>& feed_links() const { return feed_links_; } + const ScopedVector<ResourceLink>& resource_links() const { + return resource_links_; + } // File name (exists only for kinds FILE and PDF). const std::string& filename() const { return filename_; } @@ -540,8 +542,8 @@ class ResourceEntry : public FeedEntry { void set_content(const Content& content) { content_ = content; } - void set_feed_links(ScopedVector<FeedLink>* feed_links) { - feed_links_.swap(*feed_links); + void set_resource_links(ScopedVector<ResourceLink>* resource_links) { + resource_links_.swap(*resource_links); } void set_filename(const std::string& filename) { filename_ = filename; } void set_suggested_filename(const std::string& suggested_filename) { @@ -575,7 +577,7 @@ class ResourceEntry : public FeedEntry { base::Time last_viewed_time_; std::vector<std::string> labels_; Content content_; - ScopedVector<FeedLink> feed_links_; + ScopedVector<ResourceLink> resource_links_; // Optional fields for files only. std::string filename_; std::string suggested_filename_; @@ -592,7 +594,7 @@ class ResourceEntry : public FeedEntry { // such as the root upload URL. The feed is paginated and the rest of the // feed can be fetched by retrieving the remaining parts of the feed from // URLs provided by GetNextFeedURL() method. -class ResourceList : public FeedEntry { +class ResourceList : public CommonMetadata { public: ResourceList(); virtual ~ResourceList(); @@ -795,17 +797,17 @@ class InstalledApp { // Account metadata feed represents the metadata object attached to the user's // account. -class AccountMetadataFeed { +class AccountMetadata { public: - AccountMetadataFeed(); - virtual ~AccountMetadataFeed(); + AccountMetadata(); + virtual ~AccountMetadata(); // Creates feed from parsed JSON Value. You should call this // instead of instantiating JSONValueConverter by yourself because // this method does some post-process for some fields. See // FillRemainingFields comment and implementation in ResourceEntry // class for the details. - static scoped_ptr<AccountMetadataFeed> CreateFrom(const base::Value& value); + static scoped_ptr<AccountMetadata> CreateFrom(const base::Value& value); int64 quota_bytes_total() const { return quota_bytes_total_; @@ -839,7 +841,7 @@ class AccountMetadataFeed { // Registers the mapping between JSON field names and the members in // this class. static void RegisterJSONConverter( - base::JSONValueConverter<AccountMetadataFeed>* converter); + base::JSONValueConverter<AccountMetadata>* converter); private: // Parses and initializes data members from content of |value|. @@ -851,7 +853,7 @@ class AccountMetadataFeed { int64 largest_changestamp_; ScopedVector<InstalledApp> installed_apps_; - DISALLOW_COPY_AND_ASSIGN(AccountMetadataFeed); + DISALLOW_COPY_AND_ASSIGN(AccountMetadata); }; diff --git a/chrome/browser/google_apis/gdata_wapi_parser_unittest.cc b/chrome/browser/google_apis/gdata_wapi_parser_unittest.cc index 6f4441a..67c1fe3 100644 --- a/chrome/browser/google_apis/gdata_wapi_parser_unittest.cc +++ b/chrome/browser/google_apis/gdata_wapi_parser_unittest.cc @@ -91,10 +91,10 @@ TEST(GDataWAPIParserTest, ResourceListJsonParser) { EXPECT_EQ("application/atom+xml;type=feed", folder_entry->content_mime_type()); - ASSERT_EQ(1U, folder_entry->feed_links().size()); - const FeedLink* feed_link = folder_entry->feed_links()[0]; + ASSERT_EQ(1U, folder_entry->resource_links().size()); + const ResourceLink* feed_link = folder_entry->resource_links()[0]; ASSERT_TRUE(feed_link); - ASSERT_EQ(FeedLink::FEED_LINK_ACL, feed_link->type()); + ASSERT_EQ(ResourceLink::FEED_LINK_ACL, feed_link->type()); const Link* entry1_alternate_link = folder_entry->GetLinkByType(Link::LINK_ALTERNATE); @@ -188,10 +188,10 @@ TEST(GDataWAPIParserTest, ResourceEntryJsonParser) { entry->content_mime_type()); // Check feed links. - ASSERT_EQ(1U, entry->feed_links().size()); - const FeedLink* feed_link_1 = entry->feed_links()[0]; + ASSERT_EQ(1U, entry->resource_links().size()); + const ResourceLink* feed_link_1 = entry->resource_links()[0]; ASSERT_TRUE(feed_link_1); - EXPECT_EQ(FeedLink::FEED_LINK_REVISIONS, feed_link_1->type()); + EXPECT_EQ(ResourceLink::FEED_LINK_REVISIONS, feed_link_1->type()); // Check links. ASSERT_EQ(8U, entry->links().size()); @@ -238,7 +238,7 @@ TEST(GDataWAPIParserTest, ResourceEntryJsonParser) { EXPECT_EQ(892721, entry->file_size()); } -TEST(GDataWAPIParserTest, AccountMetadataFeedParser) { +TEST(GDataWAPIParserTest, AccountMetadataParser) { scoped_ptr<Value> document = test_util::LoadJSONFile("gdata/account_metadata.json"); ASSERT_TRUE(document.get()); @@ -248,15 +248,15 @@ TEST(GDataWAPIParserTest, AccountMetadataFeedParser) { std::string("entry"), &entry_value)); ASSERT_TRUE(entry_value); - scoped_ptr<AccountMetadataFeed> feed( - AccountMetadataFeed::CreateFrom(*document)); - ASSERT_TRUE(feed.get()); - EXPECT_EQ(GG_LONGLONG(6789012345), feed->quota_bytes_used()); - EXPECT_EQ(GG_LONGLONG(9876543210), feed->quota_bytes_total()); - EXPECT_EQ(654321, feed->largest_changestamp()); - EXPECT_EQ(2U, feed->installed_apps().size()); - const InstalledApp* first_app = feed->installed_apps()[0]; - const InstalledApp* second_app = feed->installed_apps()[1]; + scoped_ptr<AccountMetadata> metadata( + AccountMetadata::CreateFrom(*document)); + ASSERT_TRUE(metadata.get()); + EXPECT_EQ(GG_LONGLONG(6789012345), metadata->quota_bytes_used()); + EXPECT_EQ(GG_LONGLONG(9876543210), metadata->quota_bytes_total()); + EXPECT_EQ(654321, metadata->largest_changestamp()); + EXPECT_EQ(2U, metadata->installed_apps().size()); + const InstalledApp* first_app = metadata->installed_apps()[0]; + const InstalledApp* second_app = metadata->installed_apps()[1]; ASSERT_TRUE(first_app); EXPECT_EQ("Drive App 1", first_app->app_name()); diff --git a/chrome/browser/google_apis/gdata_wapi_service.cc b/chrome/browser/google_apis/gdata_wapi_service.cc index cddafec..7004f18 100644 --- a/chrome/browser/google_apis/gdata_wapi_service.cc +++ b/chrome/browser/google_apis/gdata_wapi_service.cc @@ -107,12 +107,12 @@ void ExtractOpenLinkAndRun(const std::string app_id, return; } - const ScopedVector<google_apis::Link>& feed_links = entry->links(); + const ScopedVector<google_apis::Link>& resource_links = entry->links(); GURL open_link; - for (size_t i = 0; i < feed_links.size(); ++i) { - if (feed_links[i]->type() == google_apis::Link::LINK_OPEN_WITH && - feed_links[i]->app_id() == app_id) { - open_link = feed_links[i]->href(); + for (size_t i = 0; i < resource_links.size(); ++i) { + if (resource_links[i]->type() == google_apis::Link::LINK_OPEN_WITH && + resource_links[i]->app_id() == app_id) { + open_link = resource_links[i]->href(); break; } } diff --git a/chrome/browser/google_apis/mock_drive_service.cc b/chrome/browser/google_apis/mock_drive_service.cc index 4f4f345..d19fb85 100644 --- a/chrome/browser/google_apis/mock_drive_service.cc +++ b/chrome/browser/google_apis/mock_drive_service.cc @@ -87,8 +87,8 @@ void MockDriveService::GetResourceListStub( void MockDriveService::GetAccountMetadataStub( const GetAccountMetadataCallback& callback) { - scoped_ptr<AccountMetadataFeed> account_metadata = - AccountMetadataFeed::CreateFrom(*account_metadata_data_); + scoped_ptr<AccountMetadata> account_metadata = + AccountMetadata::CreateFrom(*account_metadata_data_); base::MessageLoopProxy::current()->PostTask( FROM_HERE, base::Bind(callback, HTTP_SUCCESS, diff --git a/chrome/browser/google_apis/test_util.cc b/chrome/browser/google_apis/test_util.cc index a3309db..b76f24f 100644 --- a/chrome/browser/google_apis/test_util.cc +++ b/chrome/browser/google_apis/test_util.cc @@ -143,18 +143,18 @@ void CopyResultsFromGetResourceListCallback( void CopyResultsFromGetAccountMetadataCallback( GDataErrorCode* error_out, - scoped_ptr<AccountMetadataFeed>* account_metadata_out, + scoped_ptr<AccountMetadata>* account_metadata_out, GDataErrorCode error_in, - scoped_ptr<AccountMetadataFeed> account_metadata_in) { + scoped_ptr<AccountMetadata> account_metadata_in) { account_metadata_out->swap(account_metadata_in); *error_out = error_in; } void CopyResultsFromGetAccountMetadataCallbackAndQuit( GDataErrorCode* error_out, - scoped_ptr<AccountMetadataFeed>* account_metadata_out, + scoped_ptr<AccountMetadata>* account_metadata_out, GDataErrorCode error_in, - scoped_ptr<AccountMetadataFeed> account_metadata_in) { + scoped_ptr<AccountMetadata> account_metadata_in) { CopyResultsFromGetAccountMetadataCallback( error_out, account_metadata_out, error_in, account_metadata_in.Pass()); MessageLoop::current()->Quit(); diff --git a/chrome/browser/google_apis/test_util.h b/chrome/browser/google_apis/test_util.h index c80c0be8..fcd5b19 100644 --- a/chrome/browser/google_apis/test_util.h +++ b/chrome/browser/google_apis/test_util.h @@ -20,7 +20,7 @@ class Value; namespace google_apis { class AboutResource; -class AccountMetadataFeed; +class AccountMetadata; class AppList; class AuthenticatedOperationInterface; class ResourceEntry; @@ -98,17 +98,17 @@ void CopyResultsFromGetResourceListCallback( // Copies the results from GetAccountMetadataCallback. void CopyResultsFromGetAccountMetadataCallback( GDataErrorCode* error_out, - scoped_ptr<AccountMetadataFeed>* account_metadata_out, + scoped_ptr<AccountMetadata>* account_metadata_out, GDataErrorCode error_in, - scoped_ptr<AccountMetadataFeed> account_metadata_in); + scoped_ptr<AccountMetadata> account_metadata_in); // Copies the results from GetAccountMetadataCallback and quit the message // loop. void CopyResultsFromGetAccountMetadataCallbackAndQuit( GDataErrorCode* error_out, - scoped_ptr<AccountMetadataFeed>* account_metadata_out, + scoped_ptr<AccountMetadata>* account_metadata_out, GDataErrorCode error_in, - scoped_ptr<AccountMetadataFeed> account_metadata_in); + scoped_ptr<AccountMetadata> account_metadata_in); // Copies the results from GetAboutResourceCallback. void CopyResultsFromGetAboutResourceCallback( diff --git a/chrome/browser/sync_file_system/drive_file_sync_client.cc b/chrome/browser/sync_file_system/drive_file_sync_client.cc index ffa6d04..e835cef 100644 --- a/chrome/browser/sync_file_system/drive_file_sync_client.cc +++ b/chrome/browser/sync_file_system/drive_file_sync_client.cc @@ -301,7 +301,7 @@ void DriveFileSyncClient::GetResourceEntry( void DriveFileSyncClient::DidGetAccountMetadata( const ChangeStampCallback& callback, google_apis::GDataErrorCode error, - scoped_ptr<google_apis::AccountMetadataFeed> metadata) { + scoped_ptr<google_apis::AccountMetadata> metadata) { DCHECK(CalledOnValidThread()); int64 largest_changestamp = 0; diff --git a/chrome/browser/sync_file_system/drive_file_sync_client.h b/chrome/browser/sync_file_system/drive_file_sync_client.h index 8ce213a..5f20a01 100644 --- a/chrome/browser/sync_file_system/drive_file_sync_client.h +++ b/chrome/browser/sync_file_system/drive_file_sync_client.h @@ -132,7 +132,7 @@ class DriveFileSyncClient void DidGetAccountMetadata( const ChangeStampCallback& callback, google_apis::GDataErrorCode error, - scoped_ptr<google_apis::AccountMetadataFeed> metadata); + scoped_ptr<google_apis::AccountMetadata> metadata); void DidGetResourceList( const ResourceListCallback& callback, diff --git a/chrome/browser/sync_file_system/drive_file_sync_client_unittest.cc b/chrome/browser/sync_file_system/drive_file_sync_client_unittest.cc index 93caca5..7b86c36 100644 --- a/chrome/browser/sync_file_system/drive_file_sync_client_unittest.cc +++ b/chrome/browser/sync_file_system/drive_file_sync_client_unittest.cc @@ -157,7 +157,7 @@ class DriveFileSyncClientTest : public testing::Test { // Invokes |arg0| as a GetAccountMetadataCallback. ACTION_P2(InvokeGetAccountMetadataCallback0, error, result) { - scoped_ptr<google_apis::AccountMetadataFeed> account_metadata(result.Pass()); + scoped_ptr<google_apis::AccountMetadata> account_metadata(result.Pass()); base::MessageLoopProxy::current()->PostTask( FROM_HERE, base::Bind(arg0, error, base::Passed(&account_metadata))); @@ -571,8 +571,8 @@ TEST_F(DriveFileSyncClientTest, CreateOriginDirectory_Conflict) { TEST_F(DriveFileSyncClientTest, GetLargestChangeStamp) { scoped_ptr<base::Value> result( LoadJSONFile("sync_file_system/account_metadata.json").Pass()); - scoped_ptr<google_apis::AccountMetadataFeed> account_metadata( - google_apis::AccountMetadataFeed::CreateFrom(*result)); + scoped_ptr<google_apis::AccountMetadata> account_metadata( + google_apis::AccountMetadata::CreateFrom(*result)); // Expect to call GetAccountMetadata from GetLargestChangeStamp. EXPECT_CALL(*mock_drive_service(), GetAccountMetadata(_)) diff --git a/chrome/browser/sync_file_system/drive_file_sync_service_unittest.cc b/chrome/browser/sync_file_system/drive_file_sync_service_unittest.cc index 673a917..c4ba616 100644 --- a/chrome/browser/sync_file_system/drive_file_sync_service_unittest.cc +++ b/chrome/browser/sync_file_system/drive_file_sync_service_unittest.cc @@ -109,7 +109,7 @@ ACTION(InvokeCompletionCallback) { // Invokes |arg0| as a GetDataCallback. ACTION_P2(InvokeGetAccountMetadataCallback0, error, result) { - scoped_ptr<google_apis::AccountMetadataFeed> account_metadata(result.Pass()); + scoped_ptr<google_apis::AccountMetadata> account_metadata(result.Pass()); base::MessageLoopProxy::current()->PostTask( FROM_HERE, base::Bind(arg0, error, base::Passed(&account_metadata))); @@ -471,8 +471,8 @@ class DriveFileSyncServiceTest : public testing::Test { void SetUpDriveServiceExpectCallsForGetAccountMetadata() { scoped_ptr<Value> account_metadata_value(LoadJSONFile( "gdata/account_metadata.json")); - scoped_ptr<google_apis::AccountMetadataFeed> account_metadata( - google_apis::AccountMetadataFeed::CreateFrom(*account_metadata_value)); + scoped_ptr<google_apis::AccountMetadata> account_metadata( + google_apis::AccountMetadata::CreateFrom(*account_metadata_value)); EXPECT_CALL(*mock_drive_service(), GetAccountMetadata(_)) .WillOnce(InvokeGetAccountMetadataCallback0( diff --git a/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc b/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc index 781c981..651426d 100644 --- a/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc +++ b/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc @@ -233,7 +233,7 @@ class DriveInternalsWebUIHandler : public content::WebUIMessageHandler { // Called when GetAccountMetadata() call to DriveService is complete. void OnGetAccountMetadata( google_apis::GDataErrorCode status, - scoped_ptr<google_apis::AccountMetadataFeed> account_metadata); + scoped_ptr<google_apis::AccountMetadata> account_metadata); // Callback for DriveFilesystem::GetMetadata for local update. void OnGetFilesystemMetadataForLocal( @@ -260,7 +260,7 @@ class DriveInternalsWebUIHandler : public content::WebUIMessageHandler { void DriveInternalsWebUIHandler::OnGetAccountMetadata( google_apis::GDataErrorCode status, - scoped_ptr<google_apis::AccountMetadataFeed> parsed_metadata) { + scoped_ptr<google_apis::AccountMetadata> parsed_metadata) { if (status != google_apis::HTTP_SUCCESS) { LOG(ERROR) << "Failed to get account metadata"; return; |