diff options
author | battre@chromium.org <battre@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-10 12:36:47 +0000 |
---|---|---|
committer | battre@chromium.org <battre@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-10 12:36:47 +0000 |
commit | beff6b317b2cc88775aa889f9bd600c2ca0bcfbd (patch) | |
tree | 95ae226da78af67841a37a849360a6513b7f413b | |
parent | 2d2755e700a72839353c3e1edd1659fa3452b6c7 (diff) | |
download | chromium_src-beff6b317b2cc88775aa889f9bd600c2ca0bcfbd.zip chromium_src-beff6b317b2cc88775aa889f9bd600c2ca0bcfbd.tar.gz chromium_src-beff6b317b2cc88775aa889f9bd600c2ca0bcfbd.tar.bz2 |
Revert 172038
> google_apis: Rename DocumentFeed to ResourceList
>
> DocumentFeed was a misnomer, as this class represented a resource list.
>
> Along the way, add more useful comments in gdata_wapi_parser.h, and
> fix wrong variable names like 'doc'.
>
>
> BUG=164090
> TEST=none
>
>
> Review URL: https://chromiumcodereview.appspot.com/11499006
The CL broke the tree:
../../chrome/browser/chromeos/extensions/file_browser_event_router.h:91:16:error: 'OnDocumentFeedFetched' marked 'override' but does not override any member functions
virtual void OnDocumentFeedFetched(int num_accumulated_entries) OVERRIDE;
TBR=satorux@chromium.org
Review URL: https://codereview.chromium.org/11503010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@172039 0039d316-1c4b-4281-b951-d872f2087c98
20 files changed, 212 insertions, 213 deletions
diff --git a/chrome/browser/chromeos/drive/drive_feed_loader.cc b/chrome/browser/chromeos/drive/drive_feed_loader.cc index 88ec101..b13f21e 100644 --- a/chrome/browser/chromeos/drive/drive_feed_loader.cc +++ b/chrome/browser/chromeos/drive/drive_feed_loader.cc @@ -136,10 +136,10 @@ bool UseLevelDB() { return false; } -// Parses a google_apis::ResourceList from |data|. -scoped_ptr<google_apis::ResourceList> ParseFeedOnBlockingPool( +// Parses a google_apis::DocumentFeed from |data|. +scoped_ptr<google_apis::DocumentFeed> ParseFeedOnBlockingPool( scoped_ptr<base::Value> data) { - return google_apis::ResourceList::ExtractAndParse(*data); + return google_apis::DocumentFeed::ExtractAndParse(*data); } } // namespace @@ -181,7 +181,7 @@ struct DriveFeedLoader::LoadFeedParams { GURL feed_to_load; bool load_subsequent_feeds; const LoadFeedListCallback feed_load_callback; - ScopedVector<google_apis::ResourceList> feed_list; + ScopedVector<google_apis::DocumentFeed> feed_list; scoped_ptr<GetResourceListUiState> ui_state; }; @@ -221,7 +221,7 @@ struct DriveFeedLoader::UpdateMetadataParams { const FileOperationCallback callback; }; -// Defines set of parameters sent to callback OnNotifyResourceListFetched(). +// Defines set of parameters sent to callback OnNotifyDocumentFeedFetched(). // This is a trick to update the number of fetched documents frequently on // UI. Due to performance reason, we need to fetch a number of files at // a time. However, it'll take long time, and a user has no way to know @@ -456,7 +456,7 @@ void DriveFeedLoader::SearchFromServer( void DriveFeedLoader::UpdateMetadataFromFeedAfterLoadFromServer( const UpdateMetadataParams& params, - const ScopedVector<google_apis::ResourceList>& feed_list, + const ScopedVector<google_apis::DocumentFeed>& feed_list, DriveFileError error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!params.callback.is_null()); @@ -512,7 +512,7 @@ void DriveFeedLoader::OnGetResourceList(scoped_ptr<LoadFeedParams> params, void DriveFeedLoader::OnParseFeed( scoped_ptr<LoadFeedParams> params, base::TimeTicks start_time, - scoped_ptr<google_apis::ResourceList> current_feed) { + scoped_ptr<google_apis::DocumentFeed> current_feed) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (!current_feed) { @@ -548,7 +548,7 @@ void DriveFeedLoader::OnParseFeed( // Currently the UI update is stopped. Start UI periodic callback. base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(&DriveFeedLoader::OnNotifyResourceListFetched, + base::Bind(&DriveFeedLoader::OnNotifyDocumentFeedFetched, weak_ptr_factory_.GetWeakPtr(), ui_state->weak_ptr_factory.GetWeakPtr())); } @@ -574,7 +574,7 @@ void DriveFeedLoader::OnParseFeed( // Notify the observers that all document feeds are fetched. FOR_EACH_OBSERVER(DriveFeedLoaderObserver, observers_, - OnResourceListFetched(num_accumulated_entries)); + OnDocumentFeedFetched(num_accumulated_entries)); UMA_HISTOGRAM_TIMES("Drive.EntireFeedLoadTime", base::TimeTicks::Now() - start_time); @@ -628,8 +628,8 @@ void DriveFeedLoader::OnGetChangelist(scoped_ptr<LoadFeedParams> params, #endif // Add the current feed to the list of collected feeds for this directory. - scoped_ptr<google_apis::ResourceList> feed = - google_apis::ResourceList::CreateFromChangeList(*current_feed); + scoped_ptr<google_apis::DocumentFeed> feed = + google_apis::DocumentFeed::CreateFromChangeList(*current_feed); params->feed_list.push_back(feed.release()); // Compute and notify the number of entries fetched so far. @@ -652,7 +652,7 @@ void DriveFeedLoader::OnGetChangelist(scoped_ptr<LoadFeedParams> params, // Currently the UI update is stopped. Start UI periodic callback. base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(&DriveFeedLoader::OnNotifyResourceListFetched, + base::Bind(&DriveFeedLoader::OnNotifyDocumentFeedFetched, weak_ptr_factory_.GetWeakPtr(), ui_state->weak_ptr_factory.GetWeakPtr())); } @@ -677,7 +677,7 @@ void DriveFeedLoader::OnGetChangelist(scoped_ptr<LoadFeedParams> params, // Notify the observers that all document feeds are fetched. FOR_EACH_OBSERVER(DriveFeedLoaderObserver, observers_, - OnResourceListFetched(num_accumulated_entries)); + OnDocumentFeedFetched(num_accumulated_entries)); UMA_HISTOGRAM_TIMES("Drive.EntireFeedLoadTime", base::TimeTicks::Now() - start_time); @@ -686,7 +686,7 @@ void DriveFeedLoader::OnGetChangelist(scoped_ptr<LoadFeedParams> params, params->RunFeedLoadCallback(error); } -void DriveFeedLoader::OnNotifyResourceListFetched( +void DriveFeedLoader::OnNotifyDocumentFeedFetched( base::WeakPtr<GetResourceListUiState> ui_state) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -703,7 +703,7 @@ void DriveFeedLoader::OnNotifyResourceListFetched( ui_state->num_fetched_documents) { ui_state->num_showing_documents += kFetchUiUpdateStep; FOR_EACH_OBSERVER(DriveFeedLoaderObserver, observers_, - OnResourceListFetched(ui_state->num_showing_documents)); + OnDocumentFeedFetched(ui_state->num_showing_documents)); int num_remaining_ui_updates = (ui_state->num_fetched_documents - ui_state->num_showing_documents) @@ -722,7 +722,7 @@ void DriveFeedLoader::OnNotifyResourceListFetched( base::MessageLoopProxy::current()->PostDelayedTask( FROM_HERE, - base::Bind(&DriveFeedLoader::OnNotifyResourceListFetched, + base::Bind(&DriveFeedLoader::OnNotifyDocumentFeedFetched, weak_ptr_factory_.GetWeakPtr(), ui_state->weak_ptr_factory.GetWeakPtr()), interval); @@ -825,7 +825,7 @@ void DriveFeedLoader::SaveFileSystem() { } void DriveFeedLoader::UpdateFromFeed( - const ScopedVector<google_apis::ResourceList>& feed_list, + const ScopedVector<google_apis::DocumentFeed>& feed_list, bool is_delta_feed, int64 root_feed_changestamp, const std::string& root_resource_id, diff --git a/chrome/browser/chromeos/drive/drive_feed_loader.h b/chrome/browser/chromeos/drive/drive_feed_loader.h index 415360f..af2d2e9 100644 --- a/chrome/browser/chromeos/drive/drive_feed_loader.h +++ b/chrome/browser/chromeos/drive/drive_feed_loader.h @@ -22,7 +22,7 @@ class Value; } namespace google_apis { -class ResourceList; +class DocumentFeed; } namespace drive { @@ -35,7 +35,7 @@ class DriveWebAppsRegistryInterface; // Callback run as a response to SearchFromServer and LoadDirectoryFromServer. typedef base::Callback< - void(const ScopedVector<google_apis::ResourceList>& feed_list, + void(const ScopedVector<google_apis::DocumentFeed>& feed_list, DriveFileError error)> LoadFeedListCallback; // DriveFeedLoader is used to load feeds from WAPI (codename for @@ -89,7 +89,7 @@ class DriveFeedLoader { // |is_delta_feed| and |root_feed_changestamp|. // |root_resource_id| is used for Drive API. // |update_finished_callback| must not be null. - void UpdateFromFeed(const ScopedVector<google_apis::ResourceList>& feed_list, + void UpdateFromFeed(const ScopedVector<google_apis::DocumentFeed>& feed_list, bool is_delta_feed, int64 root_feed_changestamp, const std::string& root_resource_id, @@ -135,7 +135,7 @@ class DriveFeedLoader { // started FindEntryByPath() request. void UpdateMetadataFromFeedAfterLoadFromServer( const UpdateMetadataParams& params, - const ScopedVector<google_apis::ResourceList>& feed_list, + const ScopedVector<google_apis::DocumentFeed>& feed_list, DriveFileError error); // Callback for handling response from |GDataWapiService::GetResourceList|. @@ -149,7 +149,7 @@ class DriveFeedLoader { // Callback for handling results of feed parse. void OnParseFeed(scoped_ptr<LoadFeedParams> params, base::TimeTicks start_time, - scoped_ptr<google_apis::ResourceList> current_feed); + scoped_ptr<google_apis::DocumentFeed> current_feed); // Callback for handling response from |DriveAPIService::GetResourceList|. // Invokes |callback| when done. @@ -163,7 +163,7 @@ class DriveFeedLoader { void SaveFileSystem(); // Callback for handling UI updates caused by feed fetching. - void OnNotifyResourceListFetched( + void OnNotifyDocumentFeedFetched( base::WeakPtr<GetResourceListUiState> ui_state); // Callback for DriveFeedProcessor::ApplyFeeds. diff --git a/chrome/browser/chromeos/drive/drive_feed_loader_observer.h b/chrome/browser/chromeos/drive/drive_feed_loader_observer.h index 7232a78..b42f21f 100644 --- a/chrome/browser/chromeos/drive/drive_feed_loader_observer.h +++ b/chrome/browser/chromeos/drive/drive_feed_loader_observer.h @@ -21,9 +21,9 @@ class DriveFeedLoaderObserver { virtual void OnDirectoryChanged(const FilePath& directory_path) { } - // Triggered when a resource list is fetched. |num_accumulated_entries| + // Triggered when a document feed is fetched. |num_accumulated_entries| // tells the number of entries fetched so far. - virtual void OnResourceListFetched(int num_accumulated_entries) { + virtual void OnDocumentFeedFetched(int num_accumulated_entries) { } // Triggered when the feed from the server is loaded. diff --git a/chrome/browser/chromeos/drive/drive_feed_processor.cc b/chrome/browser/chromeos/drive/drive_feed_processor.cc index adccb69..5caaff3 100644 --- a/chrome/browser/chromeos/drive/drive_feed_processor.cc +++ b/chrome/browser/chromeos/drive/drive_feed_processor.cc @@ -51,7 +51,7 @@ DriveFeedProcessor::~DriveFeedProcessor() { } void DriveFeedProcessor::ApplyFeeds( - const ScopedVector<google_apis::ResourceList>& feed_list, + const ScopedVector<google_apis::DocumentFeed>& feed_list, bool is_delta_feed, int64 root_feed_changestamp, const base::Closure& on_complete_callback) { @@ -295,14 +295,14 @@ void DriveFeedProcessor::NotifyForRefreshEntryProto( } void DriveFeedProcessor::FeedToEntryProtoMap( - const ScopedVector<google_apis::ResourceList>& feed_list, + const ScopedVector<google_apis::DocumentFeed>& feed_list, int64* feed_changestamp, FeedToEntryProtoMapUMAStats* uma_stats) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); Clear(); for (size_t i = 0; i < feed_list.size(); ++i) { - const google_apis::ResourceList* feed = feed_list[i]; + const google_apis::DocumentFeed* feed = feed_list[i]; // Get upload url from the root feed. Links for all other collections will // be handled in ConvertResourceEntryToDriveEntryProto. @@ -317,9 +317,8 @@ void DriveFeedProcessor::FeedToEntryProtoMap( } for (size_t j = 0; j < feed->entries().size(); ++j) { - const google_apis::ResourceEntry* entry = feed->entries()[j]; - DriveEntryProto entry_proto = - ConvertResourceEntryToDriveEntryProto(*entry); + const google_apis::ResourceEntry* doc = feed->entries()[j]; + DriveEntryProto entry_proto = ConvertResourceEntryToDriveEntryProto(*doc); // Some document entries don't map into files (i.e. sites). if (entry_proto.resource_id().empty()) continue; diff --git a/chrome/browser/chromeos/drive/drive_feed_processor.h b/chrome/browser/chromeos/drive/drive_feed_processor.h index 11766a2..81b790e 100644 --- a/chrome/browser/chromeos/drive/drive_feed_processor.h +++ b/chrome/browser/chromeos/drive/drive_feed_processor.h @@ -49,7 +49,7 @@ class DriveFeedProcessor { // TODO(achuith): Change the type of on_complete_callback to // FileOperationCallback instead. void ApplyFeeds( - const ScopedVector<google_apis::ResourceList>& feed_list, + const ScopedVector<google_apis::DocumentFeed>& feed_list, bool is_delta_feed, int64 root_feed_changestamp, const base::Closure& on_complete_callback); @@ -58,7 +58,7 @@ class DriveFeedProcessor { // DriveEntryProtoMap. |feed_changestamp| and/or |uma_stats| may be NULL. // entry_proto_map_ and root_upload_url_ are updated as side effects. void FeedToEntryProtoMap( - const ScopedVector<google_apis::ResourceList>& feed_list, + const ScopedVector<google_apis::DocumentFeed>& feed_list, int64* feed_changestamp, FeedToEntryProtoMapUMAStats* uma_stats); diff --git a/chrome/browser/chromeos/drive/drive_file_system.cc b/chrome/browser/chromeos/drive/drive_file_system.cc index 6ece3d8..c1955059 100644 --- a/chrome/browser/chromeos/drive/drive_file_system.cc +++ b/chrome/browser/chromeos/drive/drive_file_system.cc @@ -981,18 +981,18 @@ void DriveFileSystem::OnGetResourceEntry(const GetFileFromCacheParams& params, return; } - scoped_ptr<google_apis::ResourceEntry> entry; + scoped_ptr<google_apis::ResourceEntry> doc_entry; if (!google_apis::util::IsDriveV2ApiEnabled()) { - entry = google_apis::ResourceEntry::ExtractAndParse(*data); + doc_entry = google_apis::ResourceEntry::ExtractAndParse(*data); } else { scoped_ptr<google_apis::FileResource> file_resource = google_apis::FileResource::CreateFrom(*data); - entry = google_apis::ResourceEntry::CreateFromFileResource( + doc_entry = google_apis::ResourceEntry::CreateFromFileResource( *file_resource); } - GURL content_url = entry->content_url(); - int64 file_size = entry->file_size(); + GURL content_url = doc_entry->content_url(); + int64 file_size = doc_entry->file_size(); // The content URL can be empty for non-downloadable files (such as files // shared from others with "prevent downloading by viewers" flag set.) @@ -1004,9 +1004,9 @@ void DriveFileSystem::OnGetResourceEntry(const GetFileFromCacheParams& params, return; } - DCHECK_EQ(params.resource_id, entry->resource_id()); + DCHECK_EQ(params.resource_id, doc_entry->resource_id()); resource_metadata_->RefreshFile( - entry.Pass(), + doc_entry.Pass(), base::Bind(&DriveFileSystem::CheckForSpaceBeforeDownload, ui_weak_ptr_, params, @@ -1241,7 +1241,7 @@ void DriveFileSystem::RequestDirectoryRefreshOnUIThreadAfterGetEntryInfo( void DriveFileSystem::OnRequestDirectoryRefresh( const std::string& directory_resource_id, const FilePath& directory_path, - const ScopedVector<google_apis::ResourceList>& feed_list, + const ScopedVector<google_apis::DocumentFeed>& feed_list, DriveFileError error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -1412,7 +1412,7 @@ void DriveFileSystem::ContinueCreateDirectory( void DriveFileSystem::OnSearch( const SearchCallback& search_callback, - const ScopedVector<google_apis::ResourceList>& feed_list, + const ScopedVector<google_apis::DocumentFeed>& feed_list, DriveFileError error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!search_callback.is_null()); @@ -1431,7 +1431,7 @@ void DriveFileSystem::OnSearch( scoped_ptr<std::vector<SearchResultInfo> > result_vec(results); DCHECK_EQ(1u, feed_list.size()); - const google_apis::ResourceList* feed = feed_list[0]; + const google_apis::DocumentFeed* feed = feed_list[0]; // TODO(tbarzic): Limit total number of returned results for the query. GURL next_feed; @@ -1534,11 +1534,11 @@ void DriveFileSystem::OnDirectoryChanged(const FilePath& directory_path) { OnDirectoryChanged(directory_path)); } -void DriveFileSystem::OnResourceListFetched(int num_accumulated_entries) { +void DriveFileSystem::OnDocumentFeedFetched(int num_accumulated_entries) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); FOR_EACH_OBSERVER(DriveFileSystemObserver, observers_, - OnResourceListFetched(num_accumulated_entries)); + OnDocumentFeedFetched(num_accumulated_entries)); } void DriveFileSystem::OnFeedFromServerLoaded() { @@ -1775,23 +1775,23 @@ void DriveFileSystem::ContinueFindFirstMissingParentDirectory( void DriveFileSystem::AddUploadedFile( const FilePath& directory_path, - scoped_ptr<google_apis::ResourceEntry> entry, + scoped_ptr<google_apis::ResourceEntry> doc_entry, const FilePath& file_content_path, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - DCHECK(entry.get()); - DCHECK(!entry->resource_id().empty()); - DCHECK(!entry->file_md5().empty()); + DCHECK(doc_entry.get()); + DCHECK(!doc_entry->resource_id().empty()); + DCHECK(!doc_entry->file_md5().empty()); DCHECK(!callback.is_null()); AddUploadedFileParams params(file_content_path, callback, - entry->resource_id(), - entry->file_md5()); + doc_entry->resource_id(), + doc_entry->file_md5()); resource_metadata_->AddEntryToDirectory( directory_path, - entry.Pass(), + doc_entry.Pass(), base::Bind(&DriveFileSystem::AddUploadedFileToCache, ui_weak_ptr_, params)); } diff --git a/chrome/browser/chromeos/drive/drive_file_system.h b/chrome/browser/chromeos/drive/drive_file_system.h index 1dc81a1..ab529bc 100644 --- a/chrome/browser/chromeos/drive/drive_file_system.h +++ b/chrome/browser/chromeos/drive/drive_file_system.h @@ -27,7 +27,7 @@ class SequencedTaskRunner; } namespace google_apis { -class ResourceList; +class DocumentFeed; class DriveServiceInterface; class DriveUploaderInterface; } @@ -142,7 +142,7 @@ class DriveFileSystem : public DriveFileSystemInterface, // DriveFeedLoader::Observer overrides. // Used to propagate events from DriveFeedLoader. virtual void OnDirectoryChanged(const FilePath& directory_path) OVERRIDE; - virtual void OnResourceListFetched(int num_accumulated_entries) OVERRIDE; + virtual void OnDocumentFeedFetched(int num_accumulated_entries) OVERRIDE; virtual void OnFeedFromServerLoaded() OVERRIDE; // Used in tests to load the root feed from the cache. @@ -239,7 +239,7 @@ class DriveFileSystem : public DriveFileSystemInterface, // |feed_list| is the document feed for content search. // |error| is the error code returned by DriveFeedLoader. void OnSearch(const SearchCallback& callback, - const ScopedVector<google_apis::ResourceList>& feed_list, + const ScopedVector<google_apis::DocumentFeed>& feed_list, DriveFileError error); // Callback for DriveResourceMetadata::RefreshFile, from OnSearch. @@ -547,7 +547,7 @@ class DriveFileSystem : public DriveFileSystemInterface, void OnRequestDirectoryRefresh( const std::string& directory_resource_id, const FilePath& directory_path, - const ScopedVector<google_apis::ResourceList>& feed_list, + const ScopedVector<google_apis::DocumentFeed>& feed_list, DriveFileError error); void GetAvailableSpaceOnUIThread(const GetAvailableSpaceCallback& callback); diff --git a/chrome/browser/chromeos/drive/drive_file_system_observer.h b/chrome/browser/chromeos/drive/drive_file_system_observer.h index 4bc1520..a97f3383 100644 --- a/chrome/browser/chromeos/drive/drive_file_system_observer.h +++ b/chrome/browser/chromeos/drive/drive_file_system_observer.h @@ -28,7 +28,7 @@ class DriveFileSystemObserver { // Triggered when a document feed is fetched. |num_accumulated_entries| // tells the number of entries fetched so far. - virtual void OnResourceListFetched(int num_accumulated_entries) { + virtual void OnDocumentFeedFetched(int num_accumulated_entries) { } // Triggered when the feed from the server is loaded. diff --git a/chrome/browser/chromeos/drive/drive_resource_metadata.cc b/chrome/browser/chromeos/drive/drive_resource_metadata.cc index 8ccc28c..01f8720 100644 --- a/chrome/browser/chromeos/drive/drive_resource_metadata.cc +++ b/chrome/browser/chromeos/drive/drive_resource_metadata.cc @@ -236,12 +236,12 @@ void DriveResourceMetadata::ClearRoot() { void DriveResourceMetadata::AddEntryToDirectory( const FilePath& directory_path, - scoped_ptr<google_apis::ResourceEntry> entry, + scoped_ptr<google_apis::ResourceEntry> doc_entry, const FileMoveCallback& callback) { DCHECK(!directory_path.empty()); DCHECK(!callback.is_null()); - if (!entry.get()) { + if (!doc_entry.get()) { PostFileMoveCallbackError(callback, DRIVE_FILE_ERROR_FAILED); return; } @@ -260,7 +260,7 @@ void DriveResourceMetadata::AddEntryToDirectory( AddEntryToDirectoryInternal( directory, - ConvertResourceEntryToDriveEntryProto(*entry), + ConvertResourceEntryToDriveEntryProto(*doc_entry), callback); } @@ -499,19 +499,19 @@ void DriveResourceMetadata::GetEntryInfoPairByPaths( } void DriveResourceMetadata::RefreshFile( - scoped_ptr<google_apis::ResourceEntry> entry, + scoped_ptr<google_apis::ResourceEntry> doc_entry, const GetEntryInfoWithFilePathCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); - if (!entry.get()) { + if (!doc_entry.get()) { PostGetEntryInfoWithFilePathCallbackError( callback, DRIVE_FILE_ERROR_FAILED); return; } RefreshEntryProto(ConvertResourceEntryToDriveEntryProto( - *entry), callback); + *doc_entry), callback); } void DriveResourceMetadata::RefreshEntryProto( diff --git a/chrome/browser/chromeos/drive/drive_resource_metadata.h b/chrome/browser/chromeos/drive/drive_resource_metadata.h index e40476b..f52408c 100644 --- a/chrome/browser/chromeos/drive/drive_resource_metadata.h +++ b/chrome/browser/chromeos/drive/drive_resource_metadata.h @@ -148,11 +148,11 @@ class DriveResourceMetadata { // Sets root directory resource ID and put root to ResourceMap. void InitializeRootEntry(const std::string& id); - // Add |entry| to directory with path |directory_path| and invoke the + // Add |doc entry| to directory with path |directory_path| and invoke the // callback asynchronously. // |callback| must not be null. void AddEntryToDirectory(const FilePath& directory_path, - scoped_ptr<google_apis::ResourceEntry> entry, + scoped_ptr<google_apis::ResourceEntry> doc_entry, const FileMoveCallback& callback); // Add |entry_proto| to the metadata tree, based on its parent_resource_id. @@ -211,11 +211,11 @@ class DriveResourceMetadata { void RefreshEntryProto(const DriveEntryProto& entry_proto, const GetEntryInfoWithFilePathCallback& callback); - // Refresh a drive entry with resource_id that matches that of |entry|, - // with |entry|. + // Refresh a drive entry with resource_id that matches that of |doc_entry|, + // with |doc_entry|. // |callback| must not be null. // TODO(achuith): Deprecate this in favor of RefreshEntryProto above. - void RefreshFile(scoped_ptr<google_apis::ResourceEntry> entry, + void RefreshFile(scoped_ptr<google_apis::ResourceEntry> doc_entry, const GetEntryInfoWithFilePathCallback& callback); // Removes all child files of |directory| and replaces them with diff --git a/chrome/browser/chromeos/drive/drive_test_util.cc b/chrome/browser/chromeos/drive/drive_test_util.cc index 1118f89..1fac533 100644 --- a/chrome/browser/chromeos/drive/drive_test_util.cc +++ b/chrome/browser/chromeos/drive/drive_test_util.cc @@ -139,12 +139,12 @@ bool LoadChangeFeed(const std::string& relative_path, if (document->GetType() != Value::TYPE_DICTIONARY) return false; - scoped_ptr<google_apis::ResourceList> document_feed( - google_apis::ResourceList::ExtractAndParse(*document)); + scoped_ptr<google_apis::DocumentFeed> document_feed( + google_apis::DocumentFeed::ExtractAndParse(*document)); if (!document_feed.get()) return false; - ScopedVector<google_apis::ResourceList> feed_list; + ScopedVector<google_apis::DocumentFeed> feed_list; feed_list.push_back(document_feed.release()); file_system->feed_loader()->UpdateFromFeed( diff --git a/chrome/browser/chromeos/drive/resource_entry_conversion.cc b/chrome/browser/chromeos/drive/resource_entry_conversion.cc index b6b63a0..4ae904b 100644 --- a/chrome/browser/chromeos/drive/resource_entry_conversion.cc +++ b/chrome/browser/chromeos/drive/resource_entry_conversion.cc @@ -16,61 +16,61 @@ namespace drive { DriveEntryProto ConvertResourceEntryToDriveEntryProto( - const google_apis::ResourceEntry& entry) { + const google_apis::ResourceEntry& doc) { DriveEntryProto entry_proto; // For regular files, the 'filename' and 'title' attribute in the metadata // may be different (e.g. due to rename). To be consistent with the web // interface and other client to use the 'title' attribute, instead of // 'filename', as the file name in the local snapshot. - entry_proto.set_title(UTF16ToUTF8(entry.title())); + entry_proto.set_title(UTF16ToUTF8(doc.title())); entry_proto.set_base_name(util::EscapeUtf8FileName(entry_proto.title())); - entry_proto.set_resource_id(entry.resource_id()); - entry_proto.set_content_url(entry.content_url().spec()); + entry_proto.set_resource_id(doc.resource_id()); + entry_proto.set_content_url(doc.content_url().spec()); const google_apis::Link* edit_link = - entry.GetLinkByType(google_apis::Link::LINK_EDIT); + doc.GetLinkByType(google_apis::Link::LINK_EDIT); if (edit_link) entry_proto.set_edit_url(edit_link->href().spec()); const google_apis::Link* parent_link = - entry.GetLinkByType(google_apis::Link::LINK_PARENT); + doc.GetLinkByType(google_apis::Link::LINK_PARENT); if (parent_link) { entry_proto.set_parent_resource_id( util::ExtractResourceIdFromUrl(parent_link->href())); } - entry_proto.set_deleted(entry.deleted()); - entry_proto.set_kind(entry.kind()); + entry_proto.set_deleted(doc.deleted()); + entry_proto.set_kind(doc.kind()); PlatformFileInfoProto* file_info = entry_proto.mutable_file_info(); - file_info->set_last_modified(entry.updated_time().ToInternalValue()); + file_info->set_last_modified(doc.updated_time().ToInternalValue()); // If the file has never been viewed (last_viewed_time().is_null() == true), // then we will set the last_accessed field in the protocol buffer to 0. - file_info->set_last_accessed(entry.last_viewed_time().ToInternalValue()); - file_info->set_creation_time(entry.published_time().ToInternalValue()); + file_info->set_last_accessed(doc.last_viewed_time().ToInternalValue()); + file_info->set_creation_time(doc.published_time().ToInternalValue()); - if (entry.is_file() || entry.is_hosted_document()) { + if (doc.is_file() || doc.is_hosted_document()) { DriveFileSpecificInfo* file_specific_info = entry_proto.mutable_file_specific_info(); - if (entry.is_file()) { - file_info->set_size(entry.file_size()); - file_specific_info->set_file_md5(entry.file_md5()); + if (doc.is_file()) { + file_info->set_size(doc.file_size()); + file_specific_info->set_file_md5(doc.file_md5()); // The resumable-edit-media link should only be present for regular // files as hosted documents are not uploadable. - const google_apis::Link* upload_link = entry.GetLinkByType( + const google_apis::Link* upload_link = doc.GetLinkByType( google_apis::Link::LINK_RESUMABLE_EDIT_MEDIA); if (upload_link && upload_link->href().is_valid()) entry_proto.set_upload_url(upload_link->href().spec()); - } else if (entry.is_hosted_document()) { + } else if (doc.is_hosted_document()) { // Attach .g<something> extension to hosted documents so we can special // case their handling in UI. // TODO(satorux): Figure out better way how to pass entry info like kind // to UI through the File API stack. - const std::string document_extension = entry.GetHostedDocumentExtension(); + const std::string document_extension = doc.GetHostedDocumentExtension(); file_specific_info->set_document_extension(document_extension); entry_proto.set_base_name( util::EscapeUtf8FileName(entry_proto.title() + document_extension)); @@ -80,31 +80,31 @@ DriveEntryProto ConvertResourceEntryToDriveEntryProto( file_info->set_size(0); } file_info->set_is_directory(false); - file_specific_info->set_content_mime_type(entry.content_mime_type()); - file_specific_info->set_is_hosted_document(entry.is_hosted_document()); + file_specific_info->set_content_mime_type(doc.content_mime_type()); + file_specific_info->set_is_hosted_document(doc.is_hosted_document()); - const google_apis::Link* thumbnail_link = entry.GetLinkByType( + const google_apis::Link* thumbnail_link = doc.GetLinkByType( google_apis::Link::LINK_THUMBNAIL); if (thumbnail_link) file_specific_info->set_thumbnail_url(thumbnail_link->href().spec()); - const google_apis::Link* alternate_link = entry.GetLinkByType( + const google_apis::Link* alternate_link = doc.GetLinkByType( google_apis::Link::LINK_ALTERNATE); if (alternate_link) file_specific_info->set_alternate_url(alternate_link->href().spec()); - const google_apis::Link* share_link = entry.GetLinkByType( + const google_apis::Link* share_link = doc.GetLinkByType( google_apis::Link::LINK_SHARE); if (share_link) file_specific_info->set_share_url(share_link->href().spec()); - } else if (entry.is_folder()) { + } else if (doc.is_folder()) { file_info->set_is_directory(true); - const google_apis::Link* upload_link = entry.GetLinkByType( + const google_apis::Link* upload_link = doc.GetLinkByType( google_apis::Link::LINK_RESUMABLE_CREATE_MEDIA); if (upload_link) entry_proto.set_upload_url(upload_link->href().spec()); } else { - // Some resource entries don't map into files (i.e. sites). + // Some document entries don't map into files (i.e. sites). return DriveEntryProto(); } diff --git a/chrome/browser/google_apis/gdata_wapi_parser.cc b/chrome/browser/google_apis/gdata_wapi_parser.cc index 4c386ca..2a786f1 100644 --- a/chrome/browser/google_apis/gdata_wapi_parser.cc +++ b/chrome/browser/google_apis/gdata_wapi_parser.cc @@ -643,7 +643,7 @@ void ResourceEntry::RegisterJSONConverter( kFeedLinkField, &ResourceEntry::feed_links_); converter->RegisterNestedField(kContentField, &ResourceEntry::content_); - // File properties. If the resource type is not a normal file, then + // File properties. If the document type is not a normal file, then // that's no problem because those feed must not have these fields // themselves, which does not report errors. converter->RegisterStringField(kFileNameField, &ResourceEntry::filename_); @@ -783,7 +783,7 @@ scoped_ptr<ResourceEntry> ResourceEntry::CreateFrom(const base::Value& value) { base::JSONValueConverter<ResourceEntry> converter; scoped_ptr<ResourceEntry> entry(new ResourceEntry()); if (!converter.Convert(value, entry.get())) { - DVLOG(1) << "Invalid resource entry!"; + DVLOG(1) << "Invalid document entry!"; return scoped_ptr<ResourceEntry>(); } @@ -969,40 +969,40 @@ std::string ResourceEntry::GetEntryNodeName() { } //////////////////////////////////////////////////////////////////////////////// -// ResourceList implementation +// DocumentFeed implementation -ResourceList::ResourceList() +DocumentFeed::DocumentFeed() : start_index_(0), items_per_page_(0), largest_changestamp_(0) { } -ResourceList::~ResourceList() { +DocumentFeed::~DocumentFeed() { } // static -void ResourceList::RegisterJSONConverter( - base::JSONValueConverter<ResourceList>* converter) { +void DocumentFeed::RegisterJSONConverter( + base::JSONValueConverter<DocumentFeed>* converter) { // inheritance FeedEntry::RegisterJSONConverter( reinterpret_cast<base::JSONValueConverter<FeedEntry>*>(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>( - kStartIndexField, &ResourceList::start_index_, &base::StringToInt); + kStartIndexField, &DocumentFeed::start_index_, &base::StringToInt); converter->RegisterCustomField<int>( - kItemsPerPageField, &ResourceList::items_per_page_, &base::StringToInt); - converter->RegisterStringField(kTitleTField, &ResourceList::title_); - converter->RegisterRepeatedMessage(kEntryField, &ResourceList::entries_); + kItemsPerPageField, &DocumentFeed::items_per_page_, &base::StringToInt); + converter->RegisterStringField(kTitleTField, &DocumentFeed::title_); + converter->RegisterRepeatedMessage(kEntryField, &DocumentFeed::entries_); converter->RegisterCustomField<int64>( - kLargestChangestampField, &ResourceList::largest_changestamp_, + kLargestChangestampField, &DocumentFeed::largest_changestamp_, &base::StringToInt64); } -bool ResourceList::Parse(const base::Value& value) { - base::JSONValueConverter<ResourceList> converter; +bool DocumentFeed::Parse(const base::Value& value) { + base::JSONValueConverter<DocumentFeed> converter; if (!converter.Convert(value, this)) { - DVLOG(1) << "Invalid resource list!"; + DVLOG(1) << "Invalid document feed!"; return false; } @@ -1016,32 +1016,32 @@ bool ResourceList::Parse(const base::Value& value) { } // static -scoped_ptr<ResourceList> ResourceList::ExtractAndParse( +scoped_ptr<DocumentFeed> DocumentFeed::ExtractAndParse( const base::Value& value) { const base::DictionaryValue* as_dict = NULL; const base::DictionaryValue* feed_dict = NULL; if (value.GetAsDictionary(&as_dict) && as_dict->GetDictionary(kFeedField, &feed_dict)) { - return ResourceList::CreateFrom(*feed_dict); + return DocumentFeed::CreateFrom(*feed_dict); } - return scoped_ptr<ResourceList>(NULL); + return scoped_ptr<DocumentFeed>(NULL); } // static -scoped_ptr<ResourceList> ResourceList::CreateFrom(const base::Value& value) { - scoped_ptr<ResourceList> feed(new ResourceList()); +scoped_ptr<DocumentFeed> DocumentFeed::CreateFrom(const base::Value& value) { + scoped_ptr<DocumentFeed> feed(new DocumentFeed()); if (!feed->Parse(value)) { - DVLOG(1) << "Invalid resource list!"; - return scoped_ptr<ResourceList>(NULL); + DVLOG(1) << "Invalid document feed!"; + return scoped_ptr<DocumentFeed>(NULL); } return feed.Pass(); } // static -scoped_ptr<ResourceList> ResourceList::CreateFromChangeList( +scoped_ptr<DocumentFeed> DocumentFeed::CreateFromChangeList( const ChangeList& changelist) { - scoped_ptr<ResourceList> feed(new ResourceList()); + scoped_ptr<DocumentFeed> feed(new DocumentFeed()); int64 largest_changestamp = 0; ScopedVector<ChangeResource>::const_iterator iter = changelist.items().begin(); @@ -1056,7 +1056,7 @@ scoped_ptr<ResourceList> ResourceList::CreateFromChangeList( return feed.Pass(); } -bool ResourceList::GetNextFeedURL(GURL* url) const { +bool DocumentFeed::GetNextFeedURL(GURL* url) const { DCHECK(url); for (size_t i = 0; i < links_.size(); ++i) { if (links_[i]->type() == Link::LINK_NEXT) { @@ -1067,7 +1067,7 @@ bool ResourceList::GetNextFeedURL(GURL* url) const { return false; } -void ResourceList::ReleaseEntries(std::vector<ResourceEntry*>* entries) { +void DocumentFeed::ReleaseEntries(std::vector<ResourceEntry*>* entries) { entries_.release(entries); } diff --git a/chrome/browser/google_apis/gdata_wapi_parser.h b/chrome/browser/google_apis/gdata_wapi_parser.h index 5503996..20c3e56 100644 --- a/chrome/browser/google_apis/gdata_wapi_parser.h +++ b/chrome/browser/google_apis/gdata_wapi_parser.h @@ -80,7 +80,7 @@ class Link { // this class. static void RegisterJSONConverter(base::JSONValueConverter<Link>* converter); - // Creates a link entry from parsed XML. + // Creates document entry from parsed XML. static Link* CreateFromXml(XmlReader* xml_reader); // Type of the link. @@ -227,7 +227,7 @@ class Category { DISALLOW_COPY_AND_ASSIGN(Category); }; -// Content details of a resource: mime-type, url, and so on. +// Content details of a document: mime-type, url, and so on. class Content { public: Content(); @@ -297,8 +297,7 @@ class AppIcon { DISALLOW_COPY_AND_ASSIGN(AppIcon); }; -// Base class for feed entries. This class defines fields commonly used by -// various feeds. +// Base class for feed entries. class FeedEntry { public: FeedEntry(); @@ -338,8 +337,7 @@ class FeedEntry { DISALLOW_COPY_AND_ASSIGN(FeedEntry); }; -// This class represents a resource entry. A resource is a generic term which -// refers to a file and a directory. +// Document feed entry. class ResourceEntry : public FeedEntry { public: virtual ~ResourceEntry(); @@ -357,21 +355,21 @@ class ResourceEntry : public FeedEntry { // The caller should delete the returned object. static scoped_ptr<ResourceEntry> ExtractAndParse(const base::Value& value); - // Creates resource entry from parsed JSON Value. You should call + // Creates document entry 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 for the details. static scoped_ptr<ResourceEntry> CreateFrom(const base::Value& value); - // Creates resource entry from parsed XML. + // Creates document entry from parsed XML. static scoped_ptr<ResourceEntry> CreateFromXml(XmlReader* xml_reader); - // Creates resource entry from FileResource. + // Creates document entry from FileResource. // TODO(kochi): This should go away soon. http://crbug.com/142293 static scoped_ptr<ResourceEntry> CreateFromFileResource( const FileResource& file); - // Creates resource entry from ChangeResource. + // Creates document entry from ChangeResource. // Todo(Kochi): This should go away soon. http://crbug.com/142293 static scoped_ptr<ResourceEntry> CreateFromChangeResource( const ChangeResource& change); @@ -396,53 +394,56 @@ class ResourceEntry : public FeedEntry { // Returns true if |file| has one of the hosted document extensions. static bool HasHostedDocumentExtension(const FilePath& file); - // The resource ID is used to identify a resource, which looks like: - // file:d41d8cd98f00b204e9800998ecf8 + // Document entry resource id. const std::string& resource_id() const { return resource_id_; } - // This is a URL looks like: - // https://docs.google.com/feeds/id/file%3Ad41d8cd98f00b204e9800998ecf8. - // The URL is currently not used. + // Document entry id. const std::string& id() const { return id_; } + // Document entry kind. DriveEntryKind kind() const { return kind_; } + + // Document entry title. const string16& title() const { return title_; } + + // Document entry published time. base::Time published_time() const { return published_time_; } + + // Document entry last viewed time. base::Time last_viewed_time() const { return last_viewed_time_; } + + // List of document feed labels. const std::vector<string16>& labels() const { return labels_; } - // Content URL is the main URL of a resource, used to perform - // non-destructive operations like downloading a file. Search for - // 'content_url' in gdata_wapi_operations.h for details. + // Document entry content URL. const GURL& content_url() const { return content_.url(); } + // Document entry MIME type. const std::string& content_mime_type() const { return content_.mime_type(); } - // The feed links contain extra links for revisions and access control, - // etc. Note that links() contain more basic links like edit URL, - // alternatie URL, etc. + // List of document feed links. const ScopedVector<FeedLink>& feed_links() const { return feed_links_; } - // File name (exists only for kinds FILE and PDF). + // Document feed file name (exists only for kinds FILE and PDF). const string16& filename() const { return filename_; } - // Suggested file name (exists only for kinds FILE and PDF). + // Document feed suggested file name (exists only for kinds FILE and PDF). const string16& suggested_filename() const { return suggested_filename_; } - // File content MD5 (exists only for kinds FILE and PDF). + // Document feed file content MD5 (exists only for kinds FILE and PDF). const std::string& file_md5() const { return file_md5_; } - // File size (exists only for kinds FILE and PDF). + // Document feed file size (exists only for kinds FILE and PDF). int64 file_size() const { return file_size_; } - // True if the file or directory is deleted (applicable to change list only). + // True if the file or directory is deleted (applicable to change feeds only). bool deleted() const { return deleted_ || removed_; } // Changestamp (exists only for change query results). // If not exists, defaults to 0. int64 changestamp() const { return changestamp_; } - // Text version of resource entry kind. Returns an empty string for + // Text version of document entry kind. Returns an empty string for // unknown entry kind. std::string GetEntryKindText() const; @@ -450,27 +451,27 @@ class ResourceEntry : public FeedEntry { // a hosted document, this call returns an empty string. std::string GetHostedDocumentExtension() const; - // True if resource entry is remotely hosted. + // True if document entry is remotely hosted. bool is_hosted_document() const { return (ClassifyEntryKind(kind_) & KIND_OF_HOSTED_DOCUMENT) > 0; } - // True if resource entry hosted by Google Documents. + // True if document entry hosted by Google Documents. bool is_google_document() const { return (ClassifyEntryKind(kind_) & KIND_OF_GOOGLE_DOCUMENT) > 0; } - // True if resource entry is hosted by an external application. + // True if document entry is hosted by an external application. bool is_external_document() const { return (ClassifyEntryKind(kind_) & KIND_OF_EXTERNAL_DOCUMENT) > 0; } - // True if resource entry is a folder (collection). + // True if document entry is a folder (collection). bool is_folder() const { return (ClassifyEntryKind(kind_) & KIND_OF_FOLDER) > 0; } - // True if resource entry is regular file. + // True if document entry is regular file. bool is_file() const { return (ClassifyEntryKind(kind_) & KIND_OF_FILE) > 0; } - // True if resource entry can't be mapped to the file system. + // True if document entry can't be mapped to the file system. bool is_special() const { return !is_file() && !is_folder() && !is_hosted_document(); } @@ -495,7 +496,7 @@ class ResourceEntry : public FeedEntry { private: friend class base::internal::RepeatedMessageConverter<ResourceEntry>; - friend class ResourceList; + friend class DocumentFeed; friend class ResumeUploadOperation; ResourceEntry(); @@ -530,13 +531,12 @@ class ResourceEntry : public FeedEntry { DISALLOW_COPY_AND_ASSIGN(ResourceEntry); }; -// This class represents a list of resource entries with some extra metadata -// 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 { +// Document feed represents a list of entries. 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 DocumentFeed : public FeedEntry { public: - virtual ~ResourceList(); + virtual ~DocumentFeed(); // Extracts "feed" dictionary from the JSON value, and parse the contents, // using CreateFrom(). Returns NULL on failure. The input JSON data, coming @@ -547,50 +547,50 @@ class ResourceList : public FeedEntry { // "feed": { ... }, // This function will extract this and parse. // "version": "1.0" // } - static scoped_ptr<ResourceList> ExtractAndParse(const base::Value& value); + static scoped_ptr<DocumentFeed> ExtractAndParse(const base::Value& value); // 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<ResourceList> CreateFrom(const base::Value& value); + static scoped_ptr<DocumentFeed> CreateFrom(const base::Value& value); // Variant of CreateFrom() above, creates feed from parsed ChangeList. // TODO(kochi): This should go away soon. http://crbug.com/142293 - static scoped_ptr<ResourceList> CreateFromChangeList( + static scoped_ptr<DocumentFeed> CreateFromChangeList( const ChangeList& changelist); // Registers the mapping between JSON field names and the members in // this class. static void RegisterJSONConverter( - base::JSONValueConverter<ResourceList>* converter); + base::JSONValueConverter<DocumentFeed>* converter); // Returns true and passes|url| of the next feed if the current entry list // does not completed this feed. bool GetNextFeedURL(GURL* url) const; - // List of resource entries. + // List of document entries. const ScopedVector<ResourceEntry>& entries() const { return entries_; } // Releases entries_ into |entries|. This is a transfer of ownership, so the // caller is responsible for deleting the elements of |entries|. void ReleaseEntries(std::vector<ResourceEntry*>* entries); - // Start index of the resource entry list. + // Start index of the document entry list. int start_index() const { return start_index_; } - // Number of items per feed of the resource entry list. + // Number of items per feed of the document entry list. int items_per_page() const { return items_per_page_; } - // The largest changestamp. Next time the resource list should be fetched + // The largest changestamp. Next time the documents should be fetched // from this changestamp. int64 largest_changestamp() const { return largest_changestamp_; } - // Resource entry list title. + // Document entry list title. const std::string& title() { return title_; } private: - ResourceList(); + DocumentFeed(); // Parses and initializes data members from content of |value|. // Return false if parsing fails. @@ -602,7 +602,7 @@ class ResourceList : public FeedEntry { std::string title_; int64 largest_changestamp_; - DISALLOW_COPY_AND_ASSIGN(ResourceList); + DISALLOW_COPY_AND_ASSIGN(DocumentFeed); }; // Metadata representing installed Google Drive application. diff --git a/chrome/browser/google_apis/gdata_wapi_parser_unittest.cc b/chrome/browser/google_apis/gdata_wapi_parser_unittest.cc index b34f97e..aa85102 100644 --- a/chrome/browser/google_apis/gdata_wapi_parser_unittest.cc +++ b/chrome/browser/google_apis/gdata_wapi_parser_unittest.cc @@ -57,13 +57,13 @@ class GDataWAPIParserTest : public testing::Test { // TODO(nhiroki): Move json files to out of 'chromeos' directory // (http://crbug.com/149788). // Test document feed parsing. -TEST_F(GDataWAPIParserTest, ResourceListJsonParser) { +TEST_F(GDataWAPIParserTest, DocumentFeedJsonParser) { std::string error; scoped_ptr<Value> document = test_util::LoadJSONFile("gdata/basic_feed.json"); ASSERT_TRUE(document.get()); ASSERT_EQ(Value::TYPE_DICTIONARY, document->GetType()); - scoped_ptr<ResourceList> feed(ResourceList::ExtractAndParse(*document)); + scoped_ptr<DocumentFeed> feed(DocumentFeed::ExtractAndParse(*document)); ASSERT_TRUE(feed.get()); base::Time update_time; 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 b9e66c0..0ecec26 100644 --- a/chrome/browser/sync_file_system/drive_file_sync_client.cc +++ b/chrome/browser/sync_file_system/drive_file_sync_client.cc @@ -150,7 +150,7 @@ void DriveFileSyncClient::DidGetDirectory( const std::string& directory_name, const ResourceIdCallback& callback, google_apis::GDataErrorCode error, - scoped_ptr<google_apis::ResourceList> feed) { + scoped_ptr<google_apis::DocumentFeed> feed) { DCHECK(CalledOnValidThread()); DCHECK(IsStringASCII(directory_name)); @@ -276,7 +276,7 @@ void DriveFileSyncClient::DidGetAccountMetadata( void DriveFileSyncClient::SearchFilesInDirectory( const std::string& directory_resource_id, const std::string& search_query, - const ResourceListCallback& callback) { + const DocumentFeedCallback& callback) { DCHECK(CalledOnValidThread()); drive_service_->GetResourceList( GURL(), // feed_url @@ -284,12 +284,12 @@ void DriveFileSyncClient::SearchFilesInDirectory( search_query, false, // shared_with_me directory_resource_id, - base::Bind(&DriveFileSyncClient::DidGetResourceListData, + base::Bind(&DriveFileSyncClient::DidGetDocumentFeedData, AsWeakPtr(), callback)); } void DriveFileSyncClient::ListFiles(const std::string& directory_resource_id, - const ResourceListCallback& callback) { + const DocumentFeedCallback& callback) { DCHECK(CalledOnValidThread()); SearchFilesInDirectory(directory_resource_id, std::string() /* search_query */, @@ -297,7 +297,7 @@ void DriveFileSyncClient::ListFiles(const std::string& directory_resource_id, } void DriveFileSyncClient::ListChanges(int64 start_changestamp, - const ResourceListCallback& callback) { + const DocumentFeedCallback& callback) { DCHECK(CalledOnValidThread()); drive_service_->GetResourceList( GURL(), // feed_url @@ -305,13 +305,13 @@ void DriveFileSyncClient::ListChanges(int64 start_changestamp, std::string(), // search_query false, // shared_with_me std::string(), // directory_resource_id - base::Bind(&DriveFileSyncClient::DidGetResourceListData, + base::Bind(&DriveFileSyncClient::DidGetDocumentFeedData, AsWeakPtr(), callback)); } void DriveFileSyncClient::ContinueListing( const GURL& feed_url, - const ResourceListCallback& callback) { + const DocumentFeedCallback& callback) { DCHECK(CalledOnValidThread()); drive_service_->GetResourceList( feed_url, @@ -319,7 +319,7 @@ void DriveFileSyncClient::ContinueListing( std::string(), // search_query false, // shared_with_me std::string(), // directory_resource_id - base::Bind(&DriveFileSyncClient::DidGetResourceListData, + base::Bind(&DriveFileSyncClient::DidGetDocumentFeedData, AsWeakPtr(), callback)); } @@ -412,20 +412,20 @@ void DriveFileSyncClient::OnConnectionTypeChanged( observers_, OnNetworkConnected()); } -void DriveFileSyncClient::DidGetResourceListData( - const ResourceListCallback& callback, +void DriveFileSyncClient::DidGetDocumentFeedData( + const DocumentFeedCallback& callback, google_apis::GDataErrorCode error, scoped_ptr<base::Value> data) { DCHECK(CalledOnValidThread()); if (error != google_apis::HTTP_SUCCESS) { - callback.Run(error, scoped_ptr<google_apis::ResourceList>()); + callback.Run(error, scoped_ptr<google_apis::DocumentFeed>()); return; } DCHECK(data); - scoped_ptr<google_apis::ResourceList> feed( - google_apis::ResourceList::ExtractAndParse(*data)); + scoped_ptr<google_apis::DocumentFeed> feed( + google_apis::DocumentFeed::ExtractAndParse(*data)); if (!feed) error = google_apis::GDATA_PARSE_ERROR; callback.Run(error, feed.Pass()); 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 78ea658..b69d6bb 100644 --- a/chrome/browser/sync_file_system/drive_file_sync_client.h +++ b/chrome/browser/sync_file_system/drive_file_sync_client.h @@ -63,8 +63,8 @@ class DriveFileSyncClient typedef base::Callback<void(google_apis::GDataErrorCode error, int64 changestamp)> ChangeStampCallback; typedef base::Callback<void(google_apis::GDataErrorCode error, - scoped_ptr<google_apis::ResourceList> feed)> - ResourceListCallback; + scoped_ptr<google_apis::DocumentFeed> feed)> + DocumentFeedCallback; typedef base::Callback<void(google_apis::GDataErrorCode error, scoped_ptr<google_apis::ResourceEntry> entry)> ResourceEntryCallback; @@ -110,7 +110,7 @@ class DriveFileSyncClient // to call ContunueListing with the result of GetNextFeedURL to get complete // list of files. void ListFiles(const std::string& directory_resource_id, - const ResourceListCallback& callback); + const DocumentFeedCallback& callback); // Lists changes that happened after |start_changestamp|. // Upon completion, invokes |callback|. @@ -118,12 +118,12 @@ class DriveFileSyncClient // to call ContunueListing with the result of GetNextFeedURL to get complete // list of changes. void ListChanges(int64 start_changestamp, - const ResourceListCallback& callback); + const DocumentFeedCallback& callback); - // Fetches the next chunk of ResourceList identified by |feed_url|. + // Fetches the next chunk of DocumentFeed identified by |feed_url|. // Upon completion, invokes |callback|. void ContinueListing(const GURL& feed_url, - const ResourceListCallback& callback); + const DocumentFeedCallback& callback); // Downloads the file identified by |resource_id| from Drive to // |local_file_path|. @@ -199,7 +199,7 @@ class DriveFileSyncClient const std::string& directory_name, const ResourceIdCallback& callback, google_apis::GDataErrorCode error, - scoped_ptr<google_apis::ResourceList> feed); + scoped_ptr<google_apis::DocumentFeed> feed); void DidGetParentDirectoryForCreateDirectory( const FilePath::StringType& directory_name, @@ -213,13 +213,13 @@ class DriveFileSyncClient void SearchFilesInDirectory(const std::string& directory_resource_id, const std::string& search_query, - const ResourceListCallback& callback); + const DocumentFeedCallback& callback); void DidGetAccountMetadata(const ChangeStampCallback& callback, google_apis::GDataErrorCode error, scoped_ptr<base::Value> data); - void DidGetResourceListData(const ResourceListCallback& callback, + void DidGetDocumentFeedData(const DocumentFeedCallback& callback, google_apis::GDataErrorCode error, scoped_ptr<base::Value> data); 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 33ef4f8..3679380 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 @@ -22,7 +22,7 @@ using ::testing::StrictMock; using ::testing::_; using google_apis::ResourceEntry; -using google_apis::ResourceList; +using google_apis::DocumentFeed; using google_apis::DriveServiceInterface; using google_apis::DriveUploaderInterface; using google_apis::GDataErrorCode; @@ -254,11 +254,11 @@ void DidGetLargestChangeStamp(bool* done_out, *largest_changestamp_out = largest_changestamp; } -void DidGetResourceList(bool* done_out, +void DidGetDocumentFeed(bool* done_out, GDataErrorCode* error_out, - scoped_ptr<ResourceList>* document_feed_out, + scoped_ptr<DocumentFeed>* document_feed_out, GDataErrorCode error, - scoped_ptr<ResourceList> document_feed) { + scoped_ptr<DocumentFeed> document_feed) { EXPECT_FALSE(*done_out); *done_out = true; *error_out = error; @@ -507,9 +507,9 @@ TEST_F(DriveFileSyncClientTest, ListFiles) { bool done = false; GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; - scoped_ptr<ResourceList> document_feed; + scoped_ptr<DocumentFeed> document_feed; sync_client()->ListFiles(kDirectoryResourceId, - base::Bind(&DidGetResourceList, + base::Bind(&DidGetDocumentFeed, &done, &error, &document_feed)); message_loop()->RunUntilIdle(); @@ -521,7 +521,7 @@ TEST_F(DriveFileSyncClientTest, ListFiles) { error = google_apis::GDATA_OTHER_ERROR; document_feed.reset(); sync_client()->ContinueListing(kFeedURL, - base::Bind(&DidGetResourceList, + base::Bind(&DidGetDocumentFeed, &done, &error, &document_feed)); message_loop()->RunUntilIdle(); @@ -568,9 +568,9 @@ TEST_F(DriveFileSyncClientTest, ListChanges) { bool done = false; GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; - scoped_ptr<ResourceList> document_feed; + scoped_ptr<DocumentFeed> document_feed; sync_client()->ListFiles(kDirectoryResourceId, - base::Bind(&DidGetResourceList, + base::Bind(&DidGetDocumentFeed, &done, &error, &document_feed)); message_loop()->RunUntilIdle(); @@ -582,7 +582,7 @@ TEST_F(DriveFileSyncClientTest, ListChanges) { error = google_apis::GDATA_OTHER_ERROR; document_feed.reset(); sync_client()->ListChanges(kStartChangestamp, - base::Bind(&DidGetResourceList, + base::Bind(&DidGetDocumentFeed, &done, &error, &document_feed)); message_loop()->RunUntilIdle(); diff --git a/chrome/browser/sync_file_system/drive_file_sync_service.cc b/chrome/browser/sync_file_system/drive_file_sync_service.cc index 5450eb0..35fb4d8 100644 --- a/chrome/browser/sync_file_system/drive_file_sync_service.cc +++ b/chrome/browser/sync_file_system/drive_file_sync_service.cc @@ -862,7 +862,7 @@ void DriveFileSyncService::DidGetDirectoryContentForBatchSync( const GURL& origin, int64 largest_changestamp, google_apis::GDataErrorCode error, - scoped_ptr<google_apis::ResourceList> feed) { + scoped_ptr<google_apis::DocumentFeed> feed) { if (error != google_apis::HTTP_SUCCESS) { pending_batch_sync_origins_.insert(origin); // TODO(tzik): Refine this error code. @@ -1594,7 +1594,7 @@ void DriveFileSyncService::DidFetchChangesForIncrementalSync( scoped_ptr<TaskToken> token, bool has_new_changes, google_apis::GDataErrorCode error, - scoped_ptr<google_apis::ResourceList> changes) { + scoped_ptr<google_apis::DocumentFeed> changes) { if (error != google_apis::HTTP_SUCCESS) { NotifyTaskDone(GDataErrorCodeToSyncStatusCodeWrapper(error), token.Pass()); return; diff --git a/chrome/browser/sync_file_system/drive_file_sync_service.h b/chrome/browser/sync_file_system/drive_file_sync_service.h index 9e956e2..e731619 100644 --- a/chrome/browser/sync_file_system/drive_file_sync_service.h +++ b/chrome/browser/sync_file_system/drive_file_sync_service.h @@ -24,7 +24,7 @@ #include "webkit/fileapi/syncable/sync_callbacks.h" namespace google_apis { -class ResourceList; +class DocumentFeed; } namespace tracked_objects { @@ -251,7 +251,7 @@ class DriveFileSyncService const GURL& origin, int64 largest_changestamp, google_apis::GDataErrorCode error, - scoped_ptr<google_apis::ResourceList> feed); + scoped_ptr<google_apis::DocumentFeed> feed); void DidRemoveOriginOnMetadataStore( scoped_ptr<TaskToken> token, const fileapi::SyncStatusCallback& callback, @@ -330,7 +330,7 @@ class DriveFileSyncService scoped_ptr<TaskToken> token, bool has_new_changes, google_apis::GDataErrorCode error, - scoped_ptr<google_apis::ResourceList> changes); + scoped_ptr<google_apis::DocumentFeed> changes); bool GetOriginForEntry(const google_apis::ResourceEntry& entry, GURL* origin); void SchedulePolling(); |