diff options
author | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-10 12:01:01 +0000 |
---|---|---|
committer | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-10 12:01:01 +0000 |
commit | 2d2755e700a72839353c3e1edd1659fa3452b6c7 (patch) | |
tree | f7cfe4af9ca5a3484dc38cf46519990aeb733b53 /chrome/browser/chromeos/drive | |
parent | 5fdd6d292b9b7d7894d738986fca23869565dd68 (diff) | |
download | chromium_src-2d2755e700a72839353c3e1edd1659fa3452b6c7.zip chromium_src-2d2755e700a72839353c3e1edd1659fa3452b6c7.tar.gz chromium_src-2d2755e700a72839353c3e1edd1659fa3452b6c7.tar.bz2 |
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
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@172038 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/drive')
12 files changed, 97 insertions, 96 deletions
diff --git a/chrome/browser/chromeos/drive/drive_feed_loader.cc b/chrome/browser/chromeos/drive/drive_feed_loader.cc index b13f21e..88ec101 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::DocumentFeed from |data|. -scoped_ptr<google_apis::DocumentFeed> ParseFeedOnBlockingPool( +// Parses a google_apis::ResourceList from |data|. +scoped_ptr<google_apis::ResourceList> ParseFeedOnBlockingPool( scoped_ptr<base::Value> data) { - return google_apis::DocumentFeed::ExtractAndParse(*data); + return google_apis::ResourceList::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::DocumentFeed> feed_list; + ScopedVector<google_apis::ResourceList> feed_list; scoped_ptr<GetResourceListUiState> ui_state; }; @@ -221,7 +221,7 @@ struct DriveFeedLoader::UpdateMetadataParams { const FileOperationCallback callback; }; -// Defines set of parameters sent to callback OnNotifyDocumentFeedFetched(). +// Defines set of parameters sent to callback OnNotifyResourceListFetched(). // 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::DocumentFeed>& feed_list, + const ScopedVector<google_apis::ResourceList>& 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::DocumentFeed> current_feed) { + scoped_ptr<google_apis::ResourceList> 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::OnNotifyDocumentFeedFetched, + base::Bind(&DriveFeedLoader::OnNotifyResourceListFetched, 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_, - OnDocumentFeedFetched(num_accumulated_entries)); + OnResourceListFetched(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::DocumentFeed> feed = - google_apis::DocumentFeed::CreateFromChangeList(*current_feed); + scoped_ptr<google_apis::ResourceList> feed = + google_apis::ResourceList::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::OnNotifyDocumentFeedFetched, + base::Bind(&DriveFeedLoader::OnNotifyResourceListFetched, 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_, - OnDocumentFeedFetched(num_accumulated_entries)); + OnResourceListFetched(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::OnNotifyDocumentFeedFetched( +void DriveFeedLoader::OnNotifyResourceListFetched( base::WeakPtr<GetResourceListUiState> ui_state) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -703,7 +703,7 @@ void DriveFeedLoader::OnNotifyDocumentFeedFetched( ui_state->num_fetched_documents) { ui_state->num_showing_documents += kFetchUiUpdateStep; FOR_EACH_OBSERVER(DriveFeedLoaderObserver, observers_, - OnDocumentFeedFetched(ui_state->num_showing_documents)); + OnResourceListFetched(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::OnNotifyDocumentFeedFetched( base::MessageLoopProxy::current()->PostDelayedTask( FROM_HERE, - base::Bind(&DriveFeedLoader::OnNotifyDocumentFeedFetched, + base::Bind(&DriveFeedLoader::OnNotifyResourceListFetched, 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::DocumentFeed>& feed_list, + const ScopedVector<google_apis::ResourceList>& 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 af2d2e9..415360f 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 DocumentFeed; +class ResourceList; } 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::DocumentFeed>& feed_list, + void(const ScopedVector<google_apis::ResourceList>& 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::DocumentFeed>& feed_list, + void UpdateFromFeed(const ScopedVector<google_apis::ResourceList>& 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::DocumentFeed>& feed_list, + const ScopedVector<google_apis::ResourceList>& 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::DocumentFeed> current_feed); + scoped_ptr<google_apis::ResourceList> 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 OnNotifyDocumentFeedFetched( + void OnNotifyResourceListFetched( 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 b42f21f..7232a78 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 document feed is fetched. |num_accumulated_entries| + // Triggered when a resource list is fetched. |num_accumulated_entries| // tells the number of entries fetched so far. - virtual void OnDocumentFeedFetched(int num_accumulated_entries) { + virtual void OnResourceListFetched(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 5caaff3..adccb69 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::DocumentFeed>& feed_list, + const ScopedVector<google_apis::ResourceList>& 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::DocumentFeed>& feed_list, + const ScopedVector<google_apis::ResourceList>& 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::DocumentFeed* feed = feed_list[i]; + const google_apis::ResourceList* feed = feed_list[i]; // Get upload url from the root feed. Links for all other collections will // be handled in ConvertResourceEntryToDriveEntryProto. @@ -317,8 +317,9 @@ void DriveFeedProcessor::FeedToEntryProtoMap( } for (size_t j = 0; j < feed->entries().size(); ++j) { - const google_apis::ResourceEntry* doc = feed->entries()[j]; - DriveEntryProto entry_proto = ConvertResourceEntryToDriveEntryProto(*doc); + const google_apis::ResourceEntry* entry = feed->entries()[j]; + DriveEntryProto entry_proto = + ConvertResourceEntryToDriveEntryProto(*entry); // 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 81b790e..11766a2 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::DocumentFeed>& feed_list, + const ScopedVector<google_apis::ResourceList>& 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::DocumentFeed>& feed_list, + const ScopedVector<google_apis::ResourceList>& 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 c1955059..6ece3d8 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> doc_entry; + scoped_ptr<google_apis::ResourceEntry> entry; if (!google_apis::util::IsDriveV2ApiEnabled()) { - doc_entry = google_apis::ResourceEntry::ExtractAndParse(*data); + entry = google_apis::ResourceEntry::ExtractAndParse(*data); } else { scoped_ptr<google_apis::FileResource> file_resource = google_apis::FileResource::CreateFrom(*data); - doc_entry = google_apis::ResourceEntry::CreateFromFileResource( + entry = google_apis::ResourceEntry::CreateFromFileResource( *file_resource); } - GURL content_url = doc_entry->content_url(); - int64 file_size = doc_entry->file_size(); + GURL content_url = entry->content_url(); + int64 file_size = 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, doc_entry->resource_id()); + DCHECK_EQ(params.resource_id, entry->resource_id()); resource_metadata_->RefreshFile( - doc_entry.Pass(), + 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::DocumentFeed>& feed_list, + const ScopedVector<google_apis::ResourceList>& 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::DocumentFeed>& feed_list, + const ScopedVector<google_apis::ResourceList>& 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::DocumentFeed* feed = feed_list[0]; + const google_apis::ResourceList* 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::OnDocumentFeedFetched(int num_accumulated_entries) { +void DriveFileSystem::OnResourceListFetched(int num_accumulated_entries) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); FOR_EACH_OBSERVER(DriveFileSystemObserver, observers_, - OnDocumentFeedFetched(num_accumulated_entries)); + OnResourceListFetched(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> doc_entry, + scoped_ptr<google_apis::ResourceEntry> entry, const FilePath& file_content_path, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - DCHECK(doc_entry.get()); - DCHECK(!doc_entry->resource_id().empty()); - DCHECK(!doc_entry->file_md5().empty()); + DCHECK(entry.get()); + DCHECK(!entry->resource_id().empty()); + DCHECK(!entry->file_md5().empty()); DCHECK(!callback.is_null()); AddUploadedFileParams params(file_content_path, callback, - doc_entry->resource_id(), - doc_entry->file_md5()); + entry->resource_id(), + entry->file_md5()); resource_metadata_->AddEntryToDirectory( directory_path, - doc_entry.Pass(), + 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 ab529bc..1dc81a1 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 DocumentFeed; +class ResourceList; 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 OnDocumentFeedFetched(int num_accumulated_entries) OVERRIDE; + virtual void OnResourceListFetched(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::DocumentFeed>& feed_list, + const ScopedVector<google_apis::ResourceList>& 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::DocumentFeed>& feed_list, + const ScopedVector<google_apis::ResourceList>& 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 a97f3383..4bc1520 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 OnDocumentFeedFetched(int num_accumulated_entries) { + virtual void OnResourceListFetched(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 01f8720..8ccc28c 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> doc_entry, + scoped_ptr<google_apis::ResourceEntry> entry, const FileMoveCallback& callback) { DCHECK(!directory_path.empty()); DCHECK(!callback.is_null()); - if (!doc_entry.get()) { + if (!entry.get()) { PostFileMoveCallbackError(callback, DRIVE_FILE_ERROR_FAILED); return; } @@ -260,7 +260,7 @@ void DriveResourceMetadata::AddEntryToDirectory( AddEntryToDirectoryInternal( directory, - ConvertResourceEntryToDriveEntryProto(*doc_entry), + ConvertResourceEntryToDriveEntryProto(*entry), callback); } @@ -499,19 +499,19 @@ void DriveResourceMetadata::GetEntryInfoPairByPaths( } void DriveResourceMetadata::RefreshFile( - scoped_ptr<google_apis::ResourceEntry> doc_entry, + scoped_ptr<google_apis::ResourceEntry> entry, const GetEntryInfoWithFilePathCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); - if (!doc_entry.get()) { + if (!entry.get()) { PostGetEntryInfoWithFilePathCallbackError( callback, DRIVE_FILE_ERROR_FAILED); return; } RefreshEntryProto(ConvertResourceEntryToDriveEntryProto( - *doc_entry), callback); + *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 f52408c..e40476b 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 |doc entry| to directory with path |directory_path| and invoke the + // Add |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> doc_entry, + scoped_ptr<google_apis::ResourceEntry> 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 |doc_entry|, - // with |doc_entry|. + // Refresh a drive entry with resource_id that matches that of |entry|, + // with |entry|. // |callback| must not be null. // TODO(achuith): Deprecate this in favor of RefreshEntryProto above. - void RefreshFile(scoped_ptr<google_apis::ResourceEntry> doc_entry, + void RefreshFile(scoped_ptr<google_apis::ResourceEntry> 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 1fac533..1118f89 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::DocumentFeed> document_feed( - google_apis::DocumentFeed::ExtractAndParse(*document)); + scoped_ptr<google_apis::ResourceList> document_feed( + google_apis::ResourceList::ExtractAndParse(*document)); if (!document_feed.get()) return false; - ScopedVector<google_apis::DocumentFeed> feed_list; + ScopedVector<google_apis::ResourceList> 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 4ae904b..b6b63a0 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& doc) { + const google_apis::ResourceEntry& entry) { 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(doc.title())); + entry_proto.set_title(UTF16ToUTF8(entry.title())); entry_proto.set_base_name(util::EscapeUtf8FileName(entry_proto.title())); - entry_proto.set_resource_id(doc.resource_id()); - entry_proto.set_content_url(doc.content_url().spec()); + entry_proto.set_resource_id(entry.resource_id()); + entry_proto.set_content_url(entry.content_url().spec()); const google_apis::Link* edit_link = - doc.GetLinkByType(google_apis::Link::LINK_EDIT); + entry.GetLinkByType(google_apis::Link::LINK_EDIT); if (edit_link) entry_proto.set_edit_url(edit_link->href().spec()); const google_apis::Link* parent_link = - doc.GetLinkByType(google_apis::Link::LINK_PARENT); + entry.GetLinkByType(google_apis::Link::LINK_PARENT); if (parent_link) { entry_proto.set_parent_resource_id( util::ExtractResourceIdFromUrl(parent_link->href())); } - entry_proto.set_deleted(doc.deleted()); - entry_proto.set_kind(doc.kind()); + entry_proto.set_deleted(entry.deleted()); + entry_proto.set_kind(entry.kind()); PlatformFileInfoProto* file_info = entry_proto.mutable_file_info(); - file_info->set_last_modified(doc.updated_time().ToInternalValue()); + file_info->set_last_modified(entry.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(doc.last_viewed_time().ToInternalValue()); - file_info->set_creation_time(doc.published_time().ToInternalValue()); + file_info->set_last_accessed(entry.last_viewed_time().ToInternalValue()); + file_info->set_creation_time(entry.published_time().ToInternalValue()); - if (doc.is_file() || doc.is_hosted_document()) { + if (entry.is_file() || entry.is_hosted_document()) { DriveFileSpecificInfo* file_specific_info = entry_proto.mutable_file_specific_info(); - if (doc.is_file()) { - file_info->set_size(doc.file_size()); - file_specific_info->set_file_md5(doc.file_md5()); + if (entry.is_file()) { + file_info->set_size(entry.file_size()); + file_specific_info->set_file_md5(entry.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 = doc.GetLinkByType( + const google_apis::Link* upload_link = entry.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 (doc.is_hosted_document()) { + } else if (entry.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 = doc.GetHostedDocumentExtension(); + const std::string document_extension = entry.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(doc.content_mime_type()); - file_specific_info->set_is_hosted_document(doc.is_hosted_document()); + file_specific_info->set_content_mime_type(entry.content_mime_type()); + file_specific_info->set_is_hosted_document(entry.is_hosted_document()); - const google_apis::Link* thumbnail_link = doc.GetLinkByType( + const google_apis::Link* thumbnail_link = entry.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 = doc.GetLinkByType( + const google_apis::Link* alternate_link = entry.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 = doc.GetLinkByType( + const google_apis::Link* share_link = entry.GetLinkByType( google_apis::Link::LINK_SHARE); if (share_link) file_specific_info->set_share_url(share_link->href().spec()); - } else if (doc.is_folder()) { + } else if (entry.is_folder()) { file_info->set_is_directory(true); - const google_apis::Link* upload_link = doc.GetLinkByType( + const google_apis::Link* upload_link = entry.GetLinkByType( google_apis::Link::LINK_RESUMABLE_CREATE_MEDIA); if (upload_link) entry_proto.set_upload_url(upload_link->href().spec()); } else { - // Some document entries don't map into files (i.e. sites). + // Some resource entries don't map into files (i.e. sites). return DriveEntryProto(); } |