summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/chromeos/drive/drive_feed_loader.cc34
-rw-r--r--chrome/browser/chromeos/drive/drive_feed_loader.h12
-rw-r--r--chrome/browser/chromeos/drive/drive_feed_loader_observer.h4
-rw-r--r--chrome/browser/chromeos/drive/drive_feed_processor.cc11
-rw-r--r--chrome/browser/chromeos/drive/drive_feed_processor.h4
-rw-r--r--chrome/browser/chromeos/drive/drive_file_system.cc38
-rw-r--r--chrome/browser/chromeos/drive/drive_file_system.h8
-rw-r--r--chrome/browser/chromeos/drive/drive_file_system_observer.h2
-rw-r--r--chrome/browser/chromeos/drive/drive_resource_metadata.cc12
-rw-r--r--chrome/browser/chromeos/drive/drive_resource_metadata.h10
-rw-r--r--chrome/browser/chromeos/drive/drive_test_util.cc6
-rw-r--r--chrome/browser/chromeos/drive/resource_entry_conversion.cc52
-rw-r--r--chrome/browser/google_apis/gdata_wapi_parser.cc52
-rw-r--r--chrome/browser/google_apis/gdata_wapi_parser.h102
-rw-r--r--chrome/browser/google_apis/gdata_wapi_parser_unittest.cc4
-rw-r--r--chrome/browser/sync_file_system/drive_file_sync_client.cc26
-rw-r--r--chrome/browser/sync_file_system/drive_file_sync_client.h18
-rw-r--r--chrome/browser/sync_file_system/drive_file_sync_client_unittest.cc20
-rw-r--r--chrome/browser/sync_file_system/drive_file_sync_service.cc4
-rw-r--r--chrome/browser/sync_file_system/drive_file_sync_service.h6
20 files changed, 213 insertions, 212 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();
}
diff --git a/chrome/browser/google_apis/gdata_wapi_parser.cc b/chrome/browser/google_apis/gdata_wapi_parser.cc
index 2a786f1..4c386ca 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 document type is not a normal file, then
+ // File properties. If the resource 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 document entry!";
+ DVLOG(1) << "Invalid resource entry!";
return scoped_ptr<ResourceEntry>();
}
@@ -969,40 +969,40 @@ std::string ResourceEntry::GetEntryNodeName() {
}
////////////////////////////////////////////////////////////////////////////////
-// DocumentFeed implementation
+// ResourceList implementation
-DocumentFeed::DocumentFeed()
+ResourceList::ResourceList()
: start_index_(0),
items_per_page_(0),
largest_changestamp_(0) {
}
-DocumentFeed::~DocumentFeed() {
+ResourceList::~ResourceList() {
}
// static
-void DocumentFeed::RegisterJSONConverter(
- base::JSONValueConverter<DocumentFeed>* converter) {
+void ResourceList::RegisterJSONConverter(
+ base::JSONValueConverter<ResourceList>* 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, &DocumentFeed::start_index_, &base::StringToInt);
+ kStartIndexField, &ResourceList::start_index_, &base::StringToInt);
converter->RegisterCustomField<int>(
- kItemsPerPageField, &DocumentFeed::items_per_page_, &base::StringToInt);
- converter->RegisterStringField(kTitleTField, &DocumentFeed::title_);
- converter->RegisterRepeatedMessage(kEntryField, &DocumentFeed::entries_);
+ kItemsPerPageField, &ResourceList::items_per_page_, &base::StringToInt);
+ converter->RegisterStringField(kTitleTField, &ResourceList::title_);
+ converter->RegisterRepeatedMessage(kEntryField, &ResourceList::entries_);
converter->RegisterCustomField<int64>(
- kLargestChangestampField, &DocumentFeed::largest_changestamp_,
+ kLargestChangestampField, &ResourceList::largest_changestamp_,
&base::StringToInt64);
}
-bool DocumentFeed::Parse(const base::Value& value) {
- base::JSONValueConverter<DocumentFeed> converter;
+bool ResourceList::Parse(const base::Value& value) {
+ base::JSONValueConverter<ResourceList> converter;
if (!converter.Convert(value, this)) {
- DVLOG(1) << "Invalid document feed!";
+ DVLOG(1) << "Invalid resource list!";
return false;
}
@@ -1016,32 +1016,32 @@ bool DocumentFeed::Parse(const base::Value& value) {
}
// static
-scoped_ptr<DocumentFeed> DocumentFeed::ExtractAndParse(
+scoped_ptr<ResourceList> ResourceList::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 DocumentFeed::CreateFrom(*feed_dict);
+ return ResourceList::CreateFrom(*feed_dict);
}
- return scoped_ptr<DocumentFeed>(NULL);
+ return scoped_ptr<ResourceList>(NULL);
}
// static
-scoped_ptr<DocumentFeed> DocumentFeed::CreateFrom(const base::Value& value) {
- scoped_ptr<DocumentFeed> feed(new DocumentFeed());
+scoped_ptr<ResourceList> ResourceList::CreateFrom(const base::Value& value) {
+ scoped_ptr<ResourceList> feed(new ResourceList());
if (!feed->Parse(value)) {
- DVLOG(1) << "Invalid document feed!";
- return scoped_ptr<DocumentFeed>(NULL);
+ DVLOG(1) << "Invalid resource list!";
+ return scoped_ptr<ResourceList>(NULL);
}
return feed.Pass();
}
// static
-scoped_ptr<DocumentFeed> DocumentFeed::CreateFromChangeList(
+scoped_ptr<ResourceList> ResourceList::CreateFromChangeList(
const ChangeList& changelist) {
- scoped_ptr<DocumentFeed> feed(new DocumentFeed());
+ scoped_ptr<ResourceList> feed(new ResourceList());
int64 largest_changestamp = 0;
ScopedVector<ChangeResource>::const_iterator iter =
changelist.items().begin();
@@ -1056,7 +1056,7 @@ scoped_ptr<DocumentFeed> DocumentFeed::CreateFromChangeList(
return feed.Pass();
}
-bool DocumentFeed::GetNextFeedURL(GURL* url) const {
+bool ResourceList::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 DocumentFeed::GetNextFeedURL(GURL* url) const {
return false;
}
-void DocumentFeed::ReleaseEntries(std::vector<ResourceEntry*>* entries) {
+void ResourceList::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 20c3e56..5503996 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 document entry from parsed XML.
+ // Creates a link 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 document: mime-type, url, and so on.
+// Content details of a resource: mime-type, url, and so on.
class Content {
public:
Content();
@@ -297,7 +297,8 @@ class AppIcon {
DISALLOW_COPY_AND_ASSIGN(AppIcon);
};
-// Base class for feed entries.
+// Base class for feed entries. This class defines fields commonly used by
+// various feeds.
class FeedEntry {
public:
FeedEntry();
@@ -337,7 +338,8 @@ class FeedEntry {
DISALLOW_COPY_AND_ASSIGN(FeedEntry);
};
-// Document feed entry.
+// This class represents a resource entry. A resource is a generic term which
+// refers to a file and a directory.
class ResourceEntry : public FeedEntry {
public:
virtual ~ResourceEntry();
@@ -355,21 +357,21 @@ class ResourceEntry : public FeedEntry {
// The caller should delete the returned object.
static scoped_ptr<ResourceEntry> ExtractAndParse(const base::Value& value);
- // Creates document entry from parsed JSON Value. You should call
+ // Creates resource 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 document entry from parsed XML.
+ // Creates resource entry from parsed XML.
static scoped_ptr<ResourceEntry> CreateFromXml(XmlReader* xml_reader);
- // Creates document entry from FileResource.
+ // Creates resource entry from FileResource.
// TODO(kochi): This should go away soon. http://crbug.com/142293
static scoped_ptr<ResourceEntry> CreateFromFileResource(
const FileResource& file);
- // Creates document entry from ChangeResource.
+ // Creates resource entry from ChangeResource.
// Todo(Kochi): This should go away soon. http://crbug.com/142293
static scoped_ptr<ResourceEntry> CreateFromChangeResource(
const ChangeResource& change);
@@ -394,56 +396,53 @@ class ResourceEntry : public FeedEntry {
// Returns true if |file| has one of the hosted document extensions.
static bool HasHostedDocumentExtension(const FilePath& file);
- // Document entry resource id.
+ // The resource ID is used to identify a resource, which looks like:
+ // file:d41d8cd98f00b204e9800998ecf8
const std::string& resource_id() const { return resource_id_; }
- // Document entry id.
+ // This is a URL looks like:
+ // https://docs.google.com/feeds/id/file%3Ad41d8cd98f00b204e9800998ecf8.
+ // The URL is currently not used.
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_; }
- // Document entry content URL.
+ // 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.
const GURL& content_url() const { return content_.url(); }
- // Document entry MIME type.
const std::string& content_mime_type() const { return content_.mime_type(); }
- // List of document feed links.
+ // 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.
const ScopedVector<FeedLink>& feed_links() const { return feed_links_; }
- // Document feed file name (exists only for kinds FILE and PDF).
+ // File name (exists only for kinds FILE and PDF).
const string16& filename() const { return filename_; }
- // Document feed suggested file name (exists only for kinds FILE and PDF).
+ // Suggested file name (exists only for kinds FILE and PDF).
const string16& suggested_filename() const { return suggested_filename_; }
- // Document feed file content MD5 (exists only for kinds FILE and PDF).
+ // File content MD5 (exists only for kinds FILE and PDF).
const std::string& file_md5() const { return file_md5_; }
- // Document feed file size (exists only for kinds FILE and PDF).
+ // 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 feeds only).
+ // True if the file or directory is deleted (applicable to change list 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 document entry kind. Returns an empty string for
+ // Text version of resource entry kind. Returns an empty string for
// unknown entry kind.
std::string GetEntryKindText() const;
@@ -451,27 +450,27 @@ class ResourceEntry : public FeedEntry {
// a hosted document, this call returns an empty string.
std::string GetHostedDocumentExtension() const;
- // True if document entry is remotely hosted.
+ // True if resource entry is remotely hosted.
bool is_hosted_document() const {
return (ClassifyEntryKind(kind_) & KIND_OF_HOSTED_DOCUMENT) > 0;
}
- // True if document entry hosted by Google Documents.
+ // True if resource entry hosted by Google Documents.
bool is_google_document() const {
return (ClassifyEntryKind(kind_) & KIND_OF_GOOGLE_DOCUMENT) > 0;
}
- // True if document entry is hosted by an external application.
+ // True if resource entry is hosted by an external application.
bool is_external_document() const {
return (ClassifyEntryKind(kind_) & KIND_OF_EXTERNAL_DOCUMENT) > 0;
}
- // True if document entry is a folder (collection).
+ // True if resource entry is a folder (collection).
bool is_folder() const {
return (ClassifyEntryKind(kind_) & KIND_OF_FOLDER) > 0;
}
- // True if document entry is regular file.
+ // True if resource entry is regular file.
bool is_file() const {
return (ClassifyEntryKind(kind_) & KIND_OF_FILE) > 0;
}
- // True if document entry can't be mapped to the file system.
+ // True if resource entry can't be mapped to the file system.
bool is_special() const {
return !is_file() && !is_folder() && !is_hosted_document();
}
@@ -496,7 +495,7 @@ class ResourceEntry : public FeedEntry {
private:
friend class base::internal::RepeatedMessageConverter<ResourceEntry>;
- friend class DocumentFeed;
+ friend class ResourceList;
friend class ResumeUploadOperation;
ResourceEntry();
@@ -531,12 +530,13 @@ class ResourceEntry : public FeedEntry {
DISALLOW_COPY_AND_ASSIGN(ResourceEntry);
};
-// 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 {
+// 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 {
public:
- virtual ~DocumentFeed();
+ virtual ~ResourceList();
// 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 DocumentFeed : public FeedEntry {
// "feed": { ... }, // This function will extract this and parse.
// "version": "1.0"
// }
- static scoped_ptr<DocumentFeed> ExtractAndParse(const base::Value& value);
+ static scoped_ptr<ResourceList> 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<DocumentFeed> CreateFrom(const base::Value& value);
+ static scoped_ptr<ResourceList> 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<DocumentFeed> CreateFromChangeList(
+ static scoped_ptr<ResourceList> CreateFromChangeList(
const ChangeList& changelist);
// Registers the mapping between JSON field names and the members in
// this class.
static void RegisterJSONConverter(
- base::JSONValueConverter<DocumentFeed>* converter);
+ base::JSONValueConverter<ResourceList>* 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 document entries.
+ // List of resource 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 document entry list.
+ // Start index of the resource entry list.
int start_index() const { return start_index_; }
- // Number of items per feed of the document entry list.
+ // Number of items per feed of the resource entry list.
int items_per_page() const { return items_per_page_; }
- // The largest changestamp. Next time the documents should be fetched
+ // The largest changestamp. Next time the resource list should be fetched
// from this changestamp.
int64 largest_changestamp() const { return largest_changestamp_; }
- // Document entry list title.
+ // Resource entry list title.
const std::string& title() { return title_; }
private:
- DocumentFeed();
+ ResourceList();
// Parses and initializes data members from content of |value|.
// Return false if parsing fails.
@@ -602,7 +602,7 @@ class DocumentFeed : public FeedEntry {
std::string title_;
int64 largest_changestamp_;
- DISALLOW_COPY_AND_ASSIGN(DocumentFeed);
+ DISALLOW_COPY_AND_ASSIGN(ResourceList);
};
// 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 aa85102..b34f97e 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, DocumentFeedJsonParser) {
+TEST_F(GDataWAPIParserTest, ResourceListJsonParser) {
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<DocumentFeed> feed(DocumentFeed::ExtractAndParse(*document));
+ scoped_ptr<ResourceList> feed(ResourceList::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 0ecec26..b9e66c0 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::DocumentFeed> feed) {
+ scoped_ptr<google_apis::ResourceList> 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 DocumentFeedCallback& callback) {
+ const ResourceListCallback& 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::DidGetDocumentFeedData,
+ base::Bind(&DriveFileSyncClient::DidGetResourceListData,
AsWeakPtr(), callback));
}
void DriveFileSyncClient::ListFiles(const std::string& directory_resource_id,
- const DocumentFeedCallback& callback) {
+ const ResourceListCallback& 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 DocumentFeedCallback& callback) {
+ const ResourceListCallback& 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::DidGetDocumentFeedData,
+ base::Bind(&DriveFileSyncClient::DidGetResourceListData,
AsWeakPtr(), callback));
}
void DriveFileSyncClient::ContinueListing(
const GURL& feed_url,
- const DocumentFeedCallback& callback) {
+ const ResourceListCallback& 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::DidGetDocumentFeedData,
+ base::Bind(&DriveFileSyncClient::DidGetResourceListData,
AsWeakPtr(), callback));
}
@@ -412,20 +412,20 @@ void DriveFileSyncClient::OnConnectionTypeChanged(
observers_, OnNetworkConnected());
}
-void DriveFileSyncClient::DidGetDocumentFeedData(
- const DocumentFeedCallback& callback,
+void DriveFileSyncClient::DidGetResourceListData(
+ const ResourceListCallback& 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::DocumentFeed>());
+ callback.Run(error, scoped_ptr<google_apis::ResourceList>());
return;
}
DCHECK(data);
- scoped_ptr<google_apis::DocumentFeed> feed(
- google_apis::DocumentFeed::ExtractAndParse(*data));
+ scoped_ptr<google_apis::ResourceList> feed(
+ google_apis::ResourceList::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 b69d6bb..78ea658 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::DocumentFeed> feed)>
- DocumentFeedCallback;
+ scoped_ptr<google_apis::ResourceList> feed)>
+ ResourceListCallback;
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 DocumentFeedCallback& callback);
+ const ResourceListCallback& 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 DocumentFeedCallback& callback);
+ const ResourceListCallback& callback);
- // Fetches the next chunk of DocumentFeed identified by |feed_url|.
+ // Fetches the next chunk of ResourceList identified by |feed_url|.
// Upon completion, invokes |callback|.
void ContinueListing(const GURL& feed_url,
- const DocumentFeedCallback& callback);
+ const ResourceListCallback& 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::DocumentFeed> feed);
+ scoped_ptr<google_apis::ResourceList> 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 DocumentFeedCallback& callback);
+ const ResourceListCallback& callback);
void DidGetAccountMetadata(const ChangeStampCallback& callback,
google_apis::GDataErrorCode error,
scoped_ptr<base::Value> data);
- void DidGetDocumentFeedData(const DocumentFeedCallback& callback,
+ void DidGetResourceListData(const ResourceListCallback& 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 3679380..33ef4f8 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::DocumentFeed;
+using google_apis::ResourceList;
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 DidGetDocumentFeed(bool* done_out,
+void DidGetResourceList(bool* done_out,
GDataErrorCode* error_out,
- scoped_ptr<DocumentFeed>* document_feed_out,
+ scoped_ptr<ResourceList>* document_feed_out,
GDataErrorCode error,
- scoped_ptr<DocumentFeed> document_feed) {
+ scoped_ptr<ResourceList> 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<DocumentFeed> document_feed;
+ scoped_ptr<ResourceList> document_feed;
sync_client()->ListFiles(kDirectoryResourceId,
- base::Bind(&DidGetDocumentFeed,
+ base::Bind(&DidGetResourceList,
&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(&DidGetDocumentFeed,
+ base::Bind(&DidGetResourceList,
&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<DocumentFeed> document_feed;
+ scoped_ptr<ResourceList> document_feed;
sync_client()->ListFiles(kDirectoryResourceId,
- base::Bind(&DidGetDocumentFeed,
+ base::Bind(&DidGetResourceList,
&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(&DidGetDocumentFeed,
+ base::Bind(&DidGetResourceList,
&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 35fb4d8..5450eb0 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::DocumentFeed> feed) {
+ scoped_ptr<google_apis::ResourceList> 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::DocumentFeed> changes) {
+ scoped_ptr<google_apis::ResourceList> 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 e731619..9e956e2 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 DocumentFeed;
+class ResourceList;
}
namespace tracked_objects {
@@ -251,7 +251,7 @@ class DriveFileSyncService
const GURL& origin,
int64 largest_changestamp,
google_apis::GDataErrorCode error,
- scoped_ptr<google_apis::DocumentFeed> feed);
+ scoped_ptr<google_apis::ResourceList> 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::DocumentFeed> changes);
+ scoped_ptr<google_apis::ResourceList> changes);
bool GetOriginForEntry(const google_apis::ResourceEntry& entry, GURL* origin);
void SchedulePolling();