diff options
author | tzik@google.com <tzik@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-22 09:30:28 +0000 |
---|---|---|
committer | tzik@google.com <tzik@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-22 09:30:28 +0000 |
commit | fb0fc20c8a2c6efe7fdedac1ceb340c22fe95efc (patch) | |
tree | a2d1cbf3859dc74f7f82b28fb85c4cb498cc097e /chrome/browser | |
parent | 8046f202114590cfd16e4c2ee51a74e7fe097804 (diff) | |
download | chromium_src-fb0fc20c8a2c6efe7fdedac1ceb340c22fe95efc.zip chromium_src-fb0fc20c8a2c6efe7fdedac1ceb340c22fe95efc.tar.gz chromium_src-fb0fc20c8a2c6efe7fdedac1ceb340c22fe95efc.tar.bz2 |
Rename namespace 'gdata' to 'google_apis', since it is now now irrelevant.
BUG=155469
TBR=estade@chromium.org
Review URL: https://codereview.chromium.org/11180002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163248 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
101 files changed, 1273 insertions, 1160 deletions
diff --git a/chrome/browser/chromeos/contacts/contact_database_unittest.cc b/chrome/browser/chromeos/contacts/contact_database_unittest.cc index 751bd02..af7b818 100644 --- a/chrome/browser/chromeos/contacts/contact_database_unittest.cc +++ b/chrome/browser/chromeos/contacts/contact_database_unittest.cc @@ -108,8 +108,8 @@ class ContactDatabaseTest : public testing::Test { void OnDatabaseInitialized(bool success) { CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); CHECK(success); - // TODO(derat): Move gdata::test::RunBlockingPoolTask() to a shared location - // and use it for these tests. + // TODO(derat): Move google_apis::test::RunBlockingPoolTask() to a shared + // location and use it for these tests. message_loop_.Quit(); } diff --git a/chrome/browser/chromeos/contacts/gdata_contacts_service.cc b/chrome/browser/chromeos/contacts/gdata_contacts_service.cc index a01881d..29206c1 100644 --- a/chrome/browser/chromeos/contacts/gdata_contacts_service.cc +++ b/chrome/browser/chromeos/contacts/gdata_contacts_service.cc @@ -268,7 +268,7 @@ bool FillContactFromDictionary(const base::DictionaryValue& dict, std::string updated; if (dict.GetString(kUpdatedField, &updated)) { base::Time update_time; - if (!gdata::util::GetTimeFromString(updated, &update_time)) { + if (!google_apis::util::GetTimeFromString(updated, &update_time)) { LOG(WARNING) << "Unable to parse time \"" << updated << "\""; return false; } @@ -435,7 +435,7 @@ struct ContactGroups { class GDataContactsService::DownloadContactsRequest { public: DownloadContactsRequest(GDataContactsService* service, - gdata::OperationRunner* runner, + google_apis::OperationRunner* runner, SuccessCallback success_callback, FailureCallback failure_callback, const base::Time& min_update_time) @@ -475,8 +475,8 @@ class GDataContactsService::DownloadContactsRequest { if (!my_contacts_group_id_.empty()) { StartContactsDownload(); } else { - gdata::GetContactGroupsOperation* operation = - new gdata::GetContactGroupsOperation( + google_apis::GetContactGroupsOperation* operation = + new google_apis::GetContactGroupsOperation( runner_->operation_registry(), base::Bind(&DownloadContactsRequest::HandleGroupsFeedData, weak_ptr_factory_.GetWeakPtr())); @@ -550,10 +550,10 @@ class GDataContactsService::DownloadContactsRequest { // Callback for GetContactGroupsOperation calls. Starts downloading the // actual contacts after finding the "My Contacts" group ID. - void HandleGroupsFeedData(gdata::GDataErrorCode error, + void HandleGroupsFeedData(google_apis::GDataErrorCode error, scoped_ptr<base::Value> feed_data) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (error != gdata::HTTP_SUCCESS) { + if (error != google_apis::HTTP_SUCCESS) { LOG(WARNING) << "Got error " << error << " while downloading groups"; ReportFailure(HISTOGRAM_RESULT_GROUPS_DOWNLOAD_FAILURE); return; @@ -582,8 +582,8 @@ class GDataContactsService::DownloadContactsRequest { // Starts a download of the contacts from the "My Contacts" group. void StartContactsDownload() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - gdata::GetContactsOperation* operation = - new gdata::GetContactsOperation( + google_apis::GetContactsOperation* operation = + new google_apis::GetContactsOperation( runner_->operation_registry(), my_contacts_group_id_, min_update_time_, @@ -597,10 +597,10 @@ class GDataContactsService::DownloadContactsRequest { } // Callback for GetContactsOperation calls. - void HandleContactsFeedData(gdata::GDataErrorCode error, + void HandleContactsFeedData(google_apis::GDataErrorCode error, scoped_ptr<base::Value> feed_data) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (error != gdata::HTTP_SUCCESS) { + if (error != google_apis::HTTP_SUCCESS) { LOG(WARNING) << "Got error " << error << " while downloading contacts"; ReportFailure(HISTOGRAM_RESULT_CONTACTS_DOWNLOAD_FAILURE); return; @@ -739,7 +739,7 @@ class GDataContactsService::DownloadContactsRequest { VLOG(1) << "Starting download of photo " << url << " for " << contact->contact_id(); runner_->StartOperationWithRetry( - new gdata::GetContactPhotoOperation( + new google_apis::GetContactPhotoOperation( runner_->operation_registry(), GURL(url), base::Bind(&DownloadContactsRequest::HandlePhotoData, @@ -752,15 +752,15 @@ class GDataContactsService::DownloadContactsRequest { // Callback for GetContactPhotoOperation calls. Updates the associated // Contact and checks for completion. void HandlePhotoData(contacts::Contact* contact, - gdata::GDataErrorCode error, + google_apis::GDataErrorCode error, scoped_ptr<std::string> download_data) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); VLOG(1) << "Got photo data for " << contact->contact_id() << " (error=" << error << " size=" << download_data->size() << ")"; num_in_progress_photo_downloads_--; - if (error == gdata::HTTP_INTERNAL_SERVER_ERROR || - error == gdata::HTTP_SERVICE_UNAVAILABLE) { + if (error == google_apis::HTTP_INTERNAL_SERVER_ERROR || + error == google_apis::HTTP_SERVICE_UNAVAILABLE) { int num_errors = ++transient_photo_download_errors_per_contact_[contact]; if (num_errors <= kMaxTransientPhotoDownloadErrorsPerContact) { LOG(WARNING) << "Got error " << error << " while downloading photo " @@ -770,7 +770,7 @@ class GDataContactsService::DownloadContactsRequest { } } - if (error == gdata::HTTP_NOT_FOUND) { + if (error == google_apis::HTTP_NOT_FOUND) { LOG(WARNING) << "Got error " << error << " while downloading photo " << "for " << contact->contact_id() << "; skipping"; num_photo_download_404_errors_++; @@ -778,7 +778,7 @@ class GDataContactsService::DownloadContactsRequest { return; } - if (error != gdata::HTTP_SUCCESS) { + if (error != google_apis::HTTP_SUCCESS) { LOG(WARNING) << "Got error " << error << " while downloading photo " << "for " << contact->contact_id() << "; giving up"; photo_download_failed_ = true; @@ -796,7 +796,7 @@ class GDataContactsService::DownloadContactsRequest { typedef std::map<contacts::Contact*, std::string> ContactPhotoUrls; GDataContactsService* service_; // not owned - gdata::OperationRunner* runner_; // not owned + google_apis::OperationRunner* runner_; // not owned SuccessCallback success_callback_; FailureCallback failure_callback_; @@ -853,7 +853,7 @@ GDataContactsService::GDataContactsService(Profile* profile) DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); std::vector<std::string> scopes; scopes.push_back(kContactsScope); - runner_.reset(new gdata::OperationRunner(profile, scopes)); + runner_.reset(new google_apis::OperationRunner(profile, scopes)); } GDataContactsService::~GDataContactsService() { @@ -863,7 +863,7 @@ GDataContactsService::~GDataContactsService() { requests_.clear(); } -gdata::AuthService* GDataContactsService::auth_service_for_testing() { +google_apis::AuthService* GDataContactsService::auth_service_for_testing() { return runner_->auth_service(); } diff --git a/chrome/browser/chromeos/contacts/gdata_contacts_service.h b/chrome/browser/chromeos/contacts/gdata_contacts_service.h index 4aabedf..8df8217 100644 --- a/chrome/browser/chromeos/contacts/gdata_contacts_service.h +++ b/chrome/browser/chromeos/contacts/gdata_contacts_service.h @@ -22,7 +22,7 @@ namespace base { class Value; } -namespace gdata { +namespace google_apis { class AuthService; class OperationRunner; } @@ -65,7 +65,7 @@ class GDataContactsService : public GDataContactsServiceInterface { explicit GDataContactsService(Profile* profile); virtual ~GDataContactsService(); - gdata::AuthService* auth_service_for_testing(); + google_apis::AuthService* auth_service_for_testing(); const std::string& cached_my_contacts_group_id_for_testing() const { return cached_my_contacts_group_id_; @@ -105,7 +105,7 @@ class GDataContactsService : public GDataContactsServiceInterface { Profile* profile_; // not owned - scoped_ptr<gdata::OperationRunner> runner_; + scoped_ptr<google_apis::OperationRunner> runner_; // Group ID for the "My Contacts" system contacts group. // Cached after a DownloadContactsRequest has completed. diff --git a/chrome/browser/chromeos/contacts/gdata_contacts_service_browsertest.cc b/chrome/browser/chromeos/contacts/gdata_contacts_service_browsertest.cc index b2bac01..c474194 100644 --- a/chrome/browser/chromeos/contacts/gdata_contacts_service_browsertest.cc +++ b/chrome/browser/chromeos/contacts/gdata_contacts_service_browsertest.cc @@ -55,7 +55,8 @@ void InitContact(const std::string& contact_id, DCHECK(contact); contact->set_contact_id(contact_id); base::Time update_time; - CHECK(gdata::util::GetTimeFromString(rfc_3339_update_time, &update_time)) + CHECK(google_apis::util::GetTimeFromString( + rfc_3339_update_time, &update_time)) << "Unable to parse time \"" << rfc_3339_update_time << "\""; contact->set_update_time(update_time.ToInternalValue()); contact->set_deleted(deleted); diff --git a/chrome/browser/chromeos/contacts/gdata_contacts_service_stub.cc b/chrome/browser/chromeos/contacts/gdata_contacts_service_stub.cc index 781841136..b6f0deb 100644 --- a/chrome/browser/chromeos/contacts/gdata_contacts_service_stub.cc +++ b/chrome/browser/chromeos/contacts/gdata_contacts_service_stub.cc @@ -48,9 +48,10 @@ void GDataContactsServiceStub::DownloadContacts( if (min_update_time != expected_min_update_time_) { LOG(ERROR) << "Actual minimum update time (" - << gdata::util::FormatTimeAsString(min_update_time) << ") " + << google_apis::util::FormatTimeAsString(min_update_time) << ") " << "differed from expected (" - << gdata::util::FormatTimeAsString(expected_min_update_time_) + << google_apis::util::FormatTimeAsString( + expected_min_update_time_) << "); not returning any contacts"; num_download_requests_with_wrong_timestamps_++; failure_callback.Run(); diff --git a/chrome/browser/chromeos/contacts/google_contact_store.cc b/chrome/browser/chromeos/contacts/google_contact_store.cc index b18948e..0f55533 100644 --- a/chrome/browser/chromeos/contacts/google_contact_store.cc +++ b/chrome/browser/chromeos/contacts/google_contact_store.cc @@ -212,7 +212,7 @@ void GoogleContactStore::UpdateContacts() { VLOG(1) << "Downloading all contacts for " << profile_->GetProfileName(); } else { VLOG(1) << "Downloading contacts updated since " - << gdata::util::FormatTimeAsString(min_update_time) << " for " + << google_apis::util::FormatTimeAsString(min_update_time) << " for " << profile_->GetProfileName(); } @@ -266,7 +266,7 @@ void GoogleContactStore::MergeContacts( VLOG(1) << "Last contact update time is " << (last_contact_update_time_.is_null() ? std::string("null") : - gdata::util::FormatTimeAsString(last_contact_update_time_)); + google_apis::util::FormatTimeAsString(last_contact_update_time_)); contacts_.Merge(updated_contacts.Pass(), ContactMap::DROP_DELETED_CONTACTS); } @@ -400,7 +400,7 @@ bool GoogleContactStoreFactory::CanCreateContactStoreForProfile( Profile* profile) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(profile); - return gdata::AuthService::CanAuthenticate(profile); + return google_apis::AuthService::CanAuthenticate(profile); } ContactStore* GoogleContactStoreFactory::CreateContactStore(Profile* profile) { diff --git a/chrome/browser/chromeos/drive/document_entry_conversion.cc b/chrome/browser/chromeos/drive/document_entry_conversion.cc index bf6cc9a..bad851b 100644 --- a/chrome/browser/chromeos/drive/document_entry_conversion.cc +++ b/chrome/browser/chromeos/drive/document_entry_conversion.cc @@ -16,7 +16,7 @@ namespace drive { DriveEntryProto ConvertDocumentEntryToDriveEntryProto( - const gdata::DocumentEntry& doc) { + const google_apis::DocumentEntry& doc) { DriveEntryProto entry_proto; // For regular files, the 'filename' and 'title' attribute in the metadata @@ -29,11 +29,13 @@ DriveEntryProto ConvertDocumentEntryToDriveEntryProto( entry_proto.set_resource_id(doc.resource_id()); entry_proto.set_content_url(doc.content_url().spec()); - const gdata::Link* edit_link = doc.GetLinkByType(gdata::Link::LINK_EDIT); + const google_apis::Link* edit_link = + doc.GetLinkByType(google_apis::Link::LINK_EDIT); if (edit_link) entry_proto.set_edit_url(edit_link->href().spec()); - const gdata::Link* parent_link = doc.GetLinkByType(gdata::Link::LINK_PARENT); + const google_apis::Link* parent_link = + doc.GetLinkByType(google_apis::Link::LINK_PARENT); if (parent_link) { entry_proto.set_parent_resource_id( util::ExtractResourceIdFromUrl(parent_link->href())); @@ -59,8 +61,8 @@ DriveEntryProto ConvertDocumentEntryToDriveEntryProto( // The resumable-edit-media link should only be present for regular // files as hosted documents are not uploadable. - const gdata::Link* upload_link = doc.GetLinkByType( - gdata::Link::LINK_RESUMABLE_EDIT_MEDIA); + const google_apis::Link* upload_link = doc.GetLinkByType( + google_apis::Link::LINK_RESUMABLE_EDIT_MEDIA); if (upload_link) entry_proto.set_upload_url(upload_link->href().spec()); } else if (doc.is_hosted_document()) { @@ -79,22 +81,22 @@ DriveEntryProto ConvertDocumentEntryToDriveEntryProto( file_specific_info->set_content_mime_type(doc.content_mime_type()); file_specific_info->set_is_hosted_document(doc.is_hosted_document()); - const gdata::Link* thumbnail_link = doc.GetLinkByType( - gdata::Link::LINK_THUMBNAIL); + 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 gdata::Link* alternate_link = doc.GetLinkByType( - gdata::Link::LINK_ALTERNATE); + 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()); } else if (doc.is_folder()) { - const gdata::Link* upload_link = doc.GetLinkByType( - gdata::Link::LINK_RESUMABLE_CREATE_MEDIA); + 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 { - NOTREACHED() << "Unknown gdata::DocumentEntry type"; + NOTREACHED() << "Unknown google_apis::DocumentEntry type"; } return entry_proto; diff --git a/chrome/browser/chromeos/drive/document_entry_conversion.h b/chrome/browser/chromeos/drive/document_entry_conversion.h index e378f2f..afa157e 100644 --- a/chrome/browser/chromeos/drive/document_entry_conversion.h +++ b/chrome/browser/chromeos/drive/document_entry_conversion.h @@ -11,7 +11,7 @@ class GURL; -namespace gdata { +namespace google_apis { class DocumentEntry; } @@ -19,9 +19,9 @@ namespace drive { class DriveEntryProto; -// Converts a gdata::DocumentEntry into a DriveEntryProto. +// Converts a google_apis::DocumentEntry into a DriveEntryProto. DriveEntryProto ConvertDocumentEntryToDriveEntryProto( - const gdata::DocumentEntry& document_entry); + const google_apis::DocumentEntry& document_entry); } // namespace drive diff --git a/chrome/browser/chromeos/drive/document_entry_conversion_unittest.cc b/chrome/browser/chromeos/drive/document_entry_conversion_unittest.cc index bcbf25e..92d18f2 100644 --- a/chrome/browser/chromeos/drive/document_entry_conversion_unittest.cc +++ b/chrome/browser/chromeos/drive/document_entry_conversion_unittest.cc @@ -16,11 +16,11 @@ namespace drive { TEST(DocumentEntryConversionTest, ConvertDocumentEntryToDriveEntryProto_File) { scoped_ptr<base::Value> value = - gdata::test_util::LoadJSONFile("gdata/file_entry.json"); + google_apis::test_util::LoadJSONFile("gdata/file_entry.json"); ASSERT_TRUE(value.get()); - scoped_ptr<gdata::DocumentEntry> document_entry( - gdata::DocumentEntry::ExtractAndParse(*value)); + scoped_ptr<google_apis::DocumentEntry> document_entry( + google_apis::DocumentEntry::ExtractAndParse(*value)); ASSERT_TRUE(document_entry.get()); DriveEntryProto entry_proto = @@ -35,7 +35,7 @@ TEST(DocumentEntryConversionTest, ConvertDocumentEntryToDriveEntryProto_File) { EXPECT_EQ("", entry_proto.parent_resource_id()); EXPECT_FALSE(entry_proto.deleted()); - EXPECT_EQ(gdata::ENTRY_KIND_FILE, entry_proto.kind()); + EXPECT_EQ(google_apis::ENTRY_KIND_FILE, entry_proto.kind()); // 2011-12-14T00:40:47.330Z base::Time::Exploded exploded; @@ -75,11 +75,11 @@ TEST(DocumentEntryConversionTest, ConvertDocumentEntryToDriveEntryProto_File) { TEST(DocumentEntryConversionTest, ConvertDocumentEntryToDriveEntryProto_HostedDocument) { scoped_ptr<base::Value> value = - gdata::test_util::LoadJSONFile("gdata/hosted_document_entry.json"); + google_apis::test_util::LoadJSONFile("gdata/hosted_document_entry.json"); ASSERT_TRUE(value.get()); - scoped_ptr<gdata::DocumentEntry> document_entry( - gdata::DocumentEntry::ExtractAndParse(*value)); + scoped_ptr<google_apis::DocumentEntry> document_entry( + google_apis::DocumentEntry::ExtractAndParse(*value)); ASSERT_TRUE(document_entry.get()); DriveEntryProto entry_proto = @@ -94,7 +94,7 @@ TEST(DocumentEntryConversionTest, EXPECT_EQ("", entry_proto.parent_resource_id()); EXPECT_FALSE(entry_proto.deleted()); - EXPECT_EQ(gdata::ENTRY_KIND_DOCUMENT, entry_proto.kind()); + EXPECT_EQ(google_apis::ENTRY_KIND_DOCUMENT, entry_proto.kind()); // 2011-12-12T23:28:52.783Z base::Time::Exploded exploded; @@ -155,11 +155,11 @@ TEST(DocumentEntryConversionTest, TEST(DocumentEntryConversionTest, ConvertDocumentEntryToDriveEntryProto_Directory) { scoped_ptr<base::Value> value = - gdata::test_util::LoadJSONFile("gdata/directory_entry.json"); + google_apis::test_util::LoadJSONFile("gdata/directory_entry.json"); ASSERT_TRUE(value.get()); - scoped_ptr<gdata::DocumentEntry> document_entry( - gdata::DocumentEntry::ExtractAndParse(*value)); + scoped_ptr<google_apis::DocumentEntry> document_entry( + google_apis::DocumentEntry::ExtractAndParse(*value)); ASSERT_TRUE(document_entry.get()); DriveEntryProto entry_proto = @@ -176,7 +176,7 @@ TEST(DocumentEntryConversionTest, EXPECT_EQ("folder:1_folder_resource_id", entry_proto.parent_resource_id()); EXPECT_FALSE(entry_proto.deleted()); - EXPECT_EQ(gdata::ENTRY_KIND_FOLDER, entry_proto.kind()); + EXPECT_EQ(google_apis::ENTRY_KIND_FOLDER, entry_proto.kind()); // 2011-04-01T18:34:08.234Z base::Time::Exploded exploded; @@ -230,12 +230,12 @@ TEST(DocumentEntryConversionTest, TEST(DocumentEntryConversionTest, ConvertDocumentEntryToDriveEntryProto_DeletedHostedDocument) { scoped_ptr<base::Value> value = - gdata::test_util::LoadJSONFile( + google_apis::test_util::LoadJSONFile( "gdata/deleted_hosted_document_entry.json"); ASSERT_TRUE(value.get()); - scoped_ptr<gdata::DocumentEntry> document_entry( - gdata::DocumentEntry::ExtractAndParse(*value)); + scoped_ptr<google_apis::DocumentEntry> document_entry( + google_apis::DocumentEntry::ExtractAndParse(*value)); ASSERT_TRUE(document_entry.get()); DriveEntryProto entry_proto = @@ -250,7 +250,7 @@ TEST(DocumentEntryConversionTest, EXPECT_EQ("", entry_proto.parent_resource_id()); EXPECT_TRUE(entry_proto.deleted()); // The document was deleted. - EXPECT_EQ(gdata::ENTRY_KIND_DOCUMENT, entry_proto.kind()); + EXPECT_EQ(google_apis::ENTRY_KIND_DOCUMENT, entry_proto.kind()); // 2012-04-10T22:50:55.797Z base::Time::Exploded exploded; diff --git a/chrome/browser/chromeos/drive/drive_api_service.cc b/chrome/browser/chromeos/drive/drive_api_service.cc index 8bdfbf76..3c44e32e 100644 --- a/chrome/browser/chromeos/drive/drive_api_service.cc +++ b/chrome/browser/chromeos/drive/drive_api_service.cc @@ -51,7 +51,7 @@ void DriveAPIService::Initialize(Profile* profile) { std::vector<std::string> scopes; scopes.push_back(kDriveScope); scopes.push_back(kDriveAppsReadonlyScope); - runner_.reset(new gdata::OperationRunner(profile, scopes)); + runner_.reset(new google_apis::OperationRunner(profile, scopes)); runner_->Initialize(); runner_->auth_service()->AddObserver(this); @@ -82,22 +82,24 @@ bool DriveAPIService::CancelForFilePath(const FilePath& file_path) { return operation_registry()->CancelForFilePath(file_path); } -gdata::OperationProgressStatusList +google_apis::OperationProgressStatusList DriveAPIService::GetProgressStatusList() const { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); return operation_registry()->GetProgressStatusList(); } -void DriveAPIService::Authenticate(const gdata::AuthStatusCallback& callback) { +void DriveAPIService::Authenticate( + const google_apis::AuthStatusCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); runner_->Authenticate(callback); } -void DriveAPIService::GetDocuments(const GURL& url, - int64 start_changestamp, - const std::string& search_query, - const std::string& directory_resource_id, - const gdata::GetDataCallback& callback) { +void DriveAPIService::GetDocuments( + const GURL& url, + int64 start_changestamp, + const std::string& search_query, + const std::string& directory_resource_id, + const google_apis::GetDataCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (search_query.empty()) @@ -110,54 +112,57 @@ void DriveAPIService::GetDocuments(const GURL& url, NOTREACHED(); } -void DriveAPIService::GetFilelist(const GURL& url, - const std::string& search_query, - const gdata::GetDataCallback& callback) { +void DriveAPIService::GetFilelist( + const GURL& url, + const std::string& search_query, + const google_apis::GetDataCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); runner_->StartOperationWithRetry( - new gdata::GetFilelistOperation(operation_registry(), - url, - search_query, - callback)); + new google_apis::GetFilelistOperation(operation_registry(), + url, + search_query, + callback)); } -void DriveAPIService::GetChangelist(const GURL& url, - int64 start_changestamp, - const gdata::GetDataCallback& callback) { +void DriveAPIService::GetChangelist( + const GURL& url, + int64 start_changestamp, + const google_apis::GetDataCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); runner_->StartOperationWithRetry( - new gdata::GetChangelistOperation(operation_registry(), - url, - start_changestamp, - callback)); + new google_apis::GetChangelistOperation(operation_registry(), + url, + start_changestamp, + callback)); } -void DriveAPIService::GetDocumentEntry(const std::string& resource_id, - const gdata::GetDataCallback& callback) { +void DriveAPIService::GetDocumentEntry( + const std::string& resource_id, + const google_apis::GetDataCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - runner_->StartOperationWithRetry(new gdata::GetFileOperation( + runner_->StartOperationWithRetry(new google_apis::GetFileOperation( operation_registry(), resource_id, callback)); } void DriveAPIService::GetAccountMetadata( - const gdata::GetDataCallback& callback) { + const google_apis::GetDataCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); runner_->StartOperationWithRetry( - new gdata::GetAboutOperation(operation_registry(), callback)); + new google_apis::GetAboutOperation(operation_registry(), callback)); } void DriveAPIService::GetApplicationInfo( - const gdata::GetDataCallback& callback) { + const google_apis::GetDataCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); runner_->StartOperationWithRetry( - new gdata::GetApplistOperation(operation_registry(), callback)); + new google_apis::GetApplistOperation(operation_registry(), callback)); } void DriveAPIService::DownloadDocument( @@ -165,7 +170,7 @@ void DriveAPIService::DownloadDocument( const FilePath& local_cache_path, const GURL& document_url, DocumentExportFormat format, - const gdata::DownloadActionCallback& callback) { + const google_apis::DownloadActionCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // TODO(kochi): Implement this. @@ -176,8 +181,8 @@ void DriveAPIService::DownloadFile( const FilePath& virtual_path, const FilePath& local_cache_path, const GURL& document_url, - const gdata::DownloadActionCallback& download_action_callback, - const gdata::GetContentCallback& get_content_callback) { + const google_apis::DownloadActionCallback& download_action_callback, + const google_apis::GetContentCallback& get_content_callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // TODO(kochi): Implement this. @@ -186,7 +191,7 @@ void DriveAPIService::DownloadFile( void DriveAPIService::DeleteDocument( const GURL& document_url, - const gdata::EntryActionCallback& callback) { + const google_apis::EntryActionCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // TODO(kochi): Implement this. @@ -196,16 +201,17 @@ void DriveAPIService::DeleteDocument( void DriveAPIService::CreateDirectory( const GURL& parent_content_url, const FilePath::StringType& directory_name, - const gdata::GetDataCallback& callback) { + const google_apis::GetDataCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // TODO(kochi): Implement this. NOTREACHED(); } -void DriveAPIService::CopyDocument(const std::string& resource_id, - const FilePath::StringType& new_name, - const gdata::GetDataCallback& callback) { +void DriveAPIService::CopyDocument( + const std::string& resource_id, + const FilePath::StringType& new_name, + const google_apis::GetDataCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // TODO(kochi): Implement this. @@ -215,7 +221,7 @@ void DriveAPIService::CopyDocument(const std::string& resource_id, void DriveAPIService::RenameResource( const GURL& resource_url, const FilePath::StringType& new_name, - const gdata::EntryActionCallback& callback) { + const google_apis::EntryActionCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // TODO(kochi): Implement this. @@ -225,7 +231,7 @@ void DriveAPIService::RenameResource( void DriveAPIService::AddResourceToDirectory( const GURL& parent_content_url, const GURL& resource_url, - const gdata::EntryActionCallback& callback) { + const google_apis::EntryActionCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // TODO(kochi): Implement this. @@ -236,7 +242,7 @@ void DriveAPIService::RemoveResourceFromDirectory( const GURL& parent_content_url, const GURL& resource_url, const std::string& resource_id, - const gdata::EntryActionCallback& callback) { + const google_apis::EntryActionCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // TODO(kochi): Implement this. @@ -244,8 +250,8 @@ void DriveAPIService::RemoveResourceFromDirectory( } void DriveAPIService::InitiateUpload( - const gdata::InitiateUploadParams& params, - const gdata::InitiateUploadCallback& callback) { + const google_apis::InitiateUploadParams& params, + const google_apis::InitiateUploadCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // TODO(kochi): Implement this. @@ -253,17 +259,18 @@ void DriveAPIService::InitiateUpload( } void DriveAPIService::ResumeUpload( - const gdata::ResumeUploadParams& params, - const gdata::ResumeUploadCallback& callback) { + const google_apis::ResumeUploadParams& params, + const google_apis::ResumeUploadCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // TODO(kochi): Implement this. NOTREACHED(); } -void DriveAPIService::AuthorizeApp(const GURL& resource_url, - const std::string& app_ids, - const gdata::GetDataCallback& callback) { +void DriveAPIService::AuthorizeApp( + const GURL& resource_url, + const std::string& app_ids, + const google_apis::GetDataCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // TODO(kochi): Implement this. @@ -282,7 +289,7 @@ bool DriveAPIService::HasRefreshToken() const { return runner_->auth_service()->HasRefreshToken(); } -gdata::OperationRegistry* DriveAPIService::operation_registry() const { +google_apis::OperationRegistry* DriveAPIService::operation_registry() const { return runner_->operation_registry(); } @@ -295,13 +302,14 @@ void DriveAPIService::OnOAuth2RefreshTokenChanged() { } void DriveAPIService::OnProgressUpdate( - const gdata::OperationProgressStatusList& list) { + const google_apis::OperationProgressStatusList& list) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); FOR_EACH_OBSERVER( DriveServiceObserver, observers_, OnProgressUpdate(list)); } -void DriveAPIService::OnAuthenticationFailed(gdata::GDataErrorCode error) { +void DriveAPIService::OnAuthenticationFailed( + google_apis::GDataErrorCode error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); FOR_EACH_OBSERVER( DriveServiceObserver, observers_, OnAuthenticationFailed(error)); diff --git a/chrome/browser/chromeos/drive/drive_api_service.h b/chrome/browser/chromeos/drive/drive_api_service.h index fd1ff0e..385651a 100644 --- a/chrome/browser/chromeos/drive/drive_api_service.h +++ b/chrome/browser/chromeos/drive/drive_api_service.h @@ -18,7 +18,7 @@ class FilePath; class GURL; class Profile; -namespace gdata { +namespace google_apis { class OperationRunner; } @@ -28,8 +28,8 @@ namespace drive { // Details of API call are abstracted in each operation class and this class // works as a thin wrapper for the API. class DriveAPIService : public DriveServiceInterface, - public gdata::AuthServiceObserver, - public gdata::OperationRegistryObserver { + public google_apis::AuthServiceObserver, + public google_apis::OperationRegistryObserver { public: // Instance is usually created by DriveSystemServiceFactory and owned by // DriveFileSystem. @@ -43,72 +43,75 @@ class DriveAPIService : public DriveServiceInterface, virtual bool CanStartOperation() const OVERRIDE; virtual void CancelAll() OVERRIDE; virtual bool CancelForFilePath(const FilePath& file_path) OVERRIDE; - virtual gdata::OperationProgressStatusList GetProgressStatusList() + virtual google_apis::OperationProgressStatusList GetProgressStatusList() const OVERRIDE; virtual void Authenticate( - const gdata::AuthStatusCallback& callback) OVERRIDE; + const google_apis::AuthStatusCallback& callback) OVERRIDE; virtual bool HasAccessToken() const OVERRIDE; virtual bool HasRefreshToken() const OVERRIDE; - virtual void GetDocuments(const GURL& feed_url, - int64 start_changestamp, - const std::string& search_query, - const std::string& directory_resource_id, - const gdata::GetDataCallback& callback) OVERRIDE; + virtual void GetDocuments( + const GURL& feed_url, + int64 start_changestamp, + const std::string& search_query, + const std::string& directory_resource_id, + const google_apis::GetDataCallback& callback) OVERRIDE; virtual void GetDocumentEntry( const std::string& resource_id, - const gdata::GetDataCallback& callback) OVERRIDE; + const google_apis::GetDataCallback& callback) OVERRIDE; virtual void GetAccountMetadata( - const gdata::GetDataCallback& callback) OVERRIDE; + const google_apis::GetDataCallback& callback) OVERRIDE; virtual void GetApplicationInfo( - const gdata::GetDataCallback& callback) OVERRIDE; + const google_apis::GetDataCallback& callback) OVERRIDE; virtual void DeleteDocument( const GURL& document_url, - const gdata::EntryActionCallback& callback) OVERRIDE; + const google_apis::EntryActionCallback& callback) OVERRIDE; virtual void DownloadDocument( const FilePath& virtual_path, const FilePath& local_cache_path, const GURL& content_url, DocumentExportFormat format, - const gdata::DownloadActionCallback& callback) OVERRIDE; + const google_apis::DownloadActionCallback& callback) OVERRIDE; virtual void DownloadFile( const FilePath& virtual_path, const FilePath& local_cache_path, const GURL& content_url, - const gdata::DownloadActionCallback& download_action_callback, - const gdata::GetContentCallback& get_content_callback) OVERRIDE; - virtual void CopyDocument(const std::string& resource_id, - const FilePath::StringType& new_name, - const gdata::GetDataCallback& callback) OVERRIDE; + const google_apis::DownloadActionCallback& download_action_callback, + const google_apis::GetContentCallback& get_content_callback) OVERRIDE; + virtual void CopyDocument( + const std::string& resource_id, + const FilePath::StringType& new_name, + const google_apis::GetDataCallback& callback) OVERRIDE; virtual void RenameResource( const GURL& document_url, const FilePath::StringType& new_name, - const gdata::EntryActionCallback& callback) OVERRIDE; + const google_apis::EntryActionCallback& callback) OVERRIDE; virtual void AddResourceToDirectory( const GURL& parent_content_url, const GURL& resource_url, - const gdata::EntryActionCallback& callback) OVERRIDE; + const google_apis::EntryActionCallback& callback) OVERRIDE; virtual void RemoveResourceFromDirectory( const GURL& parent_content_url, const GURL& resource_url, const std::string& resource_id, - const gdata::EntryActionCallback& callback) OVERRIDE; + const google_apis::EntryActionCallback& callback) OVERRIDE; virtual void CreateDirectory( const GURL& parent_content_url, const FilePath::StringType& directory_name, - const gdata::GetDataCallback& callback) OVERRIDE; + const google_apis::GetDataCallback& callback) OVERRIDE; virtual void InitiateUpload( - const gdata::InitiateUploadParams& params, - const gdata::InitiateUploadCallback& callback) OVERRIDE; + const google_apis::InitiateUploadParams& params, + const google_apis::InitiateUploadCallback& callback) OVERRIDE; virtual void ResumeUpload( - const gdata::ResumeUploadParams& params, - const gdata::ResumeUploadCallback& callback) OVERRIDE; - virtual void AuthorizeApp(const GURL& resource_url, - const std::string& app_id, - const gdata::GetDataCallback& callback) OVERRIDE; + const google_apis::ResumeUploadParams& params, + const google_apis::ResumeUploadCallback& callback) OVERRIDE; + virtual void AuthorizeApp( + const GURL& resource_url, + const std::string& app_id, + const google_apis::GetDataCallback& callback) OVERRIDE; private: - gdata::OperationRegistry* operation_registry() const; + google_apis::OperationRegistry* operation_registry() const; // Fetches a changelist from |url| with |start_changestamp|, using Drive V2 // API. If this URL is empty the call will use the default URL. Specify |url| @@ -118,7 +121,7 @@ class DriveAPIService : public DriveServiceInterface, // Upon completion, invokes |callback| with results on calling thread. void GetChangelist(const GURL& url, int64 start_changestamp, - const gdata::GetDataCallback& callback); + const google_apis::GetDataCallback& callback); // Fetches a filelist from |url| with |search_query|, using Drive V2 API. If // this URL is empty the call will use the default URL. Specify |url| when @@ -127,18 +130,19 @@ class DriveAPIService : public DriveServiceInterface, // https://developers.google.com/drive/search-parameters void GetFilelist(const GURL& url, const std::string& search_query, - const gdata::GetDataCallback& callback); + const google_apis::GetDataCallback& callback); // AuthService::Observer override. virtual void OnOAuth2RefreshTokenChanged() OVERRIDE; // DriveServiceObserver Overrides virtual void OnProgressUpdate( - const gdata::OperationProgressStatusList& list) OVERRIDE; - virtual void OnAuthenticationFailed(gdata::GDataErrorCode error) OVERRIDE; + const google_apis::OperationProgressStatusList& list) OVERRIDE; + virtual void OnAuthenticationFailed( + google_apis::GDataErrorCode error) OVERRIDE; Profile* profile_; - scoped_ptr<gdata::OperationRunner> runner_; + scoped_ptr<google_apis::OperationRunner> runner_; ObserverList<DriveServiceObserver> observers_; DISALLOW_COPY_AND_ASSIGN(DriveAPIService); diff --git a/chrome/browser/chromeos/drive/drive_cache_unittest.cc b/chrome/browser/chromeos/drive/drive_cache_unittest.cc index d9b94e8..96ecd78 100644 --- a/chrome/browser/chromeos/drive/drive_cache_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_cache_unittest.cc @@ -163,7 +163,7 @@ class DriveCacheTest : public testing::Test { cache_->RequestInitializeOnUIThread( base::Bind(&test_util::CopyResultFromInitializeCacheCallback, &initialization_success)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); ASSERT_TRUE(initialization_success); } @@ -171,7 +171,7 @@ class DriveCacheTest : public testing::Test { SetFreeDiskSpaceGetterForTesting(NULL); cache_->DestroyOnUIThread(); // The cache destruction requires to post a task to the blocking pool. - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); profile_.reset(NULL); } @@ -211,7 +211,7 @@ class DriveCacheTest : public testing::Test { // convention. if (test_util::ToCacheEntry(resource.cache_state).is_present()) { FilePath source_path = - gdata::test_util::GetTestFilePath(resource.source_file); + google_apis::test_util::GetTestFilePath(resource.source_file); ASSERT_TRUE(file_util::CopyFile(source_path, dest_path)); } else { dest_path = FilePath(FILE_PATH_LITERAL(kSymLinkToDevNull)); @@ -242,7 +242,7 @@ class DriveCacheTest : public testing::Test { DVLOG(1) << "PrepareForInitCacheTest finished"; cache_->ForceRescanOnUIThreadForTesting(); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); } void TestInitializeCache() { @@ -290,7 +290,7 @@ class DriveCacheTest : public testing::Test { resource_id, md5)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); } void TestStoreToCache( @@ -310,7 +310,7 @@ class DriveCacheTest : public testing::Test { base::Bind(&DriveCacheTest::VerifyCacheFileState, base::Unretained(this))); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); } void VerifyGetFromCache(const std::string& resource_id, @@ -344,7 +344,7 @@ class DriveCacheTest : public testing::Test { base::Bind(&DriveCacheTest::VerifyRemoveFromCache, base::Unretained(this))); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); } void VerifyRemoveFromCache(DriveFileError error, @@ -457,7 +457,7 @@ class DriveCacheTest : public testing::Test { base::Bind(&DriveCacheTest::VerifyCacheFileState, base::Unretained(this))); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); } void TestUnpin( @@ -475,7 +475,7 @@ class DriveCacheTest : public testing::Test { base::Bind(&DriveCacheTest::VerifyCacheFileState, base::Unretained(this))); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); } void TestMarkDirty( @@ -497,7 +497,7 @@ class DriveCacheTest : public testing::Test { resource_id, md5)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); } void VerifyMarkDirty(const std::string& resource_id, @@ -534,7 +534,7 @@ class DriveCacheTest : public testing::Test { base::Bind(&DriveCacheTest::VerifyCacheFileState, base::Unretained(this))); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); } void TestClearDirty( @@ -552,7 +552,7 @@ class DriveCacheTest : public testing::Test { base::Bind(&DriveCacheTest::VerifyCacheFileState, base::Unretained(this))); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); } void TestSetMountedState( @@ -572,7 +572,7 @@ class DriveCacheTest : public testing::Test { base::Bind(&DriveCacheTest::VerifySetMountedState, base::Unretained(this), resource_id, md5, to_mount)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); } void VerifySetMountedState(const std::string& resource_id, @@ -693,7 +693,7 @@ class DriveCacheTest : public testing::Test { md5, cache_entry, &result)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); return result; } @@ -817,10 +817,11 @@ TEST_F(DriveCacheTest, StoreToCacheSimple) { std::string md5("abcdef0123456789"); // Store an existing file. - TestStoreToCache(resource_id, md5, - gdata::test_util::GetTestFilePath("gdata/root_feed.json"), - DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, - DriveCache::CACHE_TYPE_TMP); + TestStoreToCache( + resource_id, md5, + google_apis::test_util::GetTestFilePath("gdata/root_feed.json"), + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, + DriveCache::CACHE_TYPE_TMP); EXPECT_EQ(1, num_callback_invocations_); // Store a non-existent file to the same |resource_id| and |md5|. @@ -835,10 +836,11 @@ TEST_F(DriveCacheTest, StoreToCacheSimple) { // |md5|. md5 = "new_md5"; num_callback_invocations_ = 0; - TestStoreToCache(resource_id, md5, - gdata::test_util::GetTestFilePath("gdata/subdir_feed.json"), - DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, - DriveCache::CACHE_TYPE_TMP); + TestStoreToCache( + resource_id, md5, + google_apis::test_util::GetTestFilePath("gdata/subdir_feed.json"), + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, + DriveCache::CACHE_TYPE_TMP); EXPECT_EQ(1, num_callback_invocations_); // Verify that there's only one file with name <resource_id>, i.e. previously @@ -853,10 +855,11 @@ TEST_F(DriveCacheTest, GetFromCacheSimple) { std::string resource_id("pdf:1a2b"); std::string md5("abcdef0123456789"); // First store a file to cache. - TestStoreToCache(resource_id, md5, - gdata::test_util::GetTestFilePath("gdata/root_feed.json"), - DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, - DriveCache::CACHE_TYPE_TMP); + TestStoreToCache( + resource_id, md5, + google_apis::test_util::GetTestFilePath("gdata/root_feed.json"), + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, + DriveCache::CACHE_TYPE_TMP); // Then try to get the existing file from cache. num_callback_invocations_ = 0; @@ -888,10 +891,11 @@ TEST_F(DriveCacheTest, RemoveFromCacheSimple) { std::string resource_id("pdf:1a2b"); std::string md5("abcdef0123456789"); // First store a file to cache. - TestStoreToCache(resource_id, md5, - gdata::test_util::GetTestFilePath("gdata/root_feed.json"), - DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, - DriveCache::CACHE_TYPE_TMP); + TestStoreToCache( + resource_id, md5, + google_apis::test_util::GetTestFilePath("gdata/root_feed.json"), + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, + DriveCache::CACHE_TYPE_TMP); // Then try to remove existing file from cache. num_callback_invocations_ = 0; @@ -901,10 +905,11 @@ TEST_F(DriveCacheTest, RemoveFromCacheSimple) { // Repeat using non-alphanumeric characters for resource id, including '.' // which is an extension separator. resource_id = "pdf:`~!@#$%^&*()-_=+[{|]}\\;',<.>/?"; - TestStoreToCache(resource_id, md5, - gdata::test_util::GetTestFilePath("gdata/root_feed.json"), - DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, - DriveCache::CACHE_TYPE_TMP); + TestStoreToCache( + resource_id, md5, + google_apis::test_util::GetTestFilePath("gdata/root_feed.json"), + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, + DriveCache::CACHE_TYPE_TMP); num_callback_invocations_ = 0; TestRemoveFromCache(resource_id, DRIVE_FILE_OK); @@ -922,10 +927,11 @@ TEST_F(DriveCacheTest, PinAndUnpin) { .Times(1); // First store a file to cache. - TestStoreToCache(resource_id, md5, - gdata::test_util::GetTestFilePath("gdata/root_feed.json"), - DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, - DriveCache::CACHE_TYPE_TMP); + TestStoreToCache( + resource_id, md5, + google_apis::test_util::GetTestFilePath("gdata/root_feed.json"), + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, + DriveCache::CACHE_TYPE_TMP); // Pin the existing file in cache. num_callback_invocations_ = 0; @@ -1000,13 +1006,14 @@ TEST_F(DriveCacheTest, StoreToCachePinned) { // Store an existing file to a previously pinned file. num_callback_invocations_ = 0; - TestStoreToCache(resource_id, md5, - gdata::test_util::GetTestFilePath("gdata/root_feed.json"), - DRIVE_FILE_OK, - test_util::TEST_CACHE_STATE_PRESENT | - test_util::TEST_CACHE_STATE_PINNED | - test_util::TEST_CACHE_STATE_PERSISTENT, - DriveCache::CACHE_TYPE_PERSISTENT); + TestStoreToCache( + resource_id, md5, + google_apis::test_util::GetTestFilePath("gdata/root_feed.json"), + DRIVE_FILE_OK, + test_util::TEST_CACHE_STATE_PRESENT | + test_util::TEST_CACHE_STATE_PINNED | + test_util::TEST_CACHE_STATE_PERSISTENT, + DriveCache::CACHE_TYPE_PERSISTENT); EXPECT_EQ(1, num_callback_invocations_); // Store a non-existent file to a previously pinned and stored file. @@ -1040,13 +1047,14 @@ TEST_F(DriveCacheTest, GetFromCachePinned) { EXPECT_EQ(1, num_callback_invocations_); // Store an existing file to the previously pinned non-existent file. - TestStoreToCache(resource_id, md5, - gdata::test_util::GetTestFilePath("gdata/root_feed.json"), - DRIVE_FILE_OK, - test_util::TEST_CACHE_STATE_PRESENT | - test_util::TEST_CACHE_STATE_PINNED | - test_util::TEST_CACHE_STATE_PERSISTENT, - DriveCache::CACHE_TYPE_PERSISTENT); + TestStoreToCache( + resource_id, md5, + google_apis::test_util::GetTestFilePath("gdata/root_feed.json"), + DRIVE_FILE_OK, + test_util::TEST_CACHE_STATE_PRESENT | + test_util::TEST_CACHE_STATE_PINNED | + test_util::TEST_CACHE_STATE_PERSISTENT, + DriveCache::CACHE_TYPE_PERSISTENT); // Get the previously pinned and stored file from cache. num_callback_invocations_ = 0; @@ -1065,10 +1073,11 @@ TEST_F(DriveCacheTest, RemoveFromCachePinned) { EXPECT_CALL(*mock_cache_observer_, OnCachePinned(resource_id, md5)).Times(1); // Store a file to cache, and pin it. - TestStoreToCache(resource_id, md5, - gdata::test_util::GetTestFilePath("gdata/root_feed.json"), - DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, - DriveCache::CACHE_TYPE_TMP); + TestStoreToCache( + resource_id, md5, + google_apis::test_util::GetTestFilePath("gdata/root_feed.json"), + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, + DriveCache::CACHE_TYPE_TMP); TestPin(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_PINNED | @@ -1085,10 +1094,11 @@ TEST_F(DriveCacheTest, RemoveFromCachePinned) { resource_id = "pdf:`~!@#$%^&*()-_=+[{|]}\\;',<.>/?"; EXPECT_CALL(*mock_cache_observer_, OnCachePinned(resource_id, md5)).Times(1); - TestStoreToCache(resource_id, md5, - gdata::test_util::GetTestFilePath("gdata/root_feed.json"), - DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, - DriveCache::CACHE_TYPE_TMP); + TestStoreToCache( + resource_id, md5, + google_apis::test_util::GetTestFilePath("gdata/root_feed.json"), + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, + DriveCache::CACHE_TYPE_TMP); TestPin(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_PINNED | @@ -1109,10 +1119,11 @@ TEST_F(DriveCacheTest, DirtyCacheSimple) { EXPECT_CALL(*mock_cache_observer_, OnCacheCommitted(resource_id)).Times(1); // First store a file to cache. - TestStoreToCache(resource_id, md5, - gdata::test_util::GetTestFilePath("gdata/root_feed.json"), - DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, - DriveCache::CACHE_TYPE_TMP); + TestStoreToCache( + resource_id, md5, + google_apis::test_util::GetTestFilePath("gdata/root_feed.json"), + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, + DriveCache::CACHE_TYPE_TMP); // Mark the file dirty. num_callback_invocations_ = 0; @@ -1150,10 +1161,11 @@ TEST_F(DriveCacheTest, DirtyCachePinned) { EXPECT_CALL(*mock_cache_observer_, OnCacheCommitted(resource_id)).Times(1); // First store a file to cache and pin it. - TestStoreToCache(resource_id, md5, - gdata::test_util::GetTestFilePath("gdata/root_feed.json"), - DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, - DriveCache::CACHE_TYPE_TMP); + TestStoreToCache( + resource_id, md5, + google_apis::test_util::GetTestFilePath("gdata/root_feed.json"), + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, + DriveCache::CACHE_TYPE_TMP); TestPin(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_PINNED | @@ -1202,10 +1214,11 @@ TEST_F(DriveCacheTest, PinAndUnpinDirtyCache) { .Times(1); // First store a file to cache and mark it as dirty. - TestStoreToCache(resource_id, md5, - gdata::test_util::GetTestFilePath("gdata/root_feed.json"), - DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, - DriveCache::CACHE_TYPE_TMP); + TestStoreToCache( + resource_id, md5, + google_apis::test_util::GetTestFilePath("gdata/root_feed.json"), + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, + DriveCache::CACHE_TYPE_TMP); TestMarkDirty(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_DIRTY | @@ -1251,10 +1264,11 @@ TEST_F(DriveCacheTest, DirtyCacheRepetitive) { EXPECT_CALL(*mock_cache_observer_, OnCacheCommitted(resource_id)).Times(3); // First store a file to cache. - TestStoreToCache(resource_id, md5, - gdata::test_util::GetTestFilePath("gdata/root_feed.json"), - DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, - DriveCache::CACHE_TYPE_TMP); + TestStoreToCache( + resource_id, md5, + google_apis::test_util::GetTestFilePath("gdata/root_feed.json"), + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, + DriveCache::CACHE_TYPE_TMP); // Mark the file dirty. num_callback_invocations_ = 0; @@ -1355,10 +1369,11 @@ TEST_F(DriveCacheTest, DirtyCacheInvalid) { EXPECT_EQ(1, num_callback_invocations_); // Store a file to cache. - TestStoreToCache(resource_id, md5, - gdata::test_util::GetTestFilePath("gdata/root_feed.json"), - DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, - DriveCache::CACHE_TYPE_TMP); + TestStoreToCache( + resource_id, md5, + google_apis::test_util::GetTestFilePath("gdata/root_feed.json"), + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, + DriveCache::CACHE_TYPE_TMP); // Commit a non-dirty existing file dirty. num_callback_invocations_ = 0; @@ -1383,13 +1398,14 @@ TEST_F(DriveCacheTest, DirtyCacheInvalid) { DriveCache::CACHE_TYPE_PERSISTENT); num_callback_invocations_ = 0; md5 = "new_md5"; - TestStoreToCache(resource_id, md5, - gdata::test_util::GetTestFilePath("gdata/subdir_feed.json"), - DRIVE_FILE_ERROR_IN_USE, - test_util::TEST_CACHE_STATE_PRESENT | - test_util::TEST_CACHE_STATE_DIRTY | - test_util::TEST_CACHE_STATE_PERSISTENT, - DriveCache::CACHE_TYPE_PERSISTENT); + TestStoreToCache( + resource_id, md5, + google_apis::test_util::GetTestFilePath("gdata/subdir_feed.json"), + DRIVE_FILE_ERROR_IN_USE, + test_util::TEST_CACHE_STATE_PRESENT | + test_util::TEST_CACHE_STATE_DIRTY | + test_util::TEST_CACHE_STATE_PERSISTENT, + DriveCache::CACHE_TYPE_PERSISTENT); EXPECT_EQ(1, num_callback_invocations_); } @@ -1403,10 +1419,11 @@ TEST_F(DriveCacheTest, RemoveFromDirtyCache) { EXPECT_CALL(*mock_cache_observer_, OnCacheCommitted(resource_id)).Times(1); // Store a file to cache, pin it, mark it dirty and commit it. - TestStoreToCache(resource_id, md5, - gdata::test_util::GetTestFilePath("gdata/root_feed.json"), - DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, - DriveCache::CACHE_TYPE_TMP); + TestStoreToCache( + resource_id, md5, + google_apis::test_util::GetTestFilePath("gdata/root_feed.json"), + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, + DriveCache::CACHE_TYPE_TMP); TestPin(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_PINNED | @@ -1441,10 +1458,11 @@ TEST_F(DriveCacheTest, MountUnmount) { std::string md5("abcdef0123456789"); // First store a file to cache in the tmp subdir. - TestStoreToCache(resource_id, md5, - gdata::test_util::GetTestFilePath("gdata/root_feed.json"), - DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, - DriveCache::CACHE_TYPE_TMP); + TestStoreToCache( + resource_id, md5, + google_apis::test_util::GetTestFilePath("gdata/root_feed.json"), + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, + DriveCache::CACHE_TYPE_TMP); // Mark the file mounted. num_callback_invocations_ = 0; @@ -1486,7 +1504,7 @@ TEST_F(DriveCacheTest, GetResourceIdsOfBacklogOnUIThread) { std::vector<std::string> to_upload; cache_->GetResourceIdsOfBacklogOnUIThread( base::Bind(&OnGetResourceIdsOfBacklog, &to_fetch, &to_upload)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); sort(to_fetch.begin(), to_fetch.end()); ASSERT_EQ(1U, to_fetch.size()); @@ -1504,7 +1522,7 @@ TEST_F(DriveCacheTest, GetResourceIdsOfExistingPinnedFilesOnUIThread) { std::vector<std::string> resource_ids; cache_->GetResourceIdsOfExistingPinnedFilesOnUIThread( base::Bind(&OnGetResourceIds, &resource_ids)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); sort(resource_ids.begin(), resource_ids.end()); ASSERT_EQ(2U, resource_ids.size()); @@ -1518,7 +1536,7 @@ TEST_F(DriveCacheTest, GetResourceIdsOfAllFilesOnUIThread) { std::vector<std::string> resource_ids; cache_->GetResourceIdsOfAllFilesOnUIThread( base::Bind(&OnGetResourceIds, &resource_ids)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); sort(resource_ids.begin(), resource_ids.end()); ASSERT_EQ(6U, resource_ids.size()); @@ -1541,10 +1559,11 @@ TEST_F(DriveCacheTest, ClearAllOnUIThread) { std::string md5("abcdef0123456789"); // Store an existing file. - TestStoreToCache(resource_id, md5, - gdata::test_util::GetTestFilePath("gdata/root_feed.json"), - DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, - DriveCache::CACHE_TYPE_TMP); + TestStoreToCache( + resource_id, md5, + google_apis::test_util::GetTestFilePath("gdata/root_feed.json"), + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, + DriveCache::CACHE_TYPE_TMP); EXPECT_EQ(1, num_callback_invocations_); // Verify that there's only one cached file. @@ -1556,7 +1575,7 @@ TEST_F(DriveCacheTest, ClearAllOnUIThread) { cache_->ClearAllOnUIThread(base::Bind(&OnClearAll, &error, &file_path)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); // Verify that all the cache is removed. @@ -1572,11 +1591,12 @@ TEST_F(DriveCacheTest, StoreToCacheNoSpace) { std::string md5("abcdef0123456789"); // Try to store an existing file. - TestStoreToCache(resource_id, md5, - gdata::test_util::GetTestFilePath("gdata/root_feed.json"), - DRIVE_FILE_ERROR_NO_SPACE, - test_util::TEST_CACHE_STATE_NONE, - DriveCache::CACHE_TYPE_TMP); + TestStoreToCache( + resource_id, md5, + google_apis::test_util::GetTestFilePath("gdata/root_feed.json"), + DRIVE_FILE_ERROR_NO_SPACE, + test_util::TEST_CACHE_STATE_NONE, + DriveCache::CACHE_TYPE_TMP); EXPECT_EQ(1, num_callback_invocations_); // Verify that there's no files added. @@ -1601,11 +1621,11 @@ TEST(DriveCacheExtraTest, InitializationFailure) { cache->RequestInitializeOnUIThread( base::Bind(&test_util::CopyResultFromInitializeCacheCallback, &success)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_FALSE(success); cache->DestroyOnUIThread(); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); } } // namespace drive diff --git a/chrome/browser/chromeos/drive/drive_download_observer.cc b/chrome/browser/chromeos/drive/drive_download_observer.cc index 4751002..61a06e7 100644 --- a/chrome/browser/chromeos/drive/drive_download_observer.cc +++ b/chrome/browser/chromeos/drive/drive_download_observer.cc @@ -50,10 +50,12 @@ class UploadingUserData : public DownloadCompletionBlocker { int upload_id() const { return upload_id_; } void set_virtual_dir_path(const FilePath& path) { virtual_dir_path_ = path; } const FilePath& virtual_dir_path() const { return virtual_dir_path_; } - void set_entry(scoped_ptr<gdata::DocumentEntry> entry) { + void set_entry(scoped_ptr<google_apis::DocumentEntry> entry) { entry_ = entry.Pass(); } - scoped_ptr<gdata::DocumentEntry> entry_passed() { return entry_.Pass(); } + scoped_ptr<google_apis::DocumentEntry> entry_passed() { + return entry_.Pass(); + } void set_overwrite(bool overwrite) { is_overwrite_ = overwrite; } bool is_overwrite() const { return is_overwrite_; } void set_resource_id(const std::string& resource_id) { @@ -67,7 +69,7 @@ class UploadingUserData : public DownloadCompletionBlocker { DriveUploader* uploader_; int upload_id_; FilePath virtual_dir_path_; - scoped_ptr<gdata::DocumentEntry> entry_; + scoped_ptr<google_apis::DocumentEntry> entry_; bool is_overwrite_; std::string resource_id_; std::string md5_; @@ -181,11 +183,11 @@ void OnEntryFound(Profile* profile, void OnAuthenticate(Profile* profile, const FilePath& drive_path, const base::Closure& substitute_callback, - gdata::GDataErrorCode error, + google_apis::GDataErrorCode error, const std::string& token) { DVLOG(1) << "OnAuthenticate"; - if (error == gdata::HTTP_SUCCESS) { + if (error == google_apis::HTTP_SUCCESS) { const FilePath drive_dir_path = util::ExtractDrivePath(drive_path.DirName()); // Ensure the directory exists. This also forces DriveFileSystem to @@ -666,7 +668,7 @@ void DriveDownloadObserver::OnUploadComplete( DriveFileError error, const FilePath& drive_path, const FilePath& file_path, - scoped_ptr<gdata::DocumentEntry> document_entry) { + scoped_ptr<google_apis::DocumentEntry> document_entry) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(document_entry.get()); @@ -700,8 +702,8 @@ void DriveDownloadObserver::MoveFileToDriveCache(DownloadItem* download) { return; } - // Pass ownership of the gdata::DocumentEntry object. - scoped_ptr<gdata::DocumentEntry> entry = upload_data->entry_passed(); + // Pass ownership of the google_apis::DocumentEntry object. + scoped_ptr<google_apis::DocumentEntry> entry = upload_data->entry_passed(); if (!entry.get()) { NOTREACHED(); return; @@ -717,7 +719,7 @@ void DriveDownloadObserver::MoveFileToDriveCache(DownloadItem* download) { // Move downloaded file to drive cache. Note that |content_file_path| should // use the final target path (download->GetTargetFilePath()) when the // download item has transitioned to the DownloadItem::COMPLETE state. - file_system_->AddUploadedFile(gdata::UPLOAD_NEW_FILE, + file_system_->AddUploadedFile(google_apis::UPLOAD_NEW_FILE, upload_data->virtual_dir_path(), entry.Pass(), download->GetTargetFilePath(), diff --git a/chrome/browser/chromeos/drive/drive_download_observer.h b/chrome/browser/chromeos/drive/drive_download_observer.h index d57bfd8..583d531 100644 --- a/chrome/browser/chromeos/drive/drive_download_observer.h +++ b/chrome/browser/chromeos/drive/drive_download_observer.h @@ -17,7 +17,7 @@ class Profile; -namespace gdata { +namespace google_apis { class DocumentEntry; } @@ -194,7 +194,7 @@ class DriveDownloadObserver : public content::DownloadManager::Observer, DriveFileError error, const FilePath& drive_path, const FilePath& file_path, - scoped_ptr<gdata::DocumentEntry> document_entry); + scoped_ptr<google_apis::DocumentEntry> document_entry); // Moves the downloaded file to drive cache. // Must be called after DriveDownloadObserver receives COMPLETE notification. diff --git a/chrome/browser/chromeos/drive/drive_feed_loader.cc b/chrome/browser/chromeos/drive/drive_feed_loader.cc index 605ceb1..9530beb 100644 --- a/chrome/browser/chromeos/drive/drive_feed_loader.cc +++ b/chrome/browser/chromeos/drive/drive_feed_loader.cc @@ -148,13 +148,13 @@ void RunFeedLoadCallback(scoped_ptr<LoadFeedParams> params, feed_load_callback.Run(params.Pass(), error); } -// Parses a gdata::DocumentFeed from |data|. +// Parses a google_apis::DocumentFeed from |data|. void ParseFeedOnBlockingPool( scoped_ptr<base::Value> data, - scoped_ptr<gdata::DocumentFeed>* out_current_feed) { + scoped_ptr<google_apis::DocumentFeed>* out_current_feed) { DCHECK(out_current_feed); out_current_feed->reset( - gdata::DocumentFeed::ExtractAndParse(*data).release()); + google_apis::DocumentFeed::ExtractAndParse(*data).release()); } } // namespace @@ -252,7 +252,7 @@ void DriveFeedLoader::ReloadFromServerIfNeeded( // First fetch the latest changestamp to see if there were any new changes // there at all. - if (gdata::util::IsDriveV2ApiEnabled()) { + if (google_apis::util::IsDriveV2ApiEnabled()) { drive_service_->GetAccountMetadata( base::Bind(&DriveFeedLoader::OnGetAboutResource, weak_ptr_factory_.GetWeakPtr(), @@ -280,7 +280,7 @@ void DriveFeedLoader::OnGetAccountMetadata( ContentOrigin initial_origin, int64 local_changestamp, const FileOperationCallback& callback, - gdata::GDataErrorCode status, + google_apis::GDataErrorCode status, scoped_ptr<base::Value> feed_data) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -298,15 +298,15 @@ void DriveFeedLoader::OnGetAccountMetadata( return; } - scoped_ptr<gdata::AccountMetadataFeed> account_metadata; + scoped_ptr<google_apis::AccountMetadataFeed> account_metadata; if (feed_data.get()) { - account_metadata = gdata::AccountMetadataFeed::CreateFrom(*feed_data); + account_metadata = google_apis::AccountMetadataFeed::CreateFrom(*feed_data); #ifndef NDEBUG // Save account metadata feed for analysis. const FilePath path = cache_->GetCacheDirectoryPath(DriveCache::CACHE_TYPE_META).Append( kAccountMetadataFile); - gdata::util::PostBlockingPoolSequencedTask( + google_apis::util::PostBlockingPoolSequencedTask( FROM_HERE, blocking_task_runner_, base::Bind(&SaveFeedOnBlockingPoolForDebugging, @@ -353,7 +353,7 @@ void DriveFeedLoader::OnGetAboutResource( ContentOrigin initial_origin, int64 local_changestamp, const FileOperationCallback& callback, - gdata::GDataErrorCode status, + google_apis::GDataErrorCode status, scoped_ptr<base::Value> feed_data) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -370,9 +370,9 @@ void DriveFeedLoader::OnGetAboutResource( return; } - scoped_ptr<gdata::AboutResource> about_resource; + scoped_ptr<google_apis::AboutResource> about_resource; if (feed_data.get()) - about_resource = gdata::AboutResource::CreateFrom(*feed_data); + about_resource = google_apis::AboutResource::CreateFrom(*feed_data); if (!about_resource.get()) { LoadFromServer(params.Pass()); @@ -410,7 +410,7 @@ void DriveFeedLoader::OnGetAboutResource( LoadFromServer(params.Pass()); } -void DriveFeedLoader::OnGetApplicationList(gdata::GDataErrorCode status, +void DriveFeedLoader::OnGetApplicationList(google_apis::GDataErrorCode status, scoped_ptr<base::Value> json) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -419,7 +419,8 @@ void DriveFeedLoader::OnGetApplicationList(gdata::GDataErrorCode status, return; if (json.get()) { - scoped_ptr<gdata::AppList> applist(gdata::AppList::CreateFrom(*json)); + scoped_ptr<google_apis::AppList> applist( + google_apis::AppList::CreateFrom(*json)); if (applist.get()) { VLOG(1) << "applist get success"; webapps_registry_->UpdateFromApplicationList(*applist.get()); @@ -434,7 +435,7 @@ void DriveFeedLoader::LoadFromServer(scoped_ptr<LoadFeedParams> params) { // base::Passed() may get evaluated first, so get a pointer to params. LoadFeedParams* params_ptr = params.get(); - if (gdata::util::IsDriveV2ApiEnabled()) { + if (google_apis::util::IsDriveV2ApiEnabled()) { drive_service_->GetDocuments( params_ptr->feed_to_load, params_ptr->start_changestamp, @@ -515,7 +516,7 @@ void DriveFeedLoader::OnFeedFromServerLoaded(scoped_ptr<LoadFeedParams> params, void DriveFeedLoader::OnGetDocuments(scoped_ptr<LoadFeedParams> params, base::TimeTicks start_time, - gdata::GDataErrorCode status, + google_apis::GDataErrorCode status, scoped_ptr<base::Value> data) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -536,9 +537,9 @@ void DriveFeedLoader::OnGetDocuments(scoped_ptr<LoadFeedParams> params, return; } - scoped_ptr<gdata::DocumentFeed>* current_feed = - new scoped_ptr<gdata::DocumentFeed>; - gdata::util::PostBlockingPoolSequencedTaskAndReply( + scoped_ptr<google_apis::DocumentFeed>* current_feed = + new scoped_ptr<google_apis::DocumentFeed>; + google_apis::util::PostBlockingPoolSequencedTaskAndReply( FROM_HERE, blocking_task_runner_, base::Bind(&ParseFeedOnBlockingPool, @@ -554,7 +555,7 @@ void DriveFeedLoader::OnGetDocuments(scoped_ptr<LoadFeedParams> params, void DriveFeedLoader::OnParseFeed( scoped_ptr<LoadFeedParams> params, base::TimeTicks start_time, - scoped_ptr<gdata::DocumentFeed>* current_feed) { + scoped_ptr<google_apis::DocumentFeed>* current_feed) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(current_feed); @@ -626,7 +627,7 @@ void DriveFeedLoader::OnParseFeed( void DriveFeedLoader::OnGetChangelist(scoped_ptr<LoadFeedParams> params, base::TimeTicks start_time, - gdata::GDataErrorCode status, + google_apis::GDataErrorCode status, scoped_ptr<base::Value> data) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -648,8 +649,8 @@ void DriveFeedLoader::OnGetChangelist(scoped_ptr<LoadFeedParams> params, } GURL next_feed_url; - scoped_ptr<gdata::ChangeList> current_feed( - gdata::ChangeList::CreateFrom(*data)); + scoped_ptr<google_apis::ChangeList> current_feed( + google_apis::ChangeList::CreateFrom(*data)); if (!current_feed.get()) { RunFeedLoadCallback(params.Pass(), DRIVE_FILE_ERROR_FAILED); return; @@ -661,7 +662,7 @@ void DriveFeedLoader::OnGetChangelist(scoped_ptr<LoadFeedParams> params, std::string file_name = base::StringPrintf("DEBUG_changelist_%" PRId64 ".json", params->start_changestamp); - gdata::util::PostBlockingPoolSequencedTask( + google_apis::util::PostBlockingPoolSequencedTask( FROM_HERE, blocking_task_runner_, base::Bind(&SaveFeedOnBlockingPoolForDebugging, @@ -671,8 +672,8 @@ void DriveFeedLoader::OnGetChangelist(scoped_ptr<LoadFeedParams> params, #endif // Add the current feed to the list of collected feeds for this directory. - scoped_ptr<gdata::DocumentFeed> feed = - gdata::DocumentFeed::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. @@ -881,7 +882,7 @@ void DriveFeedLoader::SaveFileSystem() { resource_metadata_->SerializeToString(serialized_proto.get()); resource_metadata_->set_last_serialized(base::Time::Now()); resource_metadata_->set_serialized_size(serialized_proto->size()); - gdata::util::PostBlockingPoolSequencedTask( + google_apis::util::PostBlockingPoolSequencedTask( FROM_HERE, blocking_task_runner_, base::Bind(&SaveProtoOnBlockingPool, path, @@ -890,7 +891,7 @@ void DriveFeedLoader::SaveFileSystem() { } DriveFileError DriveFeedLoader::UpdateFromFeed( - const ScopedVector<gdata::DocumentFeed>& feed_list, + const ScopedVector<google_apis::DocumentFeed>& feed_list, int64 start_changestamp, int64 root_feed_changestamp) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); diff --git a/chrome/browser/chromeos/drive/drive_feed_loader.h b/chrome/browser/chromeos/drive/drive_feed_loader.h index 1a00742..bec66db 100644 --- a/chrome/browser/chromeos/drive/drive_feed_loader.h +++ b/chrome/browser/chromeos/drive/drive_feed_loader.h @@ -21,7 +21,7 @@ namespace base { class Value; } -namespace gdata { +namespace google_apis { class DocumentFeed; } @@ -71,7 +71,7 @@ struct LoadFeedParams { GURL feed_to_load; const LoadDocumentFeedCallback feed_load_callback; FileOperationCallback load_finished_callback; - ScopedVector<gdata::DocumentFeed> feed_list; + ScopedVector<google_apis::DocumentFeed> feed_list; scoped_ptr<GetDocumentsUiState> ui_state; }; @@ -151,7 +151,7 @@ class DriveFeedLoader { // See comments at DriveFeedProcessor::ApplyFeeds() for // |start_changestamp| and |root_feed_changestamp|. DriveFileError UpdateFromFeed( - const ScopedVector<gdata::DocumentFeed>& feed_list, + const ScopedVector<google_apis::DocumentFeed>& feed_list, int64 start_changestamp, int64 root_feed_changestamp); @@ -174,7 +174,7 @@ class DriveFeedLoader { ContentOrigin initial_origin, int64 local_changestamp, const FileOperationCallback& callback, - gdata::GDataErrorCode status, + google_apis::GDataErrorCode status, scoped_ptr<base::Value> feed_data); // Helper callback for handling results of account data retrieval initiated @@ -185,13 +185,13 @@ class DriveFeedLoader { ContentOrigin initial_origin, int64 local_changestamp, const FileOperationCallback& callback, - gdata::GDataErrorCode status, + google_apis::GDataErrorCode status, scoped_ptr<base::Value> feed_data); // Callback for handling response from |DriveAPIService::GetApplicationInfo|. // If the application list is successfully parsed, passes the list to // Drive webapps registry. - void OnGetApplicationList(gdata::GDataErrorCode status, + void OnGetApplicationList(google_apis::GDataErrorCode status, scoped_ptr<base::Value> json); // Callback for handling feed content fetching while searching for file info. @@ -208,20 +208,20 @@ class DriveFeedLoader { void OnGetDocuments( scoped_ptr<LoadFeedParams> params, base::TimeTicks start_time, - gdata::GDataErrorCode status, + google_apis::GDataErrorCode status, scoped_ptr<base::Value> data); // Callback for handling results of feed parse. void OnParseFeed(scoped_ptr<LoadFeedParams> params, base::TimeTicks start_time, - scoped_ptr<gdata::DocumentFeed>* current_feed); + scoped_ptr<google_apis::DocumentFeed>* current_feed); // Callback for handling response from |DriveAPIService::GetChanglist|. // Invokes |callback| when done. // |callback| must not be null. void OnGetChangelist(scoped_ptr<LoadFeedParams> params, base::TimeTicks start_time, - gdata::GDataErrorCode status, + google_apis::GDataErrorCode status, scoped_ptr<base::Value> data); // Save filesystem to disk. diff --git a/chrome/browser/chromeos/drive/drive_feed_processor.cc b/chrome/browser/chromeos/drive/drive_feed_processor.cc index d56e1ff..f8fe8bd4 100644 --- a/chrome/browser/chromeos/drive/drive_feed_processor.cc +++ b/chrome/browser/chromeos/drive/drive_feed_processor.cc @@ -31,7 +31,7 @@ DriveFeedProcessor::~DriveFeedProcessor() { } DriveFileError DriveFeedProcessor::ApplyFeeds( - const ScopedVector<gdata::DocumentFeed>& feed_list, + const ScopedVector<google_apis::DocumentFeed>& feed_list, int64 start_changestamp, int64 root_feed_changestamp, std::set<FilePath>* changed_dirs) { @@ -227,7 +227,7 @@ DriveDirectory* DriveFeedProcessor::FindDirectoryForNewEntry( } DriveFileError DriveFeedProcessor::FeedToFileResourceMap( - const ScopedVector<gdata::DocumentFeed>& feed_list, + const ScopedVector<google_apis::DocumentFeed>& feed_list, FileResourceIdMap* file_map, int64* feed_changestamp, FeedToFileResourceMapUmaStats* uma_stats) { @@ -238,13 +238,13 @@ DriveFileError DriveFeedProcessor::FeedToFileResourceMap( uma_stats->num_regular_files = 0; uma_stats->num_hosted_documents = 0; for (size_t i = 0; i < feed_list.size(); ++i) { - const gdata::DocumentFeed* 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 GDatadirectory::FromDocumentEntry(); if (i == 0) { - const gdata::Link* root_feed_upload_link = - feed->GetLinkByType(gdata::Link::LINK_RESUMABLE_CREATE_MEDIA); + const google_apis::Link* root_feed_upload_link = + feed->GetLinkByType(google_apis::Link::LINK_RESUMABLE_CREATE_MEDIA); if (root_feed_upload_link) resource_metadata_->root()->set_upload_url( root_feed_upload_link->href()); @@ -252,10 +252,10 @@ DriveFileError DriveFeedProcessor::FeedToFileResourceMap( DCHECK_GE(*feed_changestamp, 0); } - for (ScopedVector<gdata::DocumentEntry>::const_iterator iter = + for (ScopedVector<google_apis::DocumentEntry>::const_iterator iter = feed->entries().begin(); iter != feed->entries().end(); ++iter) { - gdata::DocumentEntry* doc = *iter; + google_apis::DocumentEntry* doc = *iter; scoped_ptr<DriveEntry> entry = resource_metadata_->FromDocumentEntry(*doc); // Some document entries don't map into files (i.e. sites). diff --git a/chrome/browser/chromeos/drive/drive_feed_processor.h b/chrome/browser/chromeos/drive/drive_feed_processor.h index 87ac400..6808aa0 100644 --- a/chrome/browser/chromeos/drive/drive_feed_processor.h +++ b/chrome/browser/chromeos/drive/drive_feed_processor.h @@ -47,16 +47,17 @@ class DriveFeedProcessor { // // In the case of processing the root feeds |root_feed_changestamp| is used // as its initial changestamp value. The value comes from - // gdata::AccountMetadataFeed. - DriveFileError ApplyFeeds(const ScopedVector<gdata::DocumentFeed>& feed_list, - int64 start_changestamp, - int64 root_feed_changestamp, - std::set<FilePath>* changed_dirs); + // google_apis::AccountMetadataFeed. + DriveFileError ApplyFeeds( + const ScopedVector<google_apis::DocumentFeed>& feed_list, + int64 start_changestamp, + int64 root_feed_changestamp, + std::set<FilePath>* changed_dirs); // Converts list of document feeds from collected feeds into // FileResourceIdMap. DriveFileError FeedToFileResourceMap( - const ScopedVector<gdata::DocumentFeed>& feed_list, + const ScopedVector<google_apis::DocumentFeed>& feed_list, FileResourceIdMap* file_map, int64* feed_changestamp, FeedToFileResourceMapUmaStats* uma_stats); diff --git a/chrome/browser/chromeos/drive/drive_file_system.cc b/chrome/browser/chromeos/drive/drive_file_system.cc index ba9e120..e6257a3 100644 --- a/chrome/browser/chromeos/drive/drive_file_system.cc +++ b/chrome/browser/chromeos/drive/drive_file_system.cc @@ -294,7 +294,7 @@ struct DriveFileSystem::GetFileFromCacheParams { const std::string& md5, const std::string& mime_type, const GetFileCallback& get_file_callback, - const gdata::GetContentCallback& get_content_callback) + const google_apis::GetContentCallback& get_content_callback) : virtual_file_path(virtual_file_path), local_tmp_path(local_tmp_path), content_url(content_url), @@ -313,14 +313,14 @@ struct DriveFileSystem::GetFileFromCacheParams { std::string md5; std::string mime_type; GetFileCallback get_file_callback; - gdata::GetContentCallback get_content_callback; + google_apis::GetContentCallback get_content_callback; }; // DriveFileSystem::AddUploadedFileParams implementation. struct DriveFileSystem::AddUploadedFileParams { - AddUploadedFileParams(gdata::UploadMode upload_mode, + AddUploadedFileParams(google_apis::UploadMode upload_mode, const FilePath& directory_path, - scoped_ptr<gdata::DocumentEntry> doc_entry, + scoped_ptr<google_apis::DocumentEntry> doc_entry, const FilePath& file_content_path, DriveCache::FileOperationType cache_operation, const base::Closure& callback) @@ -332,9 +332,9 @@ struct DriveFileSystem::AddUploadedFileParams { callback(callback) { } - gdata::UploadMode upload_mode; + google_apis::UploadMode upload_mode; FilePath directory_path; - scoped_ptr<gdata::DocumentEntry> doc_entry; + scoped_ptr<google_apis::DocumentEntry> doc_entry; FilePath file_content_path; DriveCache::FileOperationType cache_operation; base::Closure callback; @@ -510,11 +510,11 @@ void DriveFileSystem::GetEntryInfoByResourceId( BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(!callback.is_null()); - gdata::RunTaskOnUIThread( + google_apis::RunTaskOnUIThread( base::Bind(&DriveFileSystem::GetEntryInfoByResourceIdOnUIThread, ui_weak_ptr_, resource_id, - gdata::CreateRelayCallback(callback))); + google_apis::CreateRelayCallback(callback))); } void DriveFileSystem::GetEntryInfoByResourceIdOnUIThread( @@ -609,11 +609,12 @@ void DriveFileSystem::Copy(const FilePath& src_file_path, BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(!callback.is_null()); - gdata::RunTaskOnUIThread(base::Bind(&DriveFileSystem::CopyOnUIThread, - ui_weak_ptr_, - src_file_path, - dest_file_path, - gdata::CreateRelayCallback(callback))); + google_apis::RunTaskOnUIThread( + base::Bind(&DriveFileSystem::CopyOnUIThread, + ui_weak_ptr_, + src_file_path, + dest_file_path, + google_apis::CreateRelayCallback(callback))); } void DriveFileSystem::CopyOnUIThread(const FilePath& src_file_path, @@ -629,11 +630,12 @@ void DriveFileSystem::Move(const FilePath& src_file_path, BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(!callback.is_null()); - gdata::RunTaskOnUIThread(base::Bind(&DriveFileSystem::MoveOnUIThread, - ui_weak_ptr_, - src_file_path, - dest_file_path, - gdata::CreateRelayCallback(callback))); + google_apis::RunTaskOnUIThread( + base::Bind(&DriveFileSystem::MoveOnUIThread, + ui_weak_ptr_, + src_file_path, + dest_file_path, + google_apis::CreateRelayCallback(callback))); } void DriveFileSystem::MoveOnUIThread(const FilePath& src_file_path, @@ -649,11 +651,12 @@ void DriveFileSystem::Remove(const FilePath& file_path, BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(!callback.is_null()); - gdata::RunTaskOnUIThread(base::Bind(&DriveFileSystem::RemoveOnUIThread, - ui_weak_ptr_, - file_path, - is_recursive, - gdata::CreateRelayCallback(callback))); + google_apis::RunTaskOnUIThread( + base::Bind(&DriveFileSystem::RemoveOnUIThread, + ui_weak_ptr_, + file_path, + is_recursive, + google_apis::CreateRelayCallback(callback))); } void DriveFileSystem::RemoveOnUIThread( @@ -675,13 +678,13 @@ void DriveFileSystem::CreateDirectory( BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(!callback.is_null()); - gdata::RunTaskOnUIThread( + google_apis::RunTaskOnUIThread( base::Bind(&DriveFileSystem::CreateDirectoryOnUIThread, ui_weak_ptr_, directory_path, is_exclusive, is_recursive, - gdata::CreateRelayCallback(callback))); + google_apis::CreateRelayCallback(callback))); } void DriveFileSystem::CreateDirectoryOnUIThread( @@ -758,11 +761,12 @@ void DriveFileSystem::CreateFile(const FilePath& file_path, BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(!callback.is_null()); - gdata::RunTaskOnUIThread(base::Bind(&DriveFileSystem::CreateFileOnUIThread, - ui_weak_ptr_, - file_path, - is_exclusive, - gdata::CreateRelayCallback(callback))); + google_apis::RunTaskOnUIThread( + base::Bind(&DriveFileSystem::CreateFileOnUIThread, + ui_weak_ptr_, + file_path, + is_exclusive, + google_apis::CreateRelayCallback(callback))); } void DriveFileSystem::CreateFileOnUIThread( @@ -826,23 +830,23 @@ void DriveFileSystem::OnGetEntryInfoForCreateFile( void DriveFileSystem::GetFileByPath( const FilePath& file_path, const GetFileCallback& get_file_callback, - const gdata::GetContentCallback& get_content_callback) { + const google_apis::GetContentCallback& get_content_callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(!get_file_callback.is_null()); - gdata::RunTaskOnUIThread( + google_apis::RunTaskOnUIThread( base::Bind(&DriveFileSystem::GetFileByPathOnUIThread, ui_weak_ptr_, file_path, - gdata::CreateRelayCallback(get_file_callback), - gdata::CreateRelayCallback(get_content_callback))); + google_apis::CreateRelayCallback(get_file_callback), + google_apis::CreateRelayCallback(get_content_callback))); } void DriveFileSystem::GetFileByPathOnUIThread( const FilePath& file_path, const GetFileCallback& get_file_callback, - const gdata::GetContentCallback& get_content_callback) { + const google_apis::GetContentCallback& get_content_callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!get_file_callback.is_null()); @@ -851,14 +855,14 @@ void DriveFileSystem::GetFileByPathOnUIThread( base::Bind(&DriveFileSystem::OnGetEntryInfoCompleteForGetFileByPath, ui_weak_ptr_, file_path, - gdata::CreateRelayCallback(get_file_callback), - gdata::CreateRelayCallback(get_content_callback))); + google_apis::CreateRelayCallback(get_file_callback), + google_apis::CreateRelayCallback(get_content_callback))); } void DriveFileSystem::OnGetEntryInfoCompleteForGetFileByPath( const FilePath& file_path, const GetFileCallback& get_file_callback, - const gdata::GetContentCallback& get_content_callback, + const google_apis::GetContentCallback& get_content_callback, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -879,7 +883,7 @@ void DriveFileSystem::OnGetEntryInfoCompleteForGetFileByPath( void DriveFileSystem::GetResolvedFileByPath( const FilePath& file_path, const GetFileCallback& get_file_callback, - const gdata::GetContentCallback& get_content_callback, + const google_apis::GetContentCallback& get_content_callback, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!get_file_callback.is_null()); @@ -903,7 +907,7 @@ void DriveFileSystem::GetResolvedFileByPath( FilePath* temp_file_path = new FilePath; std::string* mime_type = new std::string; DriveFileType* file_type = new DriveFileType(REGULAR_FILE); - gdata::util::PostBlockingPoolSequencedTaskAndReply( + google_apis::util::PostBlockingPoolSequencedTaskAndReply( FROM_HERE, blocking_task_runner_, base::Bind(&CreateDocumentJsonFileOnBlockingPool, @@ -950,21 +954,21 @@ void DriveFileSystem::GetResolvedFileByPath( void DriveFileSystem::GetFileByResourceId( const std::string& resource_id, const GetFileCallback& get_file_callback, - const gdata::GetContentCallback& get_content_callback) { + const google_apis::GetContentCallback& get_content_callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || BrowserThread::CurrentlyOn(BrowserThread::IO)); - gdata::RunTaskOnUIThread( + google_apis::RunTaskOnUIThread( base::Bind(&DriveFileSystem::GetFileByResourceIdOnUIThread, ui_weak_ptr_, resource_id, - gdata::CreateRelayCallback(get_file_callback), - gdata::CreateRelayCallback(get_content_callback))); + google_apis::CreateRelayCallback(get_file_callback), + google_apis::CreateRelayCallback(get_content_callback))); } void DriveFileSystem::GetFileByResourceIdOnUIThread( const std::string& resource_id, const GetFileCallback& get_file_callback, - const gdata::GetContentCallback& get_content_callback) { + const google_apis::GetContentCallback& get_content_callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!get_file_callback.is_null()); @@ -978,7 +982,7 @@ void DriveFileSystem::GetFileByResourceIdOnUIThread( void DriveFileSystem::GetFileByResourceIdAfterGetEntry( const GetFileCallback& get_file_callback, - const gdata::GetContentCallback& get_content_callback, + const google_apis::GetContentCallback& get_content_callback, DriveFileError error, const FilePath& file_path, scoped_ptr<DriveEntryProto> entry_proto) { @@ -1036,7 +1040,7 @@ void DriveFileSystem::OnGetFileFromCache( } void DriveFileSystem::OnGetDocumentEntry(const GetFileFromCacheParams& params, - gdata::GDataErrorCode status, + google_apis::GDataErrorCode status, scoped_ptr<base::Value> data) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!params.get_file_callback.is_null()); @@ -1050,8 +1054,8 @@ void DriveFileSystem::OnGetDocumentEntry(const GetFileFromCacheParams& params, return; } - scoped_ptr<gdata::DocumentEntry> doc_entry( - gdata::DocumentEntry::ExtractAndParse(*data)); + scoped_ptr<google_apis::DocumentEntry> doc_entry( + google_apis::DocumentEntry::ExtractAndParse(*data)); GURL content_url = doc_entry->content_url(); int64 file_size = doc_entry->file_size(); @@ -1085,7 +1089,7 @@ void DriveFileSystem::CheckForSpaceBeforeDownload( } bool* has_enough_space = new bool(false); - gdata::util::PostBlockingPoolSequencedTaskAndReply( + google_apis::util::PostBlockingPoolSequencedTaskAndReply( FROM_HERE, blocking_task_runner_, base::Bind(&DriveCache::FreeDiskSpaceIfNeededFor, @@ -1134,11 +1138,11 @@ void DriveFileSystem::GetEntryInfoByPath(const FilePath& file_path, BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(!callback.is_null()); - gdata::RunTaskOnUIThread( + google_apis::RunTaskOnUIThread( base::Bind(&DriveFileSystem::GetEntryInfoByPathOnUIThread, ui_weak_ptr_, file_path, - gdata::CreateRelayCallback(callback))); + google_apis::CreateRelayCallback(callback))); } void DriveFileSystem::GetEntryInfoByPathOnUIThread( @@ -1196,11 +1200,11 @@ void DriveFileSystem::ReadDirectoryByPath( BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(!callback.is_null()); - gdata::RunTaskOnUIThread( + google_apis::RunTaskOnUIThread( base::Bind(&DriveFileSystem::ReadDirectoryByPathOnUIThread, ui_weak_ptr_, directory_path, - gdata::CreateRelayCallback(callback))); + google_apis::CreateRelayCallback(callback))); } void DriveFileSystem::ReadDirectoryByPathOnUIThread( @@ -1258,7 +1262,7 @@ void DriveFileSystem::ReadDirectoryByPathOnUIThreadAfterRead( void DriveFileSystem::RequestDirectoryRefresh(const FilePath& directory_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || BrowserThread::CurrentlyOn(BrowserThread::IO)); - gdata::RunTaskOnUIThread( + google_apis::RunTaskOnUIThread( base::Bind(&DriveFileSystem::RequestDirectoryRefreshOnUIThread, ui_weak_ptr_, directory_path)); @@ -1340,11 +1344,11 @@ void DriveFileSystem::UpdateFileByResourceId( BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(!callback.is_null()); - gdata::RunTaskOnUIThread( + google_apis::RunTaskOnUIThread( base::Bind(&DriveFileSystem::UpdateFileByResourceIdOnUIThread, ui_weak_ptr_, resource_id, - gdata::CreateRelayCallback(callback))); + google_apis::CreateRelayCallback(callback))); } void DriveFileSystem::UpdateFileByResourceIdOnUIThread( @@ -1411,7 +1415,7 @@ void DriveFileSystem::OnGetFileCompleteForUpdateFile( // file size information stored in DriveEntry is not correct. DriveFileError* get_size_error = new DriveFileError(DRIVE_FILE_ERROR_FAILED); int64* file_size = new int64(-1); - gdata::util::PostBlockingPoolSequencedTaskAndReply( + google_apis::util::PostBlockingPoolSequencedTaskAndReply( FROM_HERE, blocking_task_runner_, base::Bind(&GetLocalFileSizeOnBlockingPool, @@ -1463,7 +1467,7 @@ void DriveFileSystem::OnUpdatedFileUploaded( DriveFileError error, const FilePath& drive_path, const FilePath& file_path, - scoped_ptr<gdata::DocumentEntry> document_entry) { + scoped_ptr<google_apis::DocumentEntry> document_entry) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (error != DRIVE_FILE_OK) { @@ -1472,7 +1476,7 @@ void DriveFileSystem::OnUpdatedFileUploaded( return; } - AddUploadedFile(gdata::UPLOAD_EXISTING_FILE, + AddUploadedFile(google_apis::UPLOAD_EXISTING_FILE, drive_path.DirName(), document_entry.Pass(), file_path, @@ -1484,10 +1488,10 @@ void DriveFileSystem::GetAvailableSpace( const GetAvailableSpaceCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || BrowserThread::CurrentlyOn(BrowserThread::IO)); - gdata::RunTaskOnUIThread( + google_apis::RunTaskOnUIThread( base::Bind(&DriveFileSystem::GetAvailableSpaceOnUIThread, ui_weak_ptr_, - gdata::CreateRelayCallback(callback))); + google_apis::CreateRelayCallback(callback))); } void DriveFileSystem::GetAvailableSpaceOnUIThread( @@ -1496,7 +1500,7 @@ void DriveFileSystem::GetAvailableSpaceOnUIThread( DCHECK(!callback.is_null()); drive_service_->GetAccountMetadata( - gdata::util::IsDriveV2ApiEnabled() ? + google_apis::util::IsDriveV2ApiEnabled() ? base::Bind(&DriveFileSystem::OnGetAboutResource, ui_weak_ptr_, callback) : @@ -1507,7 +1511,7 @@ void DriveFileSystem::GetAvailableSpaceOnUIThread( void DriveFileSystem::OnGetAvailableSpace( const GetAvailableSpaceCallback& callback, - gdata::GDataErrorCode status, + google_apis::GDataErrorCode status, scoped_ptr<base::Value> data) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -1518,9 +1522,9 @@ void DriveFileSystem::OnGetAvailableSpace( return; } - scoped_ptr<gdata::AccountMetadataFeed> feed; + scoped_ptr<google_apis::AccountMetadataFeed> feed; if (data.get()) - feed = gdata::AccountMetadataFeed::CreateFrom(*data); + feed = google_apis::AccountMetadataFeed::CreateFrom(*data); if (!feed.get()) { callback.Run(DRIVE_FILE_ERROR_FAILED, -1, -1); return; @@ -1533,7 +1537,7 @@ void DriveFileSystem::OnGetAvailableSpace( void DriveFileSystem::OnGetAboutResource( const GetAvailableSpaceCallback& callback, - gdata::GDataErrorCode status, + google_apis::GDataErrorCode status, scoped_ptr<base::Value> resource_json) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -1544,9 +1548,9 @@ void DriveFileSystem::OnGetAboutResource( return; } - scoped_ptr<gdata::AboutResource> about; + scoped_ptr<google_apis::AboutResource> about; if (resource_json.get()) - about = gdata::AboutResource::CreateFrom(*resource_json); + about = google_apis::AboutResource::CreateFrom(*resource_json); if (!about.get()) { callback.Run(DRIVE_FILE_ERROR_FAILED, -1, -1); @@ -1560,7 +1564,7 @@ void DriveFileSystem::OnGetAboutResource( void DriveFileSystem::AddNewDirectory( const CreateDirectoryParams& params, - gdata::GDataErrorCode status, + google_apis::GDataErrorCode status, scoped_ptr<base::Value> data) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!params.callback.is_null()); @@ -1573,8 +1577,8 @@ void DriveFileSystem::AddNewDirectory( resource_metadata_->AddEntryToDirectory( params.created_directory_path.DirName(), - scoped_ptr<gdata::DocumentEntry>( - gdata::DocumentEntry::ExtractAndParse(*data)), + scoped_ptr<google_apis::DocumentEntry>( + google_apis::DocumentEntry::ExtractAndParse(*data)), base::Bind(&DriveFileSystem::ContinueCreateDirectory, ui_weak_ptr_, params)); @@ -1628,7 +1632,7 @@ void DriveFileSystem::OnSearch(const SearchCallback& search_callback, scoped_ptr<std::vector<SearchResultInfo> > result_vec(results); DCHECK_EQ(1u, params->feed_list.size()); - gdata::DocumentFeed* feed = params->feed_list[0]; + google_apis::DocumentFeed* feed = params->feed_list[0]; // TODO(tbarzic): Limit total number of returned results for the query. GURL next_feed; @@ -1637,7 +1641,7 @@ void DriveFileSystem::OnSearch(const SearchCallback& search_callback, const base::Closure callback = base::Bind( search_callback, DRIVE_FILE_OK, next_feed, base::Passed(&result_vec)); - std::vector<gdata::DocumentEntry*> entries; + std::vector<google_apis::DocumentEntry*> entries; feed->ReleaseEntries(&entries); if (entries.empty()) { callback.Run(); @@ -1651,7 +1655,7 @@ void DriveFileSystem::OnSearch(const SearchCallback& search_callback, // Run the callback if this is the last iteration of the loop. const bool should_run_callback = (i+1 == entries.size()); resource_metadata_->RefreshFile( - scoped_ptr<gdata::DocumentEntry>(entries[i]), + scoped_ptr<google_apis::DocumentEntry>(entries[i]), base::Bind(&DriveFileSystem::AddToSearchResults, ui_weak_ptr_, results, @@ -1693,11 +1697,12 @@ void DriveFileSystem::Search(const std::string& search_query, BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(!callback.is_null()); - gdata::RunTaskOnUIThread(base::Bind(&DriveFileSystem::SearchAsyncOnUIThread, - ui_weak_ptr_, - search_query, - next_feed, - gdata::CreateRelayCallback(callback))); + google_apis::RunTaskOnUIThread( + base::Bind(&DriveFileSystem::SearchAsyncOnUIThread, + ui_weak_ptr_, + search_query, + next_feed, + google_apis::CreateRelayCallback(callback))); } void DriveFileSystem::SearchAsyncOnUIThread( @@ -1749,7 +1754,7 @@ void DriveFileSystem::LoadRootFeedFromCacheForTesting() { } DriveFileError DriveFileSystem::UpdateFromFeedForTesting( - const ScopedVector<gdata::DocumentFeed>& feed_list, + const ScopedVector<google_apis::DocumentFeed>& feed_list, int64 start_changestamp, int64 root_feed_changestamp) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -1761,7 +1766,7 @@ DriveFileError DriveFileSystem::UpdateFromFeedForTesting( void DriveFileSystem::OnFileDownloaded( const GetFileFromCacheParams& params, - gdata::GDataErrorCode status, + google_apis::GDataErrorCode status, const GURL& content_url, const FilePath& downloaded_file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -1769,7 +1774,7 @@ void DriveFileSystem::OnFileDownloaded( // If user cancels download of a pinned-but-not-fetched file, mark file as // unpinned so that we do not sync the file again. - if (status == gdata::GDATA_CANCELLED) { + if (status == google_apis::GDATA_CANCELLED) { cache_->GetCacheEntryOnUIThread( params.resource_id, params.md5, @@ -1788,7 +1793,7 @@ void DriveFileSystem::OnFileDownloaded( // If we don't have enough space, we return PLATFORM_FILE_ERROR_NO_SPACE, // and try to free up space, even if the file was downloaded successfully. bool* has_enough_space = new bool(false); - gdata::util::PostBlockingPoolSequencedTaskAndReply( + google_apis::util::PostBlockingPoolSequencedTaskAndReply( FROM_HERE, blocking_task_runner_, base::Bind(&DriveCache::FreeDiskSpaceIfNeededFor, @@ -1818,7 +1823,7 @@ void DriveFileSystem::UnpinIfPinned( void DriveFileSystem::OnFileDownloadedAndSpaceChecked( const GetFileFromCacheParams& params, - gdata::GDataErrorCode status, + google_apis::GDataErrorCode status, const GURL& content_url, const FilePath& downloaded_file_path, bool* has_enough_space) { @@ -1842,7 +1847,7 @@ void DriveFileSystem::OnFileDownloadedAndSpaceChecked( } else { // If we don't have enough space, remove the downloaded file, and // report "no space" error. - gdata::util::PostBlockingPoolSequencedTask( + google_apis::util::PostBlockingPoolSequencedTask( FROM_HERE, blocking_task_runner_, base::Bind(base::IgnoreResult(&file_util::Delete), @@ -1985,9 +1990,9 @@ void DriveFileSystem::ContinueFindFirstMissingParentDirectory( } void DriveFileSystem::AddUploadedFile( - gdata::UploadMode upload_mode, + google_apis::UploadMode upload_mode, const FilePath& directory_path, - scoped_ptr<gdata::DocumentEntry> entry, + scoped_ptr<google_apis::DocumentEntry> entry, const FilePath& file_content_path, DriveCache::FileOperationType cache_operation, const base::Closure& callback) { @@ -2008,9 +2013,9 @@ void DriveFileSystem::AddUploadedFile( } void DriveFileSystem::AddUploadedFileOnUIThread( - gdata::UploadMode upload_mode, + google_apis::UploadMode upload_mode, const FilePath& directory_path, - scoped_ptr<gdata::DocumentEntry> doc_entry, + scoped_ptr<google_apis::DocumentEntry> doc_entry, const FilePath& file_content_path, DriveCache::FileOperationType cache_operation, const base::Closure& callback) { @@ -2030,7 +2035,7 @@ void DriveFileSystem::AddUploadedFileOnUIThread( base::Bind(&DriveFileSystem::ContinueAddUploadedFile, ui_weak_ptr_, base::Passed(¶ms)); - if (upload_mode == gdata::UPLOAD_EXISTING_FILE) { + if (upload_mode == google_apis::UPLOAD_EXISTING_FILE) { // Remove the existing entry. resource_metadata_->RemoveEntryFromParent(resource_id, file_move_callback); } else { @@ -2053,7 +2058,7 @@ void DriveFileSystem::ContinueAddUploadedFile( // Get parameters before base::Passed() invalidates |params|. const FilePath& directory_path = params->directory_path; - scoped_ptr<gdata::DocumentEntry> doc_entry(params->doc_entry.Pass()); + scoped_ptr<google_apis::DocumentEntry> doc_entry(params->doc_entry.Pass()); resource_metadata_->AddEntryToDirectory( directory_path, @@ -2080,7 +2085,7 @@ void DriveFileSystem::AddUploadedFileToCache( OnDirectoryChanged(file_path.DirName()); - if (params->upload_mode == gdata::UPLOAD_NEW_FILE) { + if (params->upload_mode == google_apis::UPLOAD_NEW_FILE) { // Add the file to the cache if we have uploaded a new file. cache_->StoreOnUIThread(params->resource_id, params->md5, @@ -2088,7 +2093,7 @@ void DriveFileSystem::AddUploadedFileToCache( params->cache_operation, base::Bind(&OnCacheUpdatedForAddUploadedFile, params->callback)); - } else if (params->upload_mode == gdata::UPLOAD_EXISTING_FILE) { + } else if (params->upload_mode == google_apis::UPLOAD_EXISTING_FILE) { // Clear the dirty bit if we have updated an existing file. cache_->ClearDirtyOnUIThread(params->resource_id, params->md5, @@ -2103,11 +2108,12 @@ void DriveFileSystem::AddUploadedFileToCache( } } -void DriveFileSystem::UpdateEntryData(const std::string& resource_id, - const std::string& md5, - scoped_ptr<gdata::DocumentEntry> entry, - const FilePath& file_content_path, - const base::Closure& callback) { +void DriveFileSystem::UpdateEntryData( + const std::string& resource_id, + const std::string& md5, + scoped_ptr<google_apis::DocumentEntry> entry, + const FilePath& file_content_path, + const base::Closure& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // Post a task to the same thread, rather than calling it here, as @@ -2125,7 +2131,7 @@ void DriveFileSystem::UpdateEntryData(const std::string& resource_id, void DriveFileSystem::UpdateEntryDataOnUIThread( const UpdateEntryParams& params, - scoped_ptr<gdata::DocumentEntry> entry) { + scoped_ptr<google_apis::DocumentEntry> entry) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); resource_metadata_->RefreshFile( @@ -2206,10 +2212,11 @@ void DriveFileSystem::OpenFile(const FilePath& file_path, const OpenFileCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || BrowserThread::CurrentlyOn(BrowserThread::IO)); - gdata::RunTaskOnUIThread(base::Bind(&DriveFileSystem::OpenFileOnUIThread, - ui_weak_ptr_, - file_path, - gdata::CreateRelayCallback(callback))); + google_apis::RunTaskOnUIThread( + base::Bind(&DriveFileSystem::OpenFileOnUIThread, + ui_weak_ptr_, + file_path, + google_apis::CreateRelayCallback(callback))); } void DriveFileSystem::OpenFileOnUIThread(const FilePath& file_path, @@ -2276,7 +2283,7 @@ void DriveFileSystem::OnGetEntryInfoCompleteForOpenFile( GetFileCompleteForOpenParams( entry_proto_ptr->resource_id(), entry_proto_ptr->file_specific_info().file_md5())), - gdata::GetContentCallback(), + google_apis::GetContentCallback(), entry_proto.Pass()); } @@ -2338,10 +2345,11 @@ void DriveFileSystem::CloseFile(const FilePath& file_path, BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(!callback.is_null()); - gdata::RunTaskOnUIThread(base::Bind(&DriveFileSystem::CloseFileOnUIThread, - ui_weak_ptr_, - file_path, - gdata::CreateRelayCallback(callback))); + google_apis::RunTaskOnUIThread( + base::Bind(&DriveFileSystem::CloseFileOnUIThread, + ui_weak_ptr_, + file_path, + google_apis::CreateRelayCallback(callback))); } void DriveFileSystem::CloseFileOnUIThread( @@ -2495,7 +2503,7 @@ void DriveFileSystem::CheckLocalModificationAndRunAfterGetCacheFile( // If the cache is dirty, obtain the file info from the cache file itself. base::PlatformFileInfo* file_info = new base::PlatformFileInfo; bool* get_file_info_result = new bool(false); - gdata::util::PostBlockingPoolSequencedTaskAndReply( + google_apis::util::PostBlockingPoolSequencedTaskAndReply( FROM_HERE, blocking_task_runner_, base::Bind(&GetFileInfoOnBlockingPool, diff --git a/chrome/browser/chromeos/drive/drive_file_system.h b/chrome/browser/chromeos/drive/drive_file_system.h index 3d8dece..9a4e528 100644 --- a/chrome/browser/chromeos/drive/drive_file_system.h +++ b/chrome/browser/chromeos/drive/drive_file_system.h @@ -27,7 +27,7 @@ struct PlatformFileInfo; class SequencedTaskRunner; } -namespace gdata { +namespace google_apis { class DocumentFeed; } @@ -111,11 +111,11 @@ class DriveFileSystem : public DriveFileSystemInterface, virtual void GetFileByPath( const FilePath& file_path, const GetFileCallback& get_file_callback, - const gdata::GetContentCallback& get_content_callback) OVERRIDE; + const google_apis::GetContentCallback& get_content_callback) OVERRIDE; virtual void GetFileByResourceId( const std::string& resource_id, const GetFileCallback& get_file_callback, - const gdata::GetContentCallback& get_content_callback) OVERRIDE; + const google_apis::GetContentCallback& get_content_callback) OVERRIDE; virtual void UpdateFileByResourceId( const std::string& resource_id, const FileOperationCallback& callback) OVERRIDE; @@ -129,15 +129,15 @@ class DriveFileSystem : public DriveFileSystemInterface, const FilePath& directory_path) OVERRIDE; virtual void GetAvailableSpace( const GetAvailableSpaceCallback& callback) OVERRIDE; - virtual void AddUploadedFile(gdata::UploadMode upload_mode, + virtual void AddUploadedFile(google_apis::UploadMode upload_mode, const FilePath& directory_path, - scoped_ptr<gdata::DocumentEntry> doc_entry, + scoped_ptr<google_apis::DocumentEntry> doc_entry, const FilePath& file_content_path, DriveCache::FileOperationType cache_operation, const base::Closure& callback) OVERRIDE; virtual void UpdateEntryData(const std::string& resource_id, const std::string& md5, - scoped_ptr<gdata::DocumentEntry> entry, + scoped_ptr<google_apis::DocumentEntry> entry, const FilePath& file_content_path, const base::Closure& callback) OVERRIDE; virtual DriveFileSystemMetadata GetMetadata() const OVERRIDE; @@ -163,7 +163,7 @@ class DriveFileSystem : public DriveFileSystemInterface, // Used in tests to update the file system from |feed_list|. // See also the comment at DriveFeedLoader::UpdateFromFeed(). DriveFileError UpdateFromFeedForTesting( - const ScopedVector<gdata::DocumentFeed>& feed_list, + const ScopedVector<google_apis::DocumentFeed>& feed_list, int64 start_changestamp, int64 root_feed_changestamp); @@ -292,7 +292,7 @@ class DriveFileSystem : public DriveFileSystemInterface, void OnGetEntryInfoCompleteForGetFileByPath( const FilePath& file_path, const GetFileCallback& get_file_callback, - const gdata::GetContentCallback& get_content_callback, + const google_apis::GetContentCallback& get_content_callback, DriveFileError error, scoped_ptr<DriveEntryProto> file_info); @@ -358,18 +358,18 @@ class DriveFileSystem : public DriveFileSystemInterface, // Callback for handling account metadata fetch. void OnGetAvailableSpace(const GetAvailableSpaceCallback& callback, - gdata::GDataErrorCode status, + google_apis::GDataErrorCode status, scoped_ptr<base::Value> data); // Callback for handling Drive V2 about resource fetch. void OnGetAboutResource(const GetAvailableSpaceCallback& callback, - gdata::GDataErrorCode status, + google_apis::GDataErrorCode status, scoped_ptr<base::Value> data); // Callback for handling directory create requests. Adds the directory // represented by |created_entry| to the local filesystem. void AddNewDirectory(const CreateDirectoryParams& params, - gdata::GDataErrorCode status, + google_apis::GDataErrorCode status, scoped_ptr<base::Value> created_entry); // Callback for DriveResourceMetadata::AddEntryToDirectory. Continues the @@ -381,7 +381,7 @@ class DriveFileSystem : public DriveFileSystemInterface, // Callback for handling file downloading requests. void OnFileDownloaded(const GetFileFromCacheParams& params, - gdata::GDataErrorCode status, + google_apis::GDataErrorCode status, const GURL& content_url, const FilePath& downloaded_file_path); @@ -394,7 +394,7 @@ class DriveFileSystem : public DriveFileSystemInterface, // Similar to OnFileDownloaded() but takes |has_enough_space| so we report // an error in case we don't have enough disk space. void OnFileDownloadedAndSpaceChecked(const GetFileFromCacheParams& params, - gdata::GDataErrorCode status, + google_apis::GDataErrorCode status, const GURL& content_url, const FilePath& downloaded_file_path, bool* has_enough_space); @@ -467,7 +467,7 @@ class DriveFileSystem : public DriveFileSystemInterface, // file download procedure is started for the file. The file is downloaded // from the content url extracted from the fetched metadata. void OnGetDocumentEntry(const GetFileFromCacheParams& params, - gdata::GDataErrorCode status, + google_apis::GDataErrorCode status, scoped_ptr<base::Value> data); // Check available space using file size from the fetched metadata. Called @@ -532,7 +532,7 @@ class DriveFileSystem : public DriveFileSystemInterface, void GetResolvedFileByPath( const FilePath& file_path, const GetFileCallback& get_file_callback, - const gdata::GetContentCallback& get_content_callback, + const google_apis::GetContentCallback& get_content_callback, scoped_ptr<DriveEntryProto> entry_proto); // Part of UpdateFileByResourceId(). Called when @@ -569,11 +569,12 @@ class DriveFileSystem : public DriveFileSystemInterface, // Called when DriveUploader::UploadUpdatedFile() is completed for // UpdateFileByResourceId(). // |callback| must not be null. - void OnUpdatedFileUploaded(const FileOperationCallback& callback, - DriveFileError error, - const FilePath& gdata_path, - const FilePath& file_path, - scoped_ptr<gdata::DocumentEntry> document_entry); + void OnUpdatedFileUploaded( + const FileOperationCallback& callback, + DriveFileError error, + const FilePath& gdata_path, + const FilePath& file_path, + scoped_ptr<google_apis::DocumentEntry> document_entry); // The following functions are used to forward calls to asynchronous public // member functions to UI thread. @@ -603,11 +604,11 @@ class DriveFileSystem : public DriveFileSystemInterface, void GetFileByPathOnUIThread( const FilePath& file_path, const GetFileCallback& get_file_callback, - const gdata::GetContentCallback& get_content_callback); + const google_apis::GetContentCallback& get_content_callback); void GetFileByResourceIdOnUIThread( const std::string& resource_id, const GetFileCallback& get_file_callback, - const gdata::GetContentCallback& get_content_callback); + const google_apis::GetContentCallback& get_content_callback); void UpdateFileByResourceIdOnUIThread(const std::string& resource_id, const FileOperationCallback& callback); void GetEntryInfoByPathOnUIThread(const FilePath& file_path, @@ -623,14 +624,15 @@ class DriveFileSystem : public DriveFileSystemInterface, scoped_ptr<LoadFeedParams> params, DriveFileError error); void GetAvailableSpaceOnUIThread(const GetAvailableSpaceCallback& callback); - void AddUploadedFileOnUIThread(gdata::UploadMode upload_mode, - const FilePath& directory_path, - scoped_ptr<gdata::DocumentEntry> doc_entry, - const FilePath& file_content_path, - DriveCache::FileOperationType cache_operation, - const base::Closure& callback); + void AddUploadedFileOnUIThread( + google_apis::UploadMode upload_mode, + const FilePath& directory_path, + scoped_ptr<google_apis::DocumentEntry> doc_entry, + const FilePath& file_content_path, + DriveCache::FileOperationType cache_operation, + const base::Closure& callback); void UpdateEntryDataOnUIThread(const UpdateEntryParams& params, - scoped_ptr<gdata::DocumentEntry> entry); + scoped_ptr<google_apis::DocumentEntry> entry); // Part of CreateDirectory(). Called after // FindFirstMissingParentDirectory() is complete. @@ -657,7 +659,7 @@ class DriveFileSystem : public DriveFileSystemInterface, // |get_content_callback| may be null. void GetFileByResourceIdAfterGetEntry( const GetFileCallback& get_file_callback, - const gdata::GetContentCallback& get_content_callback, + const google_apis::GetContentCallback& get_content_callback, DriveFileError error, const FilePath& file_path, scoped_ptr<DriveEntryProto> entry_proto); diff --git a/chrome/browser/chromeos/drive/drive_file_system_interface.h b/chrome/browser/chromeos/drive/drive_file_system_interface.h index f9630d0..a5aede1 100644 --- a/chrome/browser/chromeos/drive/drive_file_system_interface.h +++ b/chrome/browser/chromeos/drive/drive_file_system_interface.h @@ -13,7 +13,7 @@ #include "chrome/browser/chromeos/drive/drive_resource_metadata.h" #include "chrome/browser/google_apis/gdata_operations.h" -namespace gdata { +namespace google_apis { class DocumentEntry; } @@ -257,7 +257,7 @@ class DriveFileSystemInterface { virtual void GetFileByPath( const FilePath& file_path, const GetFileCallback& get_file_callback, - const gdata::GetContentCallback& get_content_callback) = 0; + const google_apis::GetContentCallback& get_content_callback) = 0; // Gets a file by the given |resource_id| from the Drive server. Used for // fetching pinned-but-not-fetched files. @@ -269,7 +269,7 @@ class DriveFileSystemInterface { virtual void GetFileByResourceId( const std::string& resource_id, const GetFileCallback& get_file_callback, - const gdata::GetContentCallback& get_content_callback) = 0; + const google_apis::GetContentCallback& get_content_callback) = 0; // Updates a file by the given |resource_id| on the Drive server by // uploading an updated version. Used for uploading dirty files. The file @@ -342,9 +342,9 @@ class DriveFileSystemInterface { // and clears the dirty bit in the cache. // // |callback| will be called on the UI thread upon completion of operation. - virtual void AddUploadedFile(gdata::UploadMode upload_mode, + virtual void AddUploadedFile(google_apis::UploadMode upload_mode, const FilePath& directory_path, - scoped_ptr<gdata::DocumentEntry> doc_entry, + scoped_ptr<google_apis::DocumentEntry> doc_entry, const FilePath& file_content_path, DriveCache::FileOperationType cache_operation, const base::Closure& callback) = 0; @@ -355,7 +355,7 @@ class DriveFileSystemInterface { // |callback| will be called on the UI thread upon completion of operation. virtual void UpdateEntryData(const std::string& resource_id, const std::string& md5, - scoped_ptr<gdata::DocumentEntry> entry, + scoped_ptr<google_apis::DocumentEntry> entry, const FilePath& file_content_path, const base::Closure& callback) = 0; diff --git a/chrome/browser/chromeos/drive/drive_file_system_proxy.cc b/chrome/browser/chromeos/drive/drive_file_system_proxy.cc index da8fce6..2c0159e 100644 --- a/chrome/browser/chromeos/drive/drive_file_system_proxy.cc +++ b/chrome/browser/chromeos/drive/drive_file_system_proxy.cc @@ -521,7 +521,7 @@ void DriveFileSystemProxy::OpenFile( callback, file_flags, peer_handle), - gdata::GetContentCallback()); + google_apis::GetContentCallback()); } } else if ((file_flags & base::PLATFORM_FILE_CREATE) || (file_flags & base::PLATFORM_FILE_CREATE_ALWAYS)) { @@ -617,7 +617,7 @@ void DriveFileSystemProxy::OnGetEntryInfoByPath( base::Bind(&CallSnapshotFileCallback, callback, file_info), - gdata::GetContentCallback()); + google_apis::GetContentCallback()); } void DriveFileSystemProxy::CreateWritableSnapshotFile( diff --git a/chrome/browser/chromeos/drive/drive_file_system_unittest.cc b/chrome/browser/chromeos/drive/drive_file_system_unittest.cc index 4153797..b2a59b5 100644 --- a/chrome/browser/chromeos/drive/drive_file_system_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_file_system_unittest.cc @@ -91,7 +91,7 @@ ACTION_P2(MockGetDocumentEntry, status, value) { // DriveUploaderInterface::UploadExistingFile(). ACTION_P4(MockUploadExistingFile, error, drive_path, local_file_path, document_entry) { - scoped_ptr<gdata::DocumentEntry> scoped_document_entry(document_entry); + scoped_ptr<google_apis::DocumentEntry> scoped_document_entry(document_entry); base::MessageLoopProxy::current()->PostTask(FROM_HERE, base::Bind(arg5, error, @@ -107,9 +107,9 @@ ACTION_P4(MockUploadExistingFile, // DriveUploaderInterface::UploadNewFile(). ACTION(MockUploadNewFile) { scoped_ptr<base::Value> value = - gdata::test_util::LoadJSONFile("gdata/uploaded_file.json"); - scoped_ptr<gdata::DocumentEntry> document_entry( - gdata::DocumentEntry::ExtractAndParse(*value)); + google_apis::test_util::LoadJSONFile("gdata/uploaded_file.json"); + scoped_ptr<google_apis::DocumentEntry> document_entry( + google_apis::DocumentEntry::ExtractAndParse(*value)); base::MessageLoopProxy::current()->PostTask(FROM_HERE, base::Bind(arg7, @@ -204,7 +204,7 @@ class DriveFileSystemTest : public testing::Test { file_system_->Initialize(); cache_->RequestInitializeOnUIThreadForTesting(); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); } virtual void TearDown() OVERRIDE { @@ -217,7 +217,7 @@ class DriveFileSystemTest : public testing::Test { SetFreeDiskSpaceGetterForTesting(NULL); cache_->DestroyOnUIThread(); // The cache destruction requires to post a task to the blocking pool. - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); profile_.reset(NULL); } @@ -238,7 +238,7 @@ class DriveFileSystemTest : public testing::Test { void AddDirectoryFromFile(const FilePath& directory_path, const std::string& filename) { - scoped_ptr<Value> atom = gdata::test_util::LoadJSONFile(filename); + scoped_ptr<Value> atom = google_apis::test_util::LoadJSONFile(filename); ASSERT_TRUE(atom.get()); ASSERT_TRUE(atom->GetType() == Value::TYPE_DICTIONARY); @@ -262,8 +262,9 @@ class DriveFileSystemTest : public testing::Test { false, // is_exclusive false, // is_recursive base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error)); - file_system_->AddNewDirectory(params, gdata::HTTP_SUCCESS, atom.Pass()); - gdata::test_util::RunBlockingPoolTask(); + file_system_->AddNewDirectory( + params, google_apis::HTTP_SUCCESS, atom.Pass()); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); } @@ -274,7 +275,7 @@ class DriveFileSystemTest : public testing::Test { file_path, false, base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); return error == DRIVE_FILE_OK; } @@ -293,7 +294,7 @@ class DriveFileSystemTest : public testing::Test { file_path, base::Bind(&CallbackHelper::GetEntryInfoCallback, callback_helper_.get())); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); return callback_helper_->entry_proto_.Pass(); } @@ -305,7 +306,7 @@ class DriveFileSystemTest : public testing::Test { file_path, base::Bind(&CallbackHelper::ReadDirectoryCallback, callback_helper_.get())); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); return callback_helper_->directory_entries_.Pass(); } @@ -339,7 +340,7 @@ class DriveFileSystemTest : public testing::Test { md5, cache_entry, &result)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); return result; } @@ -387,7 +388,7 @@ class DriveFileSystemTest : public testing::Test { base::Bind(&DriveFileSystemTest::VerifyCacheFileState, base::Unretained(this))); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); } void TestPin( @@ -405,7 +406,7 @@ class DriveFileSystemTest : public testing::Test { base::Bind(&DriveFileSystemTest::VerifyCacheFileState, base::Unretained(this))); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); } void TestMarkDirty( @@ -427,7 +428,7 @@ class DriveFileSystemTest : public testing::Test { resource_id, md5)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); } void VerifyMarkDirty(const std::string& resource_id, @@ -464,7 +465,7 @@ class DriveFileSystemTest : public testing::Test { base::Bind(&DriveFileSystemTest::VerifyCacheFileState, base::Unretained(this))); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); } // Verify the file identified by |resource_id| and |md5| is in the expected @@ -582,14 +583,14 @@ class DriveFileSystemTest : public testing::Test { void SetExpectationsForGetDocumentEntry(scoped_ptr<base::Value>* document, const std::string& resource_id) { EXPECT_CALL(*mock_drive_service_, GetDocumentEntry(resource_id, _)) - .WillOnce(MockGetDocumentEntry(gdata::HTTP_SUCCESS, document)); + .WillOnce(MockGetDocumentEntry(google_apis::HTTP_SUCCESS, document)); } // Loads serialized proto file from GCache, and makes sure the root // filesystem has a root at 'drive' void TestLoadMetadataFromCache() { file_system_->LoadRootFeedFromCacheForTesting(); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); } // Creates a proto file representing a filesystem with directories: @@ -1175,7 +1176,8 @@ TEST_F(DriveFileSystemTest, CachedFeadLoadingThenServerFeedLoading) { // SaveTestFileSystem and "account_metadata.json" have the same changestamp, // so no request for new feeds (i.e., call to GetDocuments) should happen. mock_drive_service_->set_account_metadata( - gdata::test_util::LoadJSONFile("gdata/account_metadata.json").release()); + google_apis::test_util::LoadJSONFile( + "gdata/account_metadata.json").release()); EXPECT_CALL(*mock_drive_service_, GetAccountMetadata(_)).Times(1); EXPECT_CALL(*mock_webapps_registry_, UpdateFromFeed(_)).Times(1); EXPECT_CALL(*mock_drive_service_, GetDocuments(_, _, _, _, _)).Times(0); @@ -1187,12 +1189,13 @@ TEST_F(DriveFileSystemTest, CachedFeadLoadingThenServerFeedLoading) { // it should change its state to FROM_SERVER, which admits periodic refresh. // To test it, call CheckForUpdates and verify it does try to check updates. mock_drive_service_->set_account_metadata( - gdata::test_util::LoadJSONFile("gdata/account_metadata.json").release()); + google_apis::test_util::LoadJSONFile( + "gdata/account_metadata.json").release()); EXPECT_CALL(*mock_drive_service_, GetAccountMetadata(_)).Times(1); EXPECT_CALL(*mock_webapps_registry_, UpdateFromFeed(_)).Times(1); file_system_->CheckForUpdates(); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); } TEST_F(DriveFileSystemTest, TransferFileFromLocalToRemote_RegularFile) { @@ -1221,9 +1224,9 @@ TEST_F(DriveFileSystemTest, TransferFileFromLocalToRemote_RegularFile) { EXPECT_FALSE(EntryExists(remote_dest_file_path)); scoped_ptr<base::Value> value = - gdata::test_util::LoadJSONFile("gdata/document_to_download.json"); - scoped_ptr<gdata::DocumentEntry> document_entry( - gdata::DocumentEntry::ExtractAndParse(*value)); + google_apis::test_util::LoadJSONFile("gdata/document_to_download.json"); + scoped_ptr<google_apis::DocumentEntry> document_entry( + google_apis::DocumentEntry::ExtractAndParse(*value)); EXPECT_CALL(*mock_uploader_, UploadNewFile(_, _, _, _, _, _, _, _, _)) .WillOnce(MockUploadNewFile()); @@ -1231,7 +1234,7 @@ TEST_F(DriveFileSystemTest, TransferFileFromLocalToRemote_RegularFile) { // Transfer the local file to Drive. file_system_->TransferFileFromLocalToRemote( local_src_file_path, remote_dest_file_path, callback); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); @@ -1267,12 +1270,12 @@ TEST_F(DriveFileSystemTest, TransferFileFromLocalToRemote_HostedDocument) { // We'll copy a hosted document using CopyDocument. // ".gdoc" suffix should be stripped when copying. scoped_ptr<base::Value> document = - gdata::test_util::LoadJSONFile("gdata/uploaded_document.json"); + google_apis::test_util::LoadJSONFile("gdata/uploaded_document.json"); EXPECT_CALL(*mock_drive_service_, CopyDocument(kResourceId, FILE_PATH_LITERAL("Document 1"), _)) - .WillOnce(MockCopyDocument(gdata::HTTP_SUCCESS, &document)); + .WillOnce(MockCopyDocument(google_apis::HTTP_SUCCESS, &document)); // We'll then add the hosted document to the destination directory. EXPECT_CALL(*mock_drive_service_, AddResourceToDirectory(_, _, _)).Times(1); @@ -1284,7 +1287,7 @@ TEST_F(DriveFileSystemTest, TransferFileFromLocalToRemote_HostedDocument) { // Transfer the local file to Drive. file_system_->TransferFileFromLocalToRemote( local_src_file_path, remote_dest_file_path, callback); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); @@ -1321,7 +1324,7 @@ TEST_F(DriveFileSystemTest, TransferFileFromRemoteToLocal_RegularFile) { // Before Download starts metadata from server will be fetched. // We will read content url from the result. scoped_ptr<base::Value> document = - gdata::test_util::LoadJSONFile("gdata/document_to_download.json"); + google_apis::test_util::LoadJSONFile("gdata/document_to_download.json"); SetExpectationsForGetDocumentEntry(&document, "file:2_file_resource_id"); // The file is obtained with the mock DriveService. @@ -1334,7 +1337,7 @@ TEST_F(DriveFileSystemTest, TransferFileFromRemoteToLocal_RegularFile) { file_system_->TransferFileFromRemoteToLocal( remote_src_file_path, local_dest_file_path, callback); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); @@ -1361,7 +1364,7 @@ TEST_F(DriveFileSystemTest, TransferFileFromRemoteToLocal_HostedDocument) { FilePath remote_src_file_path(FILE_PATH_LITERAL("drive/Document 1.gdoc")); file_system_->TransferFileFromRemoteToLocal( remote_src_file_path, local_dest_file_path, callback); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); @@ -1384,7 +1387,7 @@ TEST_F(DriveFileSystemTest, CopyNotExistingFile) { callback_helper_.get()); file_system_->Copy(src_file_path, dest_file_path, callback); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_); EXPECT_FALSE(EntryExists(src_file_path)); @@ -1413,7 +1416,7 @@ TEST_F(DriveFileSystemTest, CopyFileToNonExistingDirectory) { callback_helper_.get()); file_system_->Move(src_file_path, dest_file_path, callback); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_); EXPECT_TRUE(EntryExists(src_file_path)); @@ -1449,7 +1452,7 @@ TEST_F(DriveFileSystemTest, CopyFileToInvalidPath) { callback_helper_.get()); file_system_->Copy(src_file_path, dest_file_path, callback); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_A_DIRECTORY, callback_helper_->last_error_); @@ -1488,7 +1491,7 @@ TEST_F(DriveFileSystemTest, RenameFile) { Eq(FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); file_system_->Move(src_file_path, dest_file_path, callback); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); EXPECT_FALSE(EntryExists(src_file_path)); @@ -1537,7 +1540,7 @@ TEST_F(DriveFileSystemTest, MoveFileFromRootToSubDirectory) { Eq(FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); file_system_->Move(src_file_path, dest_file_path, callback); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); EXPECT_FALSE(EntryExists(src_file_path)); @@ -1588,7 +1591,7 @@ TEST_F(DriveFileSystemTest, MoveFileFromSubDirectoryToRoot) { Eq(FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); file_system_->Move(src_file_path, dest_file_path, callback); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); EXPECT_FALSE(EntryExists(src_file_path)); @@ -1663,7 +1666,7 @@ TEST_F(DriveFileSystemTest, MoveFileBetweenSubDirectories) { Eq(FilePath(FILE_PATH_LITERAL("drive/New Folder 1"))))).Times(1); file_system_->Move(src_file_path, dest_file_path, callback); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); EXPECT_FALSE(EntryExists(src_file_path)); @@ -1687,7 +1690,7 @@ TEST_F(DriveFileSystemTest, MoveNotExistingFile) { callback_helper_.get()); file_system_->Move(src_file_path, dest_file_path, callback); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_); EXPECT_FALSE(EntryExists(src_file_path)); @@ -1716,7 +1719,7 @@ TEST_F(DriveFileSystemTest, MoveFileToNonExistingDirectory) { callback_helper_.get()); file_system_->Move(src_file_path, dest_file_path, callback); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_); @@ -1752,7 +1755,7 @@ TEST_F(DriveFileSystemTest, MoveFileToInvalidPath) { callback_helper_.get()); file_system_->Move(src_file_path, dest_file_path, callback); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_A_DIRECTORY, callback_helper_->last_error_); @@ -1812,7 +1815,7 @@ TEST_F(DriveFileSystemTest, RemoveEntries) { EXPECT_FALSE(RemoveEntry(FilePath(FILE_PATH_LITERAL("drive")))); // Need this to ensure OnDirectoryChanged() is run. - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); } TEST_F(DriveFileSystemTest, CreateDirectory) { @@ -1848,7 +1851,7 @@ TEST_F(DriveFileSystemTest, FindFirstMissingParentDirectory) { dir_path, base::Bind(&CopyResultFromFindFirstMissingParentDirectory, &result)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DriveFileSystem::FIND_FIRST_FOUND_MISSING, result.error); EXPECT_EQ(FilePath(FILE_PATH_LITERAL("drive/New Folder 1")), result.first_missing_parent_path); @@ -1860,7 +1863,7 @@ TEST_F(DriveFileSystemTest, FindFirstMissingParentDirectory) { dir_path2, base::Bind(&CopyResultFromFindFirstMissingParentDirectory, &result)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DriveFileSystem::FIND_FIRST_FOUND_MISSING, result.error); EXPECT_EQ(FilePath(FILE_PATH_LITERAL("drive/Directory 1/New Folder 2")), result.first_missing_parent_path); @@ -1872,7 +1875,7 @@ TEST_F(DriveFileSystemTest, FindFirstMissingParentDirectory) { dir_path3, base::Bind(&CopyResultFromFindFirstMissingParentDirectory, &result)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DriveFileSystem::FIND_FIRST_FOUND_MISSING, result.error); EXPECT_EQ(FilePath(FILE_PATH_LITERAL("drive/Directory 1/New Folder 2")), result.first_missing_parent_path); @@ -1883,7 +1886,7 @@ TEST_F(DriveFileSystemTest, FindFirstMissingParentDirectory) { FilePath(FILE_PATH_LITERAL("drive/File 1.txt/BadDir")), base::Bind(&CopyResultFromFindFirstMissingParentDirectory, &result)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DriveFileSystem::FIND_FIRST_FOUND_INVALID, result.error); // Existing folder. @@ -1891,7 +1894,7 @@ TEST_F(DriveFileSystemTest, FindFirstMissingParentDirectory) { FilePath(FILE_PATH_LITERAL("drive/Directory 1")), base::Bind(&CopyResultFromFindFirstMissingParentDirectory, &result)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DriveFileSystem::FIND_FIRST_DIRECTORY_ALREADY_PRESENT, result.error); } @@ -1912,7 +1915,7 @@ TEST_F(DriveFileSystemTest, CreateDirectoryWithService) { true, // is_recursive base::Bind(&CallbackHelper::FileOperationCallback, callback_helper_.get())); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); // TODO(gspencer): Uncomment this when we get a blob that // works that can be returned from the mock. // EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); @@ -1939,7 +1942,7 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_EnoughSpace) { // Before Download starts metadata from server will be fetched. // We will read content url from the result. scoped_ptr<base::Value> document = - gdata::test_util::LoadJSONFile("gdata/document_to_download.json"); + google_apis::test_util::LoadJSONFile("gdata/document_to_download.json"); SetExpectationsForGetDocumentEntry(&document, "file:2_file_resource_id"); // The file is obtained with the mock DriveService. @@ -1951,8 +1954,8 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_EnoughSpace) { .Times(1); file_system_->GetFileByPath(file_in_root, callback, - gdata::GetContentCallback()); - gdata::test_util::RunBlockingPoolTask(); + google_apis::GetContentCallback()); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); EXPECT_EQ(REGULAR_FILE, callback_helper_->file_type_); @@ -1980,7 +1983,7 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_NoSpaceAtAll) { // Before Download starts metadata from server will be fetched. // We will read content url from the result. scoped_ptr<base::Value> document = - gdata::test_util::LoadJSONFile("gdata/document_to_download.json"); + google_apis::test_util::LoadJSONFile("gdata/document_to_download.json"); SetExpectationsForGetDocumentEntry(&document, "file:2_file_resource_id"); // The file is not obtained with the mock DriveService, because of no space. @@ -1992,8 +1995,8 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_NoSpaceAtAll) { .Times(0); file_system_->GetFileByPath(file_in_root, callback, - gdata::GetContentCallback()); - gdata::test_util::RunBlockingPoolTask(); + google_apis::GetContentCallback()); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NO_SPACE, callback_helper_->last_error_); @@ -2025,7 +2028,8 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_NoEnoughSpaceButCanFreeUp) { // Store something in the temporary cache directory. TestStoreToCache("<resource_id>", "<md5>", - gdata::test_util::GetTestFilePath("gdata/root_feed.json"), + google_apis::test_util::GetTestFilePath( + "gdata/root_feed.json"), DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); @@ -2035,7 +2039,7 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_NoEnoughSpaceButCanFreeUp) { // Before Download starts metadata from server will be fetched. // We will read content url from the result. scoped_ptr<base::Value> document = - gdata::test_util::LoadJSONFile("gdata/document_to_download.json"); + google_apis::test_util::LoadJSONFile("gdata/document_to_download.json"); SetExpectationsForGetDocumentEntry(&document, "file:2_file_resource_id"); // The file is obtained with the mock DriveService, because of we freed up the @@ -2048,8 +2052,8 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_NoEnoughSpaceButCanFreeUp) { .Times(1); file_system_->GetFileByPath(file_in_root, callback, - gdata::GetContentCallback()); - gdata::test_util::RunBlockingPoolTask(); + google_apis::GetContentCallback()); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); EXPECT_EQ(REGULAR_FILE, callback_helper_->file_type_); @@ -2088,7 +2092,7 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_EnoughSpaceButBecomeFull) { // Before Download starts metadata from server will be fetched. // We will read content url from the result. scoped_ptr<base::Value> document = - gdata::test_util::LoadJSONFile("gdata/document_to_download.json"); + google_apis::test_util::LoadJSONFile("gdata/document_to_download.json"); SetExpectationsForGetDocumentEntry(&document, "file:2_file_resource_id"); // The file is obtained with the mock DriveService. @@ -2100,8 +2104,8 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_EnoughSpaceButBecomeFull) { .Times(1); file_system_->GetFileByPath(file_in_root, callback, - gdata::GetContentCallback()); - gdata::test_util::RunBlockingPoolTask(); + google_apis::GetContentCallback()); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NO_SPACE, callback_helper_->last_error_); @@ -2126,7 +2130,8 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromCache) { // Store something as cached version of this file. TestStoreToCache(entry_proto->resource_id(), entry_proto->file_specific_info().file_md5(), - gdata::test_util::GetTestFilePath("gdata/root_feed.json"), + google_apis::test_util::GetTestFilePath( + "gdata/root_feed.json"), DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); @@ -2143,8 +2148,8 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromCache) { .Times(0); file_system_->GetFileByPath(file_in_root, callback, - gdata::GetContentCallback()); - gdata::test_util::RunBlockingPoolTask(); + google_apis::GetContentCallback()); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(REGULAR_FILE, callback_helper_->file_type_); EXPECT_EQ(downloaded_file.value(), @@ -2164,8 +2169,8 @@ TEST_F(DriveFileSystemTest, GetFileByPath_HostedDocument) { ASSERT_TRUE(src_entry_proto.get()); file_system_->GetFileByPath(file_in_root, callback, - gdata::GetContentCallback()); - gdata::test_util::RunBlockingPoolTask(); + google_apis::GetContentCallback()); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(HOSTED_DOCUMENT, callback_helper_->file_type_); EXPECT_FALSE(callback_helper_->download_path_.empty()); @@ -2194,7 +2199,7 @@ TEST_F(DriveFileSystemTest, GetFileByResourceId) { // Before Download starts metadata from server will be fetched. // We will read content url from the result. scoped_ptr<base::Value> document = - gdata::test_util::LoadJSONFile("gdata/document_to_download.json"); + google_apis::test_util::LoadJSONFile("gdata/document_to_download.json"); SetExpectationsForGetDocumentEntry(&document, "file:2_file_resource_id"); // The file is obtained with the mock DriveService, because it's not stored in @@ -2208,8 +2213,8 @@ TEST_F(DriveFileSystemTest, GetFileByResourceId) { file_system_->GetFileByResourceId(entry_proto->resource_id(), callback, - gdata::GetContentCallback()); - gdata::test_util::RunBlockingPoolTask(); + google_apis::GetContentCallback()); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(REGULAR_FILE, callback_helper_->file_type_); EXPECT_EQ(downloaded_file.value(), @@ -2235,7 +2240,8 @@ TEST_F(DriveFileSystemTest, GetFileByResourceId_FromCache) { // Store something as cached version of this file. TestStoreToCache(entry_proto->resource_id(), entry_proto->file_specific_info().file_md5(), - gdata::test_util::GetTestFilePath("gdata/root_feed.json"), + google_apis::test_util::GetTestFilePath( + "gdata/root_feed.json"), DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); @@ -2247,8 +2253,8 @@ TEST_F(DriveFileSystemTest, GetFileByResourceId_FromCache) { file_system_->GetFileByResourceId(entry_proto->resource_id(), callback, - gdata::GetContentCallback()); - gdata::test_util::RunBlockingPoolTask(); + google_apis::GetContentCallback()); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(REGULAR_FILE, callback_helper_->file_type_); EXPECT_EQ(downloaded_file.value(), @@ -2283,7 +2289,8 @@ TEST_F(DriveFileSystemTest, UpdateFileByResourceId_PersistentFile) { TestStoreToCache(kResourceId, kMd5, // Anything works. - gdata::test_util::GetTestFilePath("gdata/root_feed.json"), + google_apis::test_util::GetTestFilePath( + "gdata/root_feed.json"), DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_PINNED | @@ -2333,12 +2340,12 @@ TEST_F(DriveFileSystemTest, UpdateFileByResourceId_PersistentFile) { ASSERT_TRUE(file_util::PathExists(dirty_cache_file_path)); ASSERT_TRUE(file_util::PathExists(outgoing_symlink_path)); - // Create a gdata::DocumentEntry, which is needed to mock + // Create a google_apis::DocumentEntry, which is needed to mock // DriveUploaderInterface::UploadExistingFile(). // TODO(satorux): This should be cleaned up. crbug.com/134240. - gdata::DocumentEntry* document_entry = NULL; + google_apis::DocumentEntry* document_entry = NULL; scoped_ptr<base::Value> value = - gdata::test_util::LoadJSONFile("gdata/root_feed.json"); + google_apis::test_util::LoadJSONFile("gdata/root_feed.json"); ASSERT_TRUE(value.get()); base::DictionaryValue* as_dict = NULL; base::ListValue* entry_list = NULL; @@ -2351,7 +2358,7 @@ TEST_F(DriveFileSystemTest, UpdateFileByResourceId_PersistentFile) { entry->GetString("gd$resourceId.$t", &resource_id) && resource_id == kResourceId) { // This will be deleted by UploadExistingFile(). - document_entry = gdata::DocumentEntry::CreateFrom(*entry); + document_entry = google_apis::DocumentEntry::CreateFrom(*entry); } } } @@ -2390,7 +2397,7 @@ TEST_F(DriveFileSystemTest, UpdateFileByResourceId_PersistentFile) { const int num_files_in_root = CountFiles(*root_directory_entries); file_system_->UpdateFileByResourceId(kResourceId, callback); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); // Make sure that the number of files did not change (i.e. we updated an @@ -2417,7 +2424,7 @@ TEST_F(DriveFileSystemTest, UpdateFileByResourceId_NonexistentFile) { callback_helper_.get()); file_system_->UpdateFileByResourceId(kResourceId, callback); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_); } @@ -2499,7 +2506,7 @@ TEST_F(DriveFileSystemTest, GetAvailableSpace) { EXPECT_CALL(*mock_drive_service_, GetAccountMetadata(_)); file_system_->GetAvailableSpace(callback); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(GG_LONGLONG(6789012345), callback_helper_->quota_bytes_used_); EXPECT_EQ(GG_LONGLONG(9876543210), callback_helper_->quota_bytes_total_); } @@ -2516,7 +2523,7 @@ TEST_F(DriveFileSystemTest, RequestDirectoryRefresh) { OnDirectoryChanged(Eq(FilePath(kDriveRootDirectory)))).Times(1); file_system_->RequestDirectoryRefresh(FilePath(kDriveRootDirectory)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); } TEST_F(DriveFileSystemTest, OpenAndCloseFile) { @@ -2553,7 +2560,7 @@ TEST_F(DriveFileSystemTest, OpenAndCloseFile) { // Before Download starts metadata from server will be fetched. // We will read content url from the result. scoped_ptr<base::Value> document = - gdata::test_util::LoadJSONFile("gdata/document_to_download.json"); + google_apis::test_util::LoadJSONFile("gdata/document_to_download.json"); SetExpectationsForGetDocumentEntry(&document, "file:2_file_resource_id"); // The file is obtained with the mock DriveService. diff --git a/chrome/browser/chromeos/drive/drive_file_system_util.cc b/chrome/browser/chromeos/drive/drive_file_system_util.cc index 909ce6e..3864d7b 100644 --- a/chrome/browser/chromeos/drive/drive_file_system_util.cc +++ b/chrome/browser/chromeos/drive/drive_file_system_util.cc @@ -418,23 +418,23 @@ void EnsureDirectoryExists(Profile* profile, } } -DriveFileError GDataToDriveFileError(gdata::GDataErrorCode status) { +DriveFileError GDataToDriveFileError(google_apis::GDataErrorCode status) { switch (status) { - case gdata::HTTP_SUCCESS: - case gdata::HTTP_CREATED: + case google_apis::HTTP_SUCCESS: + case google_apis::HTTP_CREATED: return DRIVE_FILE_OK; - case gdata::HTTP_UNAUTHORIZED: - case gdata::HTTP_FORBIDDEN: + case google_apis::HTTP_UNAUTHORIZED: + case google_apis::HTTP_FORBIDDEN: return DRIVE_FILE_ERROR_ACCESS_DENIED; - case gdata::HTTP_NOT_FOUND: + case google_apis::HTTP_NOT_FOUND: return DRIVE_FILE_ERROR_NOT_FOUND; - case gdata::GDATA_PARSE_ERROR: - case gdata::GDATA_FILE_ERROR: + case google_apis::GDATA_PARSE_ERROR: + case google_apis::GDATA_FILE_ERROR: return DRIVE_FILE_ERROR_ABORT; - case gdata::GDATA_NO_CONNECTION: + case google_apis::GDATA_NO_CONNECTION: return DRIVE_FILE_ERROR_NO_CONNECTION; - case gdata::HTTP_SERVICE_UNAVAILABLE: - case gdata::HTTP_INTERNAL_SERVER_ERROR: + case google_apis::HTTP_SERVICE_UNAVAILABLE: + case google_apis::HTTP_INTERNAL_SERVER_ERROR: return DRIVE_FILE_ERROR_THROTTLED; default: return DRIVE_FILE_ERROR_FAILED; diff --git a/chrome/browser/chromeos/drive/drive_file_system_util.h b/chrome/browser/chromeos/drive/drive_file_system_util.h index 93e6462..b3494a9 100644 --- a/chrome/browser/chromeos/drive/drive_file_system_util.h +++ b/chrome/browser/chromeos/drive/drive_file_system_util.h @@ -131,7 +131,7 @@ void EnsureDirectoryExists(Profile* profile, const FileOperationCallback& callback); // Converts GData error code into file platform error code. -DriveFileError GDataToDriveFileError(gdata::GDataErrorCode status); +DriveFileError GDataToDriveFileError(google_apis::GDataErrorCode status); // Returns true if the current network connection is over cellular. bool IsConnectionTypeCellular(); diff --git a/chrome/browser/chromeos/drive/drive_files.cc b/chrome/browser/chromeos/drive/drive_files.cc index da66504..8e1b1ce 100644 --- a/chrome/browser/chromeos/drive/drive_files.cc +++ b/chrome/browser/chromeos/drive/drive_files.cc @@ -36,7 +36,7 @@ DriveDirectory* DriveEntry::AsDriveDirectory() { return NULL; } -void DriveEntry::InitFromDocumentEntry(const gdata::DocumentEntry& doc) { +void DriveEntry::InitFromDocumentEntry(const google_apis::DocumentEntry& doc) { // 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 @@ -56,11 +56,13 @@ void DriveEntry::InitFromDocumentEntry(const gdata::DocumentEntry& doc) { content_url_ = doc.content_url(); deleted_ = doc.deleted(); - const gdata::Link* edit_link = doc.GetLinkByType(gdata::Link::LINK_EDIT); + const google_apis::Link* edit_link = + doc.GetLinkByType(google_apis::Link::LINK_EDIT); if (edit_link) edit_url_ = edit_link->href(); - const gdata::Link* parent_link = doc.GetLinkByType(gdata::Link::LINK_PARENT); + const google_apis::Link* parent_link = + doc.GetLinkByType(google_apis::Link::LINK_PARENT); if (parent_link) parent_resource_id_ = util::ExtractResourceIdFromUrl(parent_link->href()); } @@ -96,7 +98,7 @@ void DriveEntry::SetBaseNameFromTitle() { DriveFile::DriveFile(DriveResourceMetadata* resource_metadata) : DriveEntry(resource_metadata), - kind_(gdata::ENTRY_KIND_UNKNOWN), + kind_(google_apis::ENTRY_KIND_UNKNOWN), is_hosted_document_(false) { file_info_.is_directory = false; } @@ -116,7 +118,7 @@ void DriveFile::SetBaseNameFromTitle() { } } -void DriveFile::InitFromDocumentEntry(const gdata::DocumentEntry& doc) { +void DriveFile::InitFromDocumentEntry(const google_apis::DocumentEntry& doc) { DriveEntry::InitFromDocumentEntry(doc); // Check if this entry is a true file, or... @@ -126,8 +128,8 @@ void DriveFile::InitFromDocumentEntry(const gdata::DocumentEntry& doc) { // The resumable-edit-media link should only be present for regular // files as hosted documents are not uploadable. - const gdata::Link* upload_link = - doc.GetLinkByType(gdata::Link::LINK_RESUMABLE_EDIT_MEDIA); + const google_apis::Link* upload_link = + doc.GetLinkByType(google_apis::Link::LINK_RESUMABLE_EDIT_MEDIA); if (upload_link) upload_url_ = upload_link->href(); } else { @@ -148,13 +150,13 @@ void DriveFile::InitFromDocumentEntry(const gdata::DocumentEntry& doc) { // |is_hosted_document_| and |document_extension_| are set. SetBaseNameFromTitle(); - const gdata::Link* thumbnail_link = doc.GetLinkByType( - gdata::Link::LINK_THUMBNAIL); + const google_apis::Link* thumbnail_link = doc.GetLinkByType( + google_apis::Link::LINK_THUMBNAIL); if (thumbnail_link) thumbnail_url_ = thumbnail_link->href(); - const gdata::Link* alternate_link = doc.GetLinkByType( - gdata::Link::LINK_ALTERNATE); + const google_apis::Link* alternate_link = doc.GetLinkByType( + google_apis::Link::LINK_ALTERNATE); if (alternate_link) alternate_url_ = alternate_link->href(); } @@ -174,11 +176,12 @@ DriveDirectory* DriveDirectory::AsDriveDirectory() { return this; } -void DriveDirectory::InitFromDocumentEntry(const gdata::DocumentEntry& doc) { +void DriveDirectory::InitFromDocumentEntry( + const google_apis::DocumentEntry& doc) { DriveEntry::InitFromDocumentEntry(doc); - const gdata::Link* upload_link = - doc.GetLinkByType(gdata::Link::LINK_RESUMABLE_CREATE_MEDIA); + const google_apis::Link* upload_link = + doc.GetLinkByType(google_apis::Link::LINK_RESUMABLE_CREATE_MEDIA); if (upload_link) upload_url_ = upload_link->href(); } diff --git a/chrome/browser/chromeos/drive/drive_files.h b/chrome/browser/chromeos/drive/drive_files.h index 972d44e..04a67b6 100644 --- a/chrome/browser/chromeos/drive/drive_files.h +++ b/chrome/browser/chromeos/drive/drive_files.h @@ -40,8 +40,8 @@ class DriveEntry { virtual DriveFile* AsDriveFile(); virtual DriveDirectory* AsDriveDirectory(); - // Initializes from gdata::DocumentEntry. - virtual void InitFromDocumentEntry(const gdata::DocumentEntry& doc); + // Initializes from google_apis::DocumentEntry. + virtual void InitFromDocumentEntry(const google_apis::DocumentEntry& doc); // const versions of AsDriveFile and AsDriveDirectory. const DriveFile* AsDriveFileConst() const; @@ -171,7 +171,7 @@ class DriveFile : public DriveEntry { void FromProto(const DriveEntryProto& proto); void ToProto(DriveEntryProto* proto) const; - gdata::DriveEntryKind kind() const { return kind_; } + google_apis::DriveEntryKind kind() const { return kind_; } const GURL& thumbnail_url() const { return thumbnail_url_; } const GURL& alternate_url() const { return alternate_url_; } const std::string& content_mime_type() const { return content_mime_type_; } @@ -190,12 +190,13 @@ class DriveFile : public DriveEntry { friend class DriveResourceMetadata; // For access to ctor. explicit DriveFile(DriveResourceMetadata* resource_metadata); - // Initializes from gdata::DocumentEntry. - virtual void InitFromDocumentEntry(const gdata::DocumentEntry& doc) OVERRIDE; + // Initializes from google_apis::DocumentEntry. + virtual void InitFromDocumentEntry( + const google_apis::DocumentEntry& doc) OVERRIDE; virtual DriveFile* AsDriveFile() OVERRIDE; - gdata::DriveEntryKind kind_; // Not saved in proto. + google_apis::DriveEntryKind kind_; // Not saved in proto. GURL thumbnail_url_; GURL alternate_url_; std::string content_mime_type_; @@ -227,8 +228,9 @@ class DriveDirectory : public DriveEntry { explicit DriveDirectory(DriveResourceMetadata* resource_metadata); - // Initializes from gdata::DocumentEntry. - virtual void InitFromDocumentEntry(const gdata::DocumentEntry& doc) OVERRIDE; + // Initializes from google_apis::DocumentEntry. + virtual void InitFromDocumentEntry( + const google_apis::DocumentEntry& doc) OVERRIDE; virtual DriveDirectory* AsDriveDirectory() OVERRIDE; diff --git a/chrome/browser/chromeos/drive/drive_prefetcher.cc b/chrome/browser/chromeos/drive/drive_prefetcher.cc index 9aabfce..638dc26 100644 --- a/chrome/browser/chromeos/drive/drive_prefetcher.cc +++ b/chrome/browser/chromeos/drive/drive_prefetcher.cc @@ -104,7 +104,7 @@ void DrivePrefetcher::DoPrefetch() { resource_id, base::Bind(&DrivePrefetcher::OnPrefetchFinished, weak_ptr_factory_.GetWeakPtr()), - gdata::GetContentCallback()); + google_apis::GetContentCallback()); } void DrivePrefetcher::OnPrefetchFinished(DriveFileError error, diff --git a/chrome/browser/chromeos/drive/drive_protocol_handler.cc b/chrome/browser/chromeos/drive/drive_protocol_handler.cc index a622eab..04959e4 100644 --- a/chrome/browser/chromeos/drive/drive_protocol_handler.cc +++ b/chrome/browser/chromeos/drive/drive_protocol_handler.cc @@ -153,7 +153,7 @@ class DriveURLRequestJob : public net::URLRequestJob { // For detailed description of logic, refer to comments in definitions of // Start() and ReadRawData(). - void OnUrlFetchDownloadData(gdata::GDataErrorCode error, + void OnUrlFetchDownloadData(google_apis::GDataErrorCode error, scoped_ptr<std::string> download_data); // Called from ReadRawData, returns true if data is ready, false otherwise. bool ContinueReadFromDownloadData(int* bytes_read); @@ -261,19 +261,20 @@ void DriveURLRequestJob::Start() { // 5) Find file from file system to get its mime type, drive file path and // size of physical file. // 6) Get file from file system asynchronously with both GetFileCallback and - // gdata::GetContentCallback - this would either get it from cache or + // google_apis::GetContentCallback - this would either get it from cache or // download it from Drive. // 7) If file is downloaded from Drive: // 7.1) Whenever net::URLFetcherCore::OnReadCompleted() receives a part // of the response, it invokes // net::URLFetcherDelegate::OnURLFetchDownloadData() if // net::URLFetcherDelegate::ShouldSendDownloadData() is true. - // 7.2) gdata::DownloadFileOperation overrides the default implementations - // of the following methods of net::URLFetcherDelegate: + // 7.2) google_apis::DownloadFileOperation overrides the default + // implementations of the following methods of + // net::URLFetcherDelegate: // - ShouldSendDownloadData(): returns true for non-null - // gdata::GetContentCallback. + // google_apis::GetContentCallback. // - OnURLFetchDownloadData(): invokes non-null - // gdata::GetContentCallback + // google_apis::GetContentCallback // 7.3) DriveProtolHandler::OnURLFetchDownloadData (i.e. this class) // is at the end of the invocation chain and actually implements the // method. @@ -537,7 +538,7 @@ void DriveURLRequestJob::OnGetEntryInfoByResourceId( } void DriveURLRequestJob::OnUrlFetchDownloadData( - gdata::GDataErrorCode error, + google_apis::GDataErrorCode error, scoped_ptr<std::string> download_data) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); diff --git a/chrome/browser/chromeos/drive/drive_resource_metadata.cc b/chrome/browser/chromeos/drive/drive_resource_metadata.cc index fa144cc..4587bf1 100644 --- a/chrome/browser/chromeos/drive/drive_resource_metadata.cc +++ b/chrome/browser/chromeos/drive/drive_resource_metadata.cc @@ -186,7 +186,7 @@ DriveResourceMetadata::DriveResourceMetadata() origin_(UNINITIALIZED), ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { root_ = CreateDriveDirectory().Pass(); - if (!gdata::util::IsDriveV2ApiEnabled()) + if (!google_apis::util::IsDriveV2ApiEnabled()) InitializeRootEntry(kDriveRootDirectoryResourceId); } @@ -200,7 +200,7 @@ DriveResourceMetadata::~DriveResourceMetadata() { } scoped_ptr<DriveEntry> DriveResourceMetadata::FromDocumentEntry( - const gdata::DocumentEntry& doc) { + const google_apis::DocumentEntry& doc) { scoped_ptr<DriveEntry> entry; if (doc.is_folder()) entry = CreateDriveDirectory().Pass(); @@ -243,7 +243,7 @@ void DriveResourceMetadata::ClearRoot() { void DriveResourceMetadata::AddEntryToDirectory( const FilePath& directory_path, - scoped_ptr<gdata::DocumentEntry> doc_entry, + scoped_ptr<google_apis::DocumentEntry> doc_entry, const FileMoveCallback& callback) { DCHECK(!directory_path.empty()); DCHECK(!callback.is_null()); @@ -513,7 +513,7 @@ void DriveResourceMetadata::GetEntryInfoPairByPaths( } void DriveResourceMetadata::RefreshFile( - scoped_ptr<gdata::DocumentEntry> doc_entry, + scoped_ptr<google_apis::DocumentEntry> doc_entry, const GetEntryInfoWithFilePathCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); diff --git a/chrome/browser/chromeos/drive/drive_resource_metadata.h b/chrome/browser/chromeos/drive/drive_resource_metadata.h index 6c34395..195da00 100644 --- a/chrome/browser/chromeos/drive/drive_resource_metadata.h +++ b/chrome/browser/chromeos/drive/drive_resource_metadata.h @@ -20,7 +20,7 @@ namespace base { class SequencedTaskRunner; } -namespace gdata { +namespace google_apis { class DocumentEntry; } @@ -151,8 +151,9 @@ class DriveResourceMetadata { ContentOrigin origin() const { return origin_; } void set_origin(ContentOrigin value) { origin_ = value; } - // Creates a DriveEntry from a gdata::DocumentEntry. - scoped_ptr<DriveEntry> FromDocumentEntry(const gdata::DocumentEntry& doc); + // Creates a DriveEntry from a google_apis::DocumentEntry. + scoped_ptr<DriveEntry> FromDocumentEntry( + const google_apis::DocumentEntry& doc); // Creates a DriveFile instance. scoped_ptr<DriveFile> CreateDriveFile(); @@ -167,7 +168,7 @@ class DriveResourceMetadata { // callback asynchronously. // |callback| must not be null. void AddEntryToDirectory(const FilePath& directory_path, - scoped_ptr<gdata::DocumentEntry> doc_entry, + scoped_ptr<google_apis::DocumentEntry> doc_entry, const FileMoveCallback& callback); // Moves entry specified by |file_path| to the directory specified by @@ -241,7 +242,7 @@ class DriveResourceMetadata { // it to the parent of the old entry. For directories, this just returns the // existing directory proto. |callback| is run with the error, file path and // proto of the entry. |callback| must not be null. - void RefreshFile(scoped_ptr<gdata::DocumentEntry> doc_entry, + void RefreshFile(scoped_ptr<google_apis::DocumentEntry> doc_entry, const GetEntryInfoWithFilePathCallback& callback); // Removes all child files of |directory| and replace with file_map. diff --git a/chrome/browser/chromeos/drive/drive_resource_metadata_unittest.cc b/chrome/browser/chromeos/drive/drive_resource_metadata_unittest.cc index 45300dd..12e2bdc 100644 --- a/chrome/browser/chromeos/drive/drive_resource_metadata_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_resource_metadata_unittest.cc @@ -181,7 +181,7 @@ TEST_F(DriveResourceMetadataTest, GetEntryInfoByResourceId) { "file_resource_id:file4", base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback, &error, &drive_file_path, &entry_proto)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file4"), drive_file_path); ASSERT_TRUE(entry_proto.get()); @@ -194,7 +194,7 @@ TEST_F(DriveResourceMetadataTest, GetEntryInfoByResourceId) { "file:non_existing", base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback, &error, &drive_file_path, &entry_proto)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); EXPECT_FALSE(entry_proto.get()); } @@ -207,7 +207,7 @@ TEST_F(DriveResourceMetadataTest, GetEntryInfoByPath) { FilePath::FromUTF8Unsafe("drive/dir1/file4"), base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback, &error, &entry_proto)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); ASSERT_TRUE(entry_proto.get()); EXPECT_EQ("file4", entry_proto->base_name()); @@ -219,7 +219,7 @@ TEST_F(DriveResourceMetadataTest, GetEntryInfoByPath) { FilePath::FromUTF8Unsafe("drive/dir1/non_existing"), base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback, &error, &entry_proto)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); EXPECT_FALSE(entry_proto.get()); } @@ -232,7 +232,7 @@ TEST_F(DriveResourceMetadataTest, ReadDirectoryByPath) { FilePath::FromUTF8Unsafe("drive/dir1"), base::Bind(&test_util::CopyResultsFromReadDirectoryCallback, &error, &entries)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); ASSERT_TRUE(entries.get()); ASSERT_EQ(3U, entries->size()); @@ -254,7 +254,7 @@ TEST_F(DriveResourceMetadataTest, ReadDirectoryByPath) { FilePath::FromUTF8Unsafe("drive/non_existing"), base::Bind(&test_util::CopyResultsFromReadDirectoryCallback, &error, &entries)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); EXPECT_FALSE(entries.get()); @@ -265,7 +265,7 @@ TEST_F(DriveResourceMetadataTest, ReadDirectoryByPath) { FilePath::FromUTF8Unsafe("drive/dir1/file4"), base::Bind(&test_util::CopyResultsFromReadDirectoryCallback, &error, &entries)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_A_DIRECTORY, error); EXPECT_FALSE(entries.get()); } @@ -278,7 +278,7 @@ TEST_F(DriveResourceMetadataTest, GetEntryInfoPairByPaths) { FilePath::FromUTF8Unsafe("drive/dir1/file5"), base::Bind(&test_util::CopyResultsFromGetEntryInfoPairCallback, &pair_result)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); // The first entry should be found. EXPECT_EQ(DRIVE_FILE_OK, pair_result->first.error); EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file4"), @@ -299,7 +299,7 @@ TEST_F(DriveResourceMetadataTest, GetEntryInfoPairByPaths) { FilePath::FromUTF8Unsafe("drive/dir1/file5"), base::Bind(&test_util::CopyResultsFromGetEntryInfoPairCallback, &pair_result)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); // The first entry should not be found. EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, pair_result->first.error); EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/non_existent"), @@ -317,7 +317,7 @@ TEST_F(DriveResourceMetadataTest, GetEntryInfoPairByPaths) { FilePath::FromUTF8Unsafe("drive/dir1/non_existent"), base::Bind(&test_util::CopyResultsFromGetEntryInfoPairCallback, &pair_result)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); // The first entry should be found. EXPECT_EQ(DRIVE_FILE_OK, pair_result->first.error); EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file4"), @@ -344,25 +344,25 @@ TEST_F(DriveResourceMetadataTest, DBTest) { // doesn't exist. resource_metadata_.InitFromDB(db_path, blocking_task_runner, base::Bind(&InitFromDBCallback, DRIVE_FILE_ERROR_NOT_FOUND)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); // Create a file system and write it to disk. // We cannot call SaveToDB without first having called InitFromDB because // InitFrom initializes the db_path and blocking_task_runner needed by // SaveToDB. resource_metadata_.SaveToDB(); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); // InitFromDB should fail with DRIVE_FILE_ERROR_IN_USE. resource_metadata_.InitFromDB(db_path, blocking_task_runner, base::Bind(&InitFromDBCallback, DRIVE_FILE_ERROR_IN_USE)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); // InitFromDB should succeed. DriveResourceMetadata test_resource_metadata; test_resource_metadata.InitFromDB(db_path, blocking_task_runner, base::Bind(&InitFromDBCallback, DRIVE_FILE_OK)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); // Verify by checking for drive/dir2, which should have 3 children. DriveFileError error = DRIVE_FILE_ERROR_FAILED; @@ -371,7 +371,7 @@ TEST_F(DriveResourceMetadataTest, DBTest) { FilePath::FromUTF8Unsafe("drive/dir2"), base::Bind(&test_util::CopyResultsFromReadDirectoryCallback, &error, &entries)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); ASSERT_TRUE(entries.get()); ASSERT_EQ(3U, entries->size()); @@ -387,7 +387,7 @@ TEST_F(DriveResourceMetadataTest, RemoveEntryFromParent) { file9_resource_id, base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback, &error, &drive_file_path, &entry_proto)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/dir3/file9"), drive_file_path); ASSERT_TRUE(entry_proto.get()); @@ -398,7 +398,7 @@ TEST_F(DriveResourceMetadataTest, RemoveEntryFromParent) { file9_resource_id, base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/dir3"), drive_file_path); @@ -407,7 +407,7 @@ TEST_F(DriveResourceMetadataTest, RemoveEntryFromParent) { file9_resource_id, base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback, &error, &drive_file_path, &entry_proto)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); EXPECT_FALSE(entry_proto.get()); @@ -417,7 +417,7 @@ TEST_F(DriveResourceMetadataTest, RemoveEntryFromParent) { dir3_resource_id, base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback, &error, &drive_file_path, &entry_proto)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/dir3"), drive_file_path); ASSERT_TRUE(entry_proto.get()); @@ -428,7 +428,7 @@ TEST_F(DriveResourceMetadataTest, RemoveEntryFromParent) { dir3_resource_id, base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1"), drive_file_path); @@ -437,7 +437,7 @@ TEST_F(DriveResourceMetadataTest, RemoveEntryFromParent) { dir3_resource_id, base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback, &error, &drive_file_path, &entry_proto)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); EXPECT_FALSE(entry_proto.get()); @@ -446,7 +446,7 @@ TEST_F(DriveResourceMetadataTest, RemoveEntryFromParent) { "foo", base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); // Try removing root. This should fail. @@ -454,7 +454,7 @@ TEST_F(DriveResourceMetadataTest, RemoveEntryFromParent) { kDriveRootDirectoryResourceId, base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_ACCESS_DENIED, error); } @@ -469,7 +469,7 @@ TEST_F(DriveResourceMetadataTest, MoveEntryToDirectory) { FilePath::FromUTF8Unsafe("drive/dir1"), base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file8"), drive_file_path); @@ -478,7 +478,7 @@ TEST_F(DriveResourceMetadataTest, MoveEntryToDirectory) { "file_resource_id:file8", base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback, &error, &drive_file_path, &entry_proto)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file8"), drive_file_path); @@ -488,7 +488,7 @@ TEST_F(DriveResourceMetadataTest, MoveEntryToDirectory) { FilePath::FromUTF8Unsafe("drive/dir1"), base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); EXPECT_EQ(FilePath(), drive_file_path); @@ -498,7 +498,7 @@ TEST_F(DriveResourceMetadataTest, MoveEntryToDirectory) { FilePath::FromUTF8Unsafe("drive/dir4"), base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); EXPECT_EQ(FilePath(), drive_file_path); @@ -508,7 +508,7 @@ TEST_F(DriveResourceMetadataTest, MoveEntryToDirectory) { FilePath::FromUTF8Unsafe("drive/dir1/file4"), base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_A_DIRECTORY, error); EXPECT_EQ(FilePath(), drive_file_path); @@ -518,7 +518,7 @@ TEST_F(DriveResourceMetadataTest, MoveEntryToDirectory) { FilePath::FromUTF8Unsafe("drive"), base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/file8"), drive_file_path); @@ -528,7 +528,7 @@ TEST_F(DriveResourceMetadataTest, MoveEntryToDirectory) { FilePath::FromUTF8Unsafe("drive/dir2"), base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2/file8"), drive_file_path); @@ -537,7 +537,7 @@ TEST_F(DriveResourceMetadataTest, MoveEntryToDirectory) { "file_resource_id:file8", base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback, &error, &drive_file_path, &entry_proto)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2/file8"), drive_file_path); } @@ -553,7 +553,7 @@ TEST_F(DriveResourceMetadataTest, RenameEntry) { "file11", base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2/file11"), drive_file_path); @@ -562,7 +562,7 @@ TEST_F(DriveResourceMetadataTest, RenameEntry) { "file_resource_id:file8", base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback, &error, &drive_file_path, &entry_proto)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2/file11"), drive_file_path); @@ -572,7 +572,7 @@ TEST_F(DriveResourceMetadataTest, RenameEntry) { "file7", base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2/file7 (2)"), drive_file_path); @@ -582,7 +582,7 @@ TEST_F(DriveResourceMetadataTest, RenameEntry) { "file7 (2)", base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_EXISTS, error); EXPECT_EQ(FilePath(), drive_file_path); @@ -592,7 +592,7 @@ TEST_F(DriveResourceMetadataTest, RenameEntry) { "file11", base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); EXPECT_EQ(FilePath(), drive_file_path); } diff --git a/chrome/browser/chromeos/drive/drive_scheduler_unittest.cc b/chrome/browser/chromeos/drive/drive_scheduler_unittest.cc index a42c96a..2a42e9e 100644 --- a/chrome/browser/chromeos/drive/drive_scheduler_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_scheduler_unittest.cc @@ -75,7 +75,7 @@ class DriveSchedulerTest : public testing::Test { // The scheduler should be deleted before NetworkLibrary, as it // registers itself as observer of NetworkLibrary. scheduler_.reset(); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); mock_network_change_notifier_.reset(); } @@ -132,7 +132,7 @@ TEST_F(DriveSchedulerTest, RemoveFile) { scheduler_->Remove( file_in_root, false, base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); ASSERT_EQ(DRIVE_FILE_OK, error); } @@ -149,7 +149,7 @@ TEST_F(DriveSchedulerTest, RemoveFileRetry) { scheduler_->Remove( file_in_root, false, base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); ASSERT_EQ(DRIVE_FILE_OK, error); } @@ -165,7 +165,7 @@ TEST_F(DriveSchedulerTest, QueueOperation_Offline) { scheduler_->Remove( file_in_root, false, base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); } TEST_F(DriveSchedulerTest, QueueOperation_CelluarDisabled) { @@ -180,7 +180,7 @@ TEST_F(DriveSchedulerTest, QueueOperation_CelluarDisabled) { scheduler_->Remove( file_in_root, false, base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); } TEST_F(DriveSchedulerTest, QueueOperation_CelluarEnabled) { @@ -198,7 +198,7 @@ TEST_F(DriveSchedulerTest, QueueOperation_CelluarEnabled) { scheduler_->Remove( file_in_root, false, base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); } TEST_F(DriveSchedulerTest, QueueOperation_WimaxDisabled) { @@ -214,7 +214,7 @@ TEST_F(DriveSchedulerTest, QueueOperation_WimaxDisabled) { scheduler_->Remove( file_in_root, false, base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); } TEST_F(DriveSchedulerTest, QueueOperation_CelluarEnabledWithWimax) { @@ -232,7 +232,7 @@ TEST_F(DriveSchedulerTest, QueueOperation_CelluarEnabledWithWimax) { scheduler_->Remove( file_in_root, false, base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); } TEST_F(DriveSchedulerTest, QueueOperation_DriveDisabled) { @@ -247,7 +247,7 @@ TEST_F(DriveSchedulerTest, QueueOperation_DriveDisabled) { scheduler_->Remove( file_in_root, false, base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); } } // namespace drive diff --git a/chrome/browser/chromeos/drive/drive_sync_client.cc b/chrome/browser/chromeos/drive/drive_sync_client.cc index 7cd90fa..cf06ed6 100644 --- a/chrome/browser/chromeos/drive/drive_sync_client.cc +++ b/chrome/browser/chromeos/drive/drive_sync_client.cc @@ -179,7 +179,7 @@ void DriveSyncClient::DoSyncLoop() { base::Bind(&DriveSyncClient::OnFetchFileComplete, weak_ptr_factory_.GetWeakPtr(), sync_task), - gdata::GetContentCallback()); + google_apis::GetContentCallback()); } else if (sync_task.sync_type == UPLOAD) { DVLOG(1) << "Uploading " << sync_task.resource_id; file_system_->UpdateFileByResourceId( diff --git a/chrome/browser/chromeos/drive/drive_sync_client_unittest.cc b/chrome/browser/chromeos/drive/drive_sync_client_unittest.cc index 14afd8f..26a0190 100644 --- a/chrome/browser/chromeos/drive/drive_sync_client_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_sync_client_unittest.cc @@ -102,7 +102,7 @@ class DriveSyncClientTest : public testing::Test { // client registers itself as observer of NetworkLibrary. sync_client_.reset(); cache_->DestroyOnUIThread(); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); mock_network_change_notifier_.reset(); } @@ -285,7 +285,7 @@ TEST_F(DriveSyncClientTest, StartInitialScan) { // Start processing the files in the backlog. This will collect the // resource IDs of these files. sync_client_->StartProcessingBacklog(); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); ASSERT_TRUE(success); // Check the contents of the queue for fetching. @@ -545,7 +545,7 @@ TEST_F(DriveSyncClientTest, ExistingPinnedFiles) { // Start checking the existing pinned files. This will collect the resource // IDs of pinned files, with stale local cache files. sync_client_->StartCheckingExistingPinnedFiles(); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); ASSERT_TRUE(initialization_success); // Check the contents of the queue for fetching. diff --git a/chrome/browser/chromeos/drive/drive_system_service.cc b/chrome/browser/chromeos/drive/drive_system_service.cc index 0ed24f46..27693ae 100644 --- a/chrome/browser/chromeos/drive/drive_system_service.cc +++ b/chrome/browser/chromeos/drive/drive_system_service.cc @@ -48,7 +48,7 @@ const std::string* g_test_cache_root = NULL; bool IsDriveEnabledForProfile(Profile* profile) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (!gdata::AuthService::CanAuthenticate(profile)) + if (!google_apis::AuthService::CanAuthenticate(profile)) return false; // Disable Drive if preference is set. This can happen with commandline flag @@ -355,7 +355,7 @@ ProfileKeyedService* DriveSystemServiceFactory::BuildServiceInstanceFor( DriveServiceInterface* drive_service = g_test_drive_service; g_test_drive_service = NULL; if (!drive_service) { - if (gdata::util::IsDriveV2ApiEnabled()) + if (google_apis::util::IsDriveV2ApiEnabled()) drive_service = new DriveAPIService(); else drive_service = new GDataWapiService(); diff --git a/chrome/browser/chromeos/drive/drive_task_executor.cc b/chrome/browser/chromeos/drive/drive_task_executor.cc index 41e367b..388c0cb 100644 --- a/chrome/browser/chromeos/drive/drive_task_executor.cc +++ b/chrome/browser/chromeos/drive/drive_task_executor.cc @@ -114,7 +114,7 @@ void DriveTaskExecutor::OnFileEntryFetched( void DriveTaskExecutor::OnAppAuthorized( const std::string& resource_id, - gdata::GDataErrorCode error, + google_apis::GDataErrorCode error, scoped_ptr<base::Value> feed_data) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); @@ -125,7 +125,7 @@ void DriveTaskExecutor::OnAppAuthorized( DriveSystemService* system_service = DriveSystemServiceFactory::GetForProfile(profile()); - if (!system_service || error != gdata::HTTP_SUCCESS) { + if (!system_service || error != google_apis::HTTP_SUCCESS) { Done(false); return; } diff --git a/chrome/browser/chromeos/drive/drive_task_executor.h b/chrome/browser/chromeos/drive/drive_task_executor.h index a09d899..dc9e2c2 100644 --- a/chrome/browser/chromeos/drive/drive_task_executor.h +++ b/chrome/browser/chromeos/drive/drive_task_executor.h @@ -40,7 +40,7 @@ class DriveTaskExecutor : public file_handler_util::FileTaskExecutor { void OnFileEntryFetched(DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto); void OnAppAuthorized(const std::string& resource_id, - gdata::GDataErrorCode error, + google_apis::GDataErrorCode error, scoped_ptr<base::Value> feed_data); // Calls |done_| with |success| status. diff --git a/chrome/browser/chromeos/drive/drive_test_util.cc b/chrome/browser/chromeos/drive/drive_test_util.cc index e031cb8..775db3e5 100644 --- a/chrome/browser/chromeos/drive/drive_test_util.cc +++ b/chrome/browser/chromeos/drive/drive_test_util.cc @@ -108,13 +108,14 @@ void LoadChangeFeed(const std::string& relative_path, int64 start_changestamp, int64 root_feed_changestamp) { std::string error; - scoped_ptr<Value> document = gdata::test_util::LoadJSONFile(relative_path); + scoped_ptr<Value> document = + google_apis::test_util::LoadJSONFile(relative_path); ASSERT_TRUE(document.get()); ASSERT_TRUE(document->GetType() == Value::TYPE_DICTIONARY); - scoped_ptr<gdata::DocumentFeed> document_feed( - gdata::DocumentFeed::ExtractAndParse(*document)); + scoped_ptr<google_apis::DocumentFeed> document_feed( + google_apis::DocumentFeed::ExtractAndParse(*document)); ASSERT_TRUE(document_feed.get()); - ScopedVector<gdata::DocumentFeed> feed_list; + ScopedVector<google_apis::DocumentFeed> feed_list; feed_list.push_back(document_feed.release()); GURL unused; diff --git a/chrome/browser/chromeos/drive/drive_uploader.cc b/chrome/browser/chromeos/drive/drive_uploader.cc index 25507bf..a80b858 100644 --- a/chrome/browser/chromeos/drive/drive_uploader.cc +++ b/chrome/browser/chromeos/drive/drive_uploader.cc @@ -60,7 +60,7 @@ int DriveUploader::UploadNewFile( DCHECK(!content_type.empty()); scoped_ptr<UploadFileInfo> upload_file_info(new UploadFileInfo); - upload_file_info->upload_mode = gdata::UPLOAD_NEW_FILE; + upload_file_info->upload_mode = google_apis::UPLOAD_NEW_FILE; upload_file_info->initial_upload_location = upload_location; upload_file_info->drive_path = drive_file_path; upload_file_info->file_path = local_file_path; @@ -96,7 +96,7 @@ int DriveUploader::StreamExistingFile( DCHECK(!content_type.empty()); scoped_ptr<UploadFileInfo> upload_file_info(new UploadFileInfo); - upload_file_info->upload_mode = gdata::UPLOAD_EXISTING_FILE; + upload_file_info->upload_mode = google_apis::UPLOAD_EXISTING_FILE; upload_file_info->initial_upload_location = upload_location; upload_file_info->drive_path = drive_file_path; upload_file_info->file_path = local_file_path; @@ -120,7 +120,7 @@ int DriveUploader::StartUploadFile( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(upload_file_info.get()); DCHECK_EQ(upload_file_info->upload_id, -1); - DCHECK_NE(gdata::UPLOAD_INVALID, upload_file_info->upload_mode); + DCHECK_NE(google_apis::UPLOAD_INVALID, upload_file_info->upload_mode); const int upload_id = next_upload_id_++; upload_file_info->upload_id = upload_id; @@ -157,7 +157,7 @@ int DriveUploader::UploadExistingFile( DCHECK(!content_type.empty()); scoped_ptr<UploadFileInfo> upload_file_info(new UploadFileInfo); - upload_file_info->upload_mode = gdata::UPLOAD_EXISTING_FILE; + upload_file_info->upload_mode = google_apis::UPLOAD_EXISTING_FILE; upload_file_info->initial_upload_location = upload_location; upload_file_info->drive_path = drive_file_path; upload_file_info->file_path = local_file_path; @@ -299,7 +299,7 @@ void DriveUploader::OpenCompletionCallback(FileOpenType open_type, return; } drive_service_->InitiateUpload( - gdata::InitiateUploadParams(upload_file_info->upload_mode, + google_apis::InitiateUploadParams(upload_file_info->upload_mode, upload_file_info->title, upload_file_info->content_type, upload_file_info->content_length, @@ -329,7 +329,7 @@ void DriveUploader::OpenCompletionCallback(FileOpenType open_type, void DriveUploader::OnUploadLocationReceived( int upload_id, - gdata::GDataErrorCode code, + google_apis::GDataErrorCode code, const GURL& upload_location) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -340,7 +340,7 @@ void DriveUploader::OnUploadLocationReceived( DVLOG(1) << "Got upload location [" << upload_location.spec() << "] for [" << upload_file_info->title << "]"; - if (code != gdata::HTTP_SUCCESS) { + if (code != google_apis::HTTP_SUCCESS) { // TODO(achuith): Handle error codes from Google Docs server. UploadFailed(upload_file_info, DRIVE_FILE_ERROR_ABORT); return; @@ -441,14 +441,14 @@ void DriveUploader::ResumeUpload(int upload_id) { return; drive_service_->ResumeUpload( - gdata::ResumeUploadParams(upload_file_info->upload_mode, - upload_file_info->start_range, - upload_file_info->end_range, - upload_file_info->content_length, - upload_file_info->content_type, - upload_file_info->buf, - upload_file_info->upload_location, - upload_file_info->drive_path), + google_apis::ResumeUploadParams(upload_file_info->upload_mode, + upload_file_info->start_range, + upload_file_info->end_range, + upload_file_info->content_length, + upload_file_info->content_type, + upload_file_info->buf, + upload_file_info->upload_location, + upload_file_info->drive_path), base::Bind(&DriveUploader::OnResumeUploadResponseReceived, weak_ptr_factory_.GetWeakPtr(), upload_file_info->upload_id)); @@ -456,19 +456,19 @@ void DriveUploader::ResumeUpload(int upload_id) { void DriveUploader::OnResumeUploadResponseReceived( int upload_id, - const gdata::ResumeUploadResponse& response, - scoped_ptr<gdata::DocumentEntry> entry) { + const google_apis::ResumeUploadResponse& response, + scoped_ptr<google_apis::DocumentEntry> entry) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); UploadFileInfo* upload_file_info = GetUploadFileInfo(upload_id); if (!upload_file_info) return; - const gdata::UploadMode upload_mode = upload_file_info->upload_mode; - if ((upload_mode == gdata::UPLOAD_NEW_FILE && - response.code == gdata::HTTP_CREATED) || - (upload_mode == gdata::UPLOAD_EXISTING_FILE && - response.code == gdata::HTTP_SUCCESS)) { + const google_apis::UploadMode upload_mode = upload_file_info->upload_mode; + if ((upload_mode == google_apis::UPLOAD_NEW_FILE && + response.code == google_apis::HTTP_CREATED) || + (upload_mode == google_apis::UPLOAD_EXISTING_FILE && + response.code == google_apis::HTTP_SUCCESS)) { DVLOG(1) << "Successfully created uploaded file=[" << upload_file_info->title; @@ -490,7 +490,7 @@ void DriveUploader::OnResumeUploadResponseReceived( // If code is 308 (RESUME_INCOMPLETE) and range_received is what has been // previously uploaded (i.e. = upload_file_info->end_range), proceed to // upload the next chunk. - if (response.code != gdata::HTTP_RESUME_INCOMPLETE || + if (response.code != google_apis::HTTP_RESUME_INCOMPLETE || response.start_range_received != 0 || response.end_range_received != upload_file_info->end_range) { // TODO(achuith): Handle error cases, e.g. @@ -502,7 +502,7 @@ void DriveUploader::OnResumeUploadResponseReceived( << ", expected end range=" << upload_file_info->end_range; UploadFailed( upload_file_info, - response.code == gdata::HTTP_FORBIDDEN ? + response.code == google_apis::HTTP_FORBIDDEN ? DRIVE_FILE_ERROR_NO_SPACE : DRIVE_FILE_ERROR_ABORT); return; } @@ -541,7 +541,7 @@ DriveUploader::UploadFileInfo::UploadFileInfo() : upload_id(-1), file_size(0), content_length(0), - upload_mode(gdata::UPLOAD_INVALID), + upload_mode(google_apis::UPLOAD_INVALID), file_stream(NULL), buf_len(0), start_range(0), diff --git a/chrome/browser/chromeos/drive/drive_uploader.h b/chrome/browser/chromeos/drive/drive_uploader.h index 674e6c3..872b912 100644 --- a/chrome/browser/chromeos/drive/drive_uploader.h +++ b/chrome/browser/chromeos/drive/drive_uploader.h @@ -24,7 +24,7 @@ namespace content { class DownloadItem; } -namespace gdata { +namespace google_apis { struct ResumeUploadResponse; } @@ -34,10 +34,12 @@ class MockDriveUploader; class DriveServiceInterface; // Callback to be invoked once the upload has completed. -typedef base::Callback<void(DriveFileError error, +typedef base::Callback<void( + DriveFileError error, const FilePath& drive_path, const FilePath& file_path, - scoped_ptr<gdata::DocumentEntry> document_entry)> UploadCompletionCallback; + scoped_ptr<google_apis::DocumentEntry> document_entry)> + UploadCompletionCallback; // Callback to be invoked once the uploader is ready to upload. typedef base::Callback<void(int32 upload_id)> UploaderReadyCallback; @@ -150,7 +152,7 @@ class DriveUploader : public DriveUploaderInterface { std::string content_type; // Content-Type of file. int64 content_length; // Header content-Length. - gdata::UploadMode upload_mode; + google_apis::UploadMode upload_mode; // Location URL used to get |upload_location| with InitiateUpload. GURL initial_upload_location; @@ -187,7 +189,7 @@ class DriveUploader : public DriveUploaderInterface { int num_file_open_tries; // Number of times we've tried to open this file. // Will be set once the upload is complete. - scoped_ptr<gdata::DocumentEntry> entry; + scoped_ptr<google_apis::DocumentEntry> entry; // Callback to be invoked once the uploader is ready to upload. UploaderReadyCallback ready_callback; @@ -217,7 +219,7 @@ class DriveUploader : public DriveUploaderInterface { // DriveService callback for InitiateUpload. void OnUploadLocationReceived(int upload_id, - gdata::GDataErrorCode code, + google_apis::GDataErrorCode code, const GURL& upload_location); // Uploads the next chunk of data from the file. @@ -234,8 +236,8 @@ class DriveUploader : public DriveUploaderInterface { // DriveService callback for ResumeUpload. void OnResumeUploadResponseReceived( int upload_id, - const gdata::ResumeUploadResponse& response, - scoped_ptr<gdata::DocumentEntry> entry); + const google_apis::ResumeUploadResponse& response, + scoped_ptr<google_apis::DocumentEntry> entry); // Initiate the upload. void InitiateUpload(UploadFileInfo* uploader_file_info); diff --git a/chrome/browser/chromeos/drive/drive_webapps_registry.cc b/chrome/browser/chromeos/drive/drive_webapps_registry.cc index c9b3806..3df4440 100644 --- a/chrome/browser/chromeos/drive/drive_webapps_registry.cc +++ b/chrome/browser/chromeos/drive/drive_webapps_registry.cc @@ -40,8 +40,8 @@ std::string GetWebStoreIdFromUrl(const GURL& url) { } // TODO(kochi): This is duplicate from gdata_wapi_parser.cc. -bool SortBySize(const gdata::InstalledApp::IconList::value_type& a, - const gdata::InstalledApp::IconList::value_type& b) { +bool SortBySize(const google_apis::InstalledApp::IconList::value_type& a, + const google_apis::InstalledApp::IconList::value_type& b) { return a.first < b.first; } @@ -51,8 +51,8 @@ bool SortBySize(const gdata::InstalledApp::IconList::value_type& a, DriveWebAppInfo::DriveWebAppInfo( const std::string& app_id, - const gdata::InstalledApp::IconList& app_icons, - const gdata::InstalledApp::IconList& document_icons, + const google_apis::InstalledApp::IconList& app_icons, + const google_apis::InstalledApp::IconList& document_icons, const std::string& web_store_id, const string16& app_name, const string16& object_type, @@ -73,8 +73,8 @@ DriveWebAppInfo::~DriveWebAppInfo() { DriveWebAppsRegistry::WebAppFileSelector::WebAppFileSelector( const GURL& product_link, - const gdata::InstalledApp::IconList& app_icons, - const gdata::InstalledApp::IconList& document_icons, + const google_apis::InstalledApp::IconList& app_icons, + const google_apis::InstalledApp::IconList& document_icons, const string16& object_type, const std::string& app_id, bool is_primary_selector) @@ -145,24 +145,24 @@ std::set<std::string> DriveWebAppsRegistry::GetExtensionsForWebStoreApp( } void DriveWebAppsRegistry::UpdateFromFeed( - const gdata::AccountMetadataFeed& metadata) { + const google_apis::AccountMetadataFeed& metadata) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); url_to_name_map_.clear(); STLDeleteValues(&webapp_extension_map_); STLDeleteValues(&webapp_mimetypes_map_); - for (ScopedVector<gdata::InstalledApp>::const_iterator it = + for (ScopedVector<google_apis::InstalledApp>::const_iterator it = metadata.installed_apps().begin(); it != metadata.installed_apps().end(); ++it) { - const gdata::InstalledApp& app = **it; + const google_apis::InstalledApp& app = **it; GURL product_url = app.GetProductUrl(); if (product_url.is_empty()) continue; - gdata::InstalledApp::IconList app_icons = - app.GetIconsForCategory(gdata::AppIcon::ICON_APPLICATION); - gdata::InstalledApp::IconList document_icons = - app.GetIconsForCategory(gdata::AppIcon::ICON_DOCUMENT); + google_apis::InstalledApp::IconList app_icons = + app.GetIconsForCategory(google_apis::AppIcon::ICON_APPLICATION); + google_apis::InstalledApp::IconList document_icons = + app.GetIconsForCategory(google_apis::AppIcon::ICON_DOCUMENT); if (VLOG_IS_ON(1)) { std::vector<std::string> mime_types; @@ -219,27 +219,27 @@ void DriveWebAppsRegistry::UpdateFromFeed( } void DriveWebAppsRegistry::UpdateFromApplicationList( - const gdata::AppList& applist) { + const google_apis::AppList& applist) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); url_to_name_map_.clear(); STLDeleteValues(&webapp_extension_map_); STLDeleteValues(&webapp_mimetypes_map_); for (size_t i = 0; i < applist.items().size(); ++i) { - const gdata::AppResource& app = *applist.items()[i]; + const google_apis::AppResource& app = *applist.items()[i]; if (app.product_url().is_empty()) continue; - gdata::InstalledApp::IconList app_icons; - gdata::InstalledApp::IconList document_icons; + google_apis::InstalledApp::IconList app_icons; + google_apis::InstalledApp::IconList document_icons; for (size_t j = 0; j < app.icons().size(); ++j) { - const gdata::DriveAppIcon& icon = *app.icons()[j]; + const google_apis::DriveAppIcon& icon = *app.icons()[j]; if (icon.icon_url().is_empty()) continue; - if (icon.category() == gdata::DriveAppIcon::APPLICATION) + if (icon.category() == google_apis::DriveAppIcon::APPLICATION) app_icons.push_back(std::make_pair(icon.icon_side_length(), icon.icon_url())); - if (icon.category() == gdata::DriveAppIcon::DOCUMENT) + if (icon.category() == google_apis::DriveAppIcon::DOCUMENT) document_icons.push_back(std::make_pair(icon.icon_side_length(), icon.icon_url())); } @@ -286,8 +286,8 @@ void DriveWebAppsRegistry::UpdateFromApplicationList( // static. void DriveWebAppsRegistry::AddAppSelectorList( const GURL& product_link, - const gdata::InstalledApp::IconList& app_icons, - const gdata::InstalledApp::IconList& document_icons, + const google_apis::InstalledApp::IconList& app_icons, + const google_apis::InstalledApp::IconList& document_icons, const string16& object_type, const std::string& app_id, bool is_primary_selector, diff --git a/chrome/browser/chromeos/drive/drive_webapps_registry.h b/chrome/browser/chromeos/drive/drive_webapps_registry.h index bcdce83..873c34c 100644 --- a/chrome/browser/chromeos/drive/drive_webapps_registry.h +++ b/chrome/browser/chromeos/drive/drive_webapps_registry.h @@ -15,7 +15,7 @@ class FilePath; -namespace gdata { +namespace google_apis { class AppList; } @@ -24,8 +24,8 @@ namespace drive { // Data structure that defines WebApp struct DriveWebAppInfo { DriveWebAppInfo(const std::string& app_id, - const gdata::InstalledApp::IconList& app_icons, - const gdata::InstalledApp::IconList& document_icons, + const google_apis::InstalledApp::IconList& app_icons, + const google_apis::InstalledApp::IconList& document_icons, const std::string& web_store_id, const string16& app_name, const string16& object_type, @@ -36,10 +36,10 @@ struct DriveWebAppInfo { std::string app_id; // Drive application icon URLs for this app, paired with their size (length of // a side in pixels). - gdata::InstalledApp::IconList app_icons; + google_apis::InstalledApp::IconList app_icons; // Drive document icon URLs for this app, paired with their size (length of // a side in pixels). - gdata::InstalledApp::IconList document_icons; + google_apis::InstalledApp::IconList document_icons; // Web store id/extension id; std::string web_store_id; // WebApp name. @@ -68,11 +68,13 @@ class DriveWebAppsRegistryInterface { // Updates the list of drive-enabled WebApps with freshly fetched account // metadata feed. - virtual void UpdateFromFeed(const gdata::AccountMetadataFeed& metadata) = 0; + virtual void UpdateFromFeed( + const google_apis::AccountMetadataFeed& metadata) = 0; // Updates the list of drive-enabled WebApps with freshly fetched account // metadata feed. - virtual void UpdateFromApplicationList(const gdata::AppList& applist) = 0; + virtual void UpdateFromApplicationList( + const google_apis::AppList& applist) = 0; }; // The production implementation of DriveWebAppsRegistryInterface. @@ -89,29 +91,30 @@ class DriveWebAppsRegistry : public DriveWebAppsRegistryInterface { virtual std::set<std::string> GetExtensionsForWebStoreApp( const std::string& web_store_id) OVERRIDE; virtual void UpdateFromFeed( - const gdata::AccountMetadataFeed& metadata) OVERRIDE; + const google_apis::AccountMetadataFeed& metadata) OVERRIDE; virtual void UpdateFromApplicationList( - const gdata::AppList& applist) OVERRIDE; + const google_apis::AppList& applist) OVERRIDE; private: // Defines WebApp application details that are associated with a given // file extension or content mimetype. struct WebAppFileSelector { - WebAppFileSelector(const GURL& product_link, - const gdata::InstalledApp::IconList& app_icons, - const gdata::InstalledApp::IconList& document_icons, - const string16& object_type, - const std::string& app_id, - bool is_primary_selector); + WebAppFileSelector( + const GURL& product_link, + const google_apis::InstalledApp::IconList& app_icons, + const google_apis::InstalledApp::IconList& document_icons, + const string16& object_type, + const std::string& app_id, + bool is_primary_selector); ~WebAppFileSelector(); // WebApp product link. GURL product_link; // Drive application icon URLs for this app, paired with their size (length // of a side in pixels). - gdata::InstalledApp::IconList app_icons; + google_apis::InstalledApp::IconList app_icons; // Drive document icon URLs for this app, paired with their size (length of // a side in pixels). - gdata::InstalledApp::IconList document_icons; + google_apis::InstalledApp::IconList document_icons; // Object (file) type description. string16 object_type; // Drive app id @@ -134,8 +137,8 @@ class DriveWebAppsRegistry : public DriveWebAppsRegistryInterface { // corresponding |map|. static void AddAppSelectorList( const GURL& product_link, - const gdata::InstalledApp::IconList& app_icons, - const gdata::InstalledApp::IconList& document_icons, + const google_apis::InstalledApp::IconList& app_icons, + const google_apis::InstalledApp::IconList& document_icons, const string16& object_type, const std::string& app_id, bool is_primary_selector, diff --git a/chrome/browser/chromeos/drive/drive_webapps_registry_unittest.cc b/chrome/browser/chromeos/drive/drive_webapps_registry_unittest.cc index 0ac19c2..3ad7334 100644 --- a/chrome/browser/chromeos/drive/drive_webapps_registry_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_webapps_registry_unittest.cc @@ -76,7 +76,7 @@ class DriveWebAppsRegistryTest : public testing::Test { TEST_F(DriveWebAppsRegistryTest, LoadAndFindWebApps) { scoped_ptr<Value> document = - gdata::test_util::LoadJSONFile("gdata/account_metadata.json"); + google_apis::test_util::LoadJSONFile("gdata/account_metadata.json"); ASSERT_TRUE(document.get()); ASSERT_TRUE(document->GetType() == Value::TYPE_DICTIONARY); DictionaryValue* entry_value; @@ -85,8 +85,8 @@ TEST_F(DriveWebAppsRegistryTest, LoadAndFindWebApps) { ASSERT_TRUE(entry_value); // Load feed. - scoped_ptr<gdata::AccountMetadataFeed> feed( - gdata::AccountMetadataFeed::CreateFrom(*document)); + scoped_ptr<google_apis::AccountMetadataFeed> feed( + google_apis::AccountMetadataFeed::CreateFrom(*document)); ASSERT_TRUE(feed.get()); scoped_ptr<DriveWebAppsRegistry> web_apps(new DriveWebAppsRegistry); web_apps->UpdateFromFeed(*feed.get()); @@ -125,12 +125,13 @@ TEST_F(DriveWebAppsRegistryTest, LoadAndFindWebApps) { TEST_F(DriveWebAppsRegistryTest, LoadAndFindDriveWebApps) { scoped_ptr<Value> document = - gdata::test_util::LoadJSONFile("drive/applist.json"); + google_apis::test_util::LoadJSONFile("drive/applist.json"); ASSERT_TRUE(document.get()); ASSERT_TRUE(document->GetType() == Value::TYPE_DICTIONARY); // Load feed. - scoped_ptr<gdata::AppList> app_list(gdata::AppList::CreateFrom(*document)); + scoped_ptr<google_apis::AppList> app_list( + google_apis::AppList::CreateFrom(*document)); ASSERT_TRUE(app_list.get()); scoped_ptr<DriveWebAppsRegistry> web_apps(new DriveWebAppsRegistry); web_apps->UpdateFromApplicationList(*app_list.get()); diff --git a/chrome/browser/chromeos/drive/file_system/copy_operation.cc b/chrome/browser/chromeos/drive/file_system/copy_operation.cc index 27a2904..27e347e 100644 --- a/chrome/browser/chromeos/drive/file_system/copy_operation.cc +++ b/chrome/browser/chromeos/drive/file_system/copy_operation.cc @@ -157,7 +157,7 @@ void CopyOperation::TransferFileFromRemoteToLocal( weak_ptr_factory_.GetWeakPtr(), local_dest_file_path, callback), - gdata::GetContentCallback()); + google_apis::GetContentCallback()); } void CopyOperation::OnGetFileCompleteForTransferFile( @@ -180,7 +180,7 @@ void CopyOperation::OnGetFileCompleteForTransferFile( // CopyLocalFileOnBlockingPool. DriveFileError* copy_file_error = new DriveFileError(DRIVE_FILE_OK); - gdata::util::PostBlockingPoolSequencedTaskAndReply( + google_apis::util::PostBlockingPoolSequencedTaskAndReply( FROM_HERE, blocking_task_runner_, base::Bind(&CopyLocalFileOnBlockingPool, @@ -221,7 +221,7 @@ void CopyOperation::TransferRegularFile( new DriveFileError(DRIVE_FILE_OK); int64* file_size = new int64; std::string* content_type = new std::string; - gdata::util::PostBlockingPoolSequencedTaskAndReply( + google_apis::util::PostBlockingPoolSequencedTaskAndReply( FROM_HERE, blocking_task_runner_, base::Bind(&GetLocalFileInfoOnBlockingPool, @@ -427,7 +427,7 @@ void CopyOperation::CopyAfterGetEntryInfoPair( weak_ptr_factory_.GetWeakPtr(), dest_file_path, callback), - gdata::GetContentCallback()); + google_apis::GetContentCallback()); } void CopyOperation::OnGetFileCompleteForCopy( @@ -521,7 +521,7 @@ void CopyOperation::OnTransferCompleted( if (error == DRIVE_FILE_OK && document_entry.get()) { drive_file_system_->AddUploadedFile( - gdata::UPLOAD_NEW_FILE, + google_apis::UPLOAD_NEW_FILE, drive_path.DirName(), document_entry.Pass(), file_path, @@ -554,7 +554,7 @@ void CopyOperation::TransferFileFromLocalToRemoteAfterGetEntryInfo( } std::string* resource_id = new std::string; - gdata::util::PostBlockingPoolSequencedTaskAndReply( + google_apis::util::PostBlockingPoolSequencedTaskAndReply( FROM_HERE, blocking_task_runner_, base::Bind(&GetDocumentResourceIdOnBlockingPool, diff --git a/chrome/browser/chromeos/drive/file_system/copy_operation.h b/chrome/browser/chromeos/drive/file_system/copy_operation.h index a0756ef..e460610 100644 --- a/chrome/browser/chromeos/drive/file_system/copy_operation.h +++ b/chrome/browser/chromeos/drive/file_system/copy_operation.h @@ -23,8 +23,8 @@ class DriveFileSystemInterface; class DriveServiceInterface; class DriveUploaderInterface; -using gdata::DocumentEntry; -using gdata::GDataErrorCode; +using google_apis::DocumentEntry; +using google_apis::GDataErrorCode; namespace file_system { diff --git a/chrome/browser/chromeos/drive/file_system/move_operation.cc b/chrome/browser/chromeos/drive/file_system/move_operation.cc index 50ddbcd..5e6da29 100644 --- a/chrome/browser/chromeos/drive/file_system/move_operation.cc +++ b/chrome/browser/chromeos/drive/file_system/move_operation.cc @@ -185,7 +185,7 @@ void MoveOperation::RenameEntryLocally( const FilePath& file_path, const FilePath::StringType& new_name, const FileMoveCallback& callback, - gdata::GDataErrorCode status, + google_apis::GDataErrorCode status, const GURL& /* document_url */) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -337,7 +337,7 @@ void MoveOperation::MoveEntryToDirectory( const FilePath& file_path, const FilePath& directory_path, const FileMoveCallback& callback, - gdata::GDataErrorCode status, + google_apis::GDataErrorCode status, const GURL& /* document_url */) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); diff --git a/chrome/browser/chromeos/drive/file_system/move_operation.h b/chrome/browser/chromeos/drive/file_system/move_operation.h index 851638b..7e5d91d 100644 --- a/chrome/browser/chromeos/drive/file_system/move_operation.h +++ b/chrome/browser/chromeos/drive/file_system/move_operation.h @@ -81,7 +81,7 @@ class MoveOperation { void RenameEntryLocally(const FilePath& file_path, const FilePath::StringType& new_name, const FileMoveCallback& callback, - gdata::GDataErrorCode status, + google_apis::GDataErrorCode status, const GURL& document_url); // Removes a file or directory at |file_path| from the current directory if @@ -123,7 +123,7 @@ class MoveOperation { void MoveEntryToDirectory(const FilePath& file_path, const FilePath& directory_path, const FileMoveCallback& callback, - gdata::GDataErrorCode status, + google_apis::GDataErrorCode status, const GURL& document_url); // Callback when an entry is moved to another directory on the client side. diff --git a/chrome/browser/chromeos/drive/file_system/remove_operation.cc b/chrome/browser/chromeos/drive/file_system/remove_operation.cc index 19c37ec..fc86a9e 100644 --- a/chrome/browser/chromeos/drive/file_system/remove_operation.cc +++ b/chrome/browser/chromeos/drive/file_system/remove_operation.cc @@ -77,7 +77,7 @@ void RemoveOperation::RemoveAfterGetEntryInfo( void RemoveOperation::RemoveResourceLocally( const FileOperationCallback& callback, const std::string& resource_id, - gdata::GDataErrorCode status, + google_apis::GDataErrorCode status, const GURL& /* document_url */) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); diff --git a/chrome/browser/chromeos/drive/file_system/remove_operation.h b/chrome/browser/chromeos/drive/file_system/remove_operation.h index 52e6b28..ffa9850 100644 --- a/chrome/browser/chromeos/drive/file_system/remove_operation.h +++ b/chrome/browser/chromeos/drive/file_system/remove_operation.h @@ -56,7 +56,7 @@ class RemoveOperation { void RemoveResourceLocally( const FileOperationCallback& callback, const std::string& resource_id, - gdata::GDataErrorCode status, + google_apis::GDataErrorCode status, const GURL& /* document_url */); // Sends notification for directory changes. Notifies of directory changes, diff --git a/chrome/browser/chromeos/drive/file_write_helper_unittest.cc b/chrome/browser/chromeos/drive/file_write_helper_unittest.cc index e359e6a..f217180 100644 --- a/chrome/browser/chromeos/drive/file_write_helper_unittest.cc +++ b/chrome/browser/chromeos/drive/file_write_helper_unittest.cc @@ -76,7 +76,7 @@ TEST_F(FileWriteHelperTest, PrepareFileForWritingSuccess) { FilePath path; file_write_helper.PrepareWritableFileAndRun( kDrivePath, base::Bind(&RecordOpenFileCallbackArguments, &error, &path)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); EXPECT_EQ(kLocalPath, path); @@ -95,7 +95,7 @@ TEST_F(FileWriteHelperTest, PrepareFileForWritingCreateFail) { FilePath path; file_write_helper.PrepareWritableFileAndRun( kDrivePath, base::Bind(&RecordOpenFileCallbackArguments, &error, &path)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_ACCESS_DENIED, error); EXPECT_EQ(FilePath(), path); @@ -115,7 +115,7 @@ TEST_F(FileWriteHelperTest, PrepareFileForWritingOpenFail) { FilePath path; file_write_helper.PrepareWritableFileAndRun( kDrivePath, base::Bind(&RecordOpenFileCallbackArguments, &error, &path)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_IN_USE, error); EXPECT_EQ(FilePath(), path); diff --git a/chrome/browser/chromeos/drive/mock_drive_file_system.h b/chrome/browser/chromeos/drive/mock_drive_file_system.h index d1bcbd1..2c6f39a 100644 --- a/chrome/browser/chromeos/drive/mock_drive_file_system.h +++ b/chrome/browser/chromeos/drive/mock_drive_file_system.h @@ -68,14 +68,16 @@ class MockDriveFileSystem : public DriveFileSystemInterface { void(const FilePath& file_path, bool is_exclusive, const FileOperationCallback& callback)); - MOCK_METHOD3(GetFileByPath, - void(const FilePath& file_path, - const GetFileCallback& get_file_callback, - const gdata::GetContentCallback& get_content_callback)); - MOCK_METHOD3(GetFileByResourceId, - void(const std::string& resource_id, - const GetFileCallback& get_file_callback, - const gdata::GetContentCallback& get_content_callback)); + MOCK_METHOD3( + GetFileByPath, + void(const FilePath& file_path, + const GetFileCallback& get_file_callback, + const google_apis::GetContentCallback& get_content_callback)); + MOCK_METHOD3( + GetFileByResourceId, + void(const std::string& resource_id, + const GetFileCallback& get_file_callback, + const google_apis::GetContentCallback& get_content_callback)); MOCK_METHOD2(UpdateFileByResourceId, void(const std::string& resource_id, const FileOperationCallback& callback)); @@ -89,16 +91,16 @@ class MockDriveFileSystem : public DriveFileSystemInterface { MOCK_METHOD1(GetAvailableSpace, void(const GetAvailableSpaceCallback& callback)); // This function is not mockable by gmock because scoped_ptr is not supported. - virtual void AddUploadedFile(gdata::UploadMode upload_mode, + virtual void AddUploadedFile(google_apis::UploadMode upload_mode, const FilePath& file, - scoped_ptr<gdata::DocumentEntry> entry, + scoped_ptr<google_apis::DocumentEntry> entry, const FilePath& file_content_path, DriveCache::FileOperationType cache_operation, const base::Closure& callback) OVERRIDE {} // This function is not mockable by gmock because scoped_ptr is not supported. virtual void UpdateEntryData(const std::string& resource_id, const std::string& md5, - scoped_ptr<gdata::DocumentEntry> entry, + scoped_ptr<google_apis::DocumentEntry> entry, const FilePath& file_content_path, const base::Closure& callback) OVERRIDE {} MOCK_CONST_METHOD0(GetMetadata, DriveFileSystemMetadata()); diff --git a/chrome/browser/chromeos/drive/mock_drive_service.cc b/chrome/browser/chromeos/drive/mock_drive_service.cc index dc42a75..c47bd56 100644 --- a/chrome/browser/chromeos/drive/mock_drive_service.cc +++ b/chrome/browser/chromeos/drive/mock_drive_service.cc @@ -24,7 +24,7 @@ namespace drive { MockDriveService::MockDriveService() { ON_CALL(*this, GetProgressStatusList()) - .WillByDefault(Return(gdata::OperationProgressStatusList())); + .WillByDefault(Return(google_apis::OperationProgressStatusList())); ON_CALL(*this, Authenticate(_)) .WillByDefault(Invoke(this, &MockDriveService::AuthenticateStub)); ON_CALL(*this, GetDocuments(_, _, _, _, _)) @@ -53,24 +53,24 @@ MockDriveService::MockDriveService() { // Fill in the default values for mock feeds. account_metadata_ = - gdata::test_util::LoadJSONFile("gdata/account_metadata.json"); - feed_data_ = gdata::test_util::LoadJSONFile("gdata/basic_feed.json"); + google_apis::test_util::LoadJSONFile("gdata/account_metadata.json"); + feed_data_ = google_apis::test_util::LoadJSONFile("gdata/basic_feed.json"); directory_data_ = - gdata::test_util::LoadJSONFile("gdata/new_folder_entry.json"); + google_apis::test_util::LoadJSONFile("gdata/new_folder_entry.json"); } MockDriveService::~MockDriveService() {} void MockDriveService::set_search_result( const std::string& search_result_feed) { - search_result_ = gdata::test_util::LoadJSONFile(search_result_feed); + search_result_ = google_apis::test_util::LoadJSONFile(search_result_feed); } void MockDriveService::AuthenticateStub( - const gdata::AuthStatusCallback& callback) { + const google_apis::AuthStatusCallback& callback) { base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(callback, gdata::HTTP_SUCCESS, "my_auth_token")); + base::Bind(callback, google_apis::HTTP_SUCCESS, "my_auth_token")); } void MockDriveService::GetDocumentsStub( @@ -78,34 +78,34 @@ void MockDriveService::GetDocumentsStub( int64 start_changestamp, const std::string& search_string, const std::string& directory_resource_id, - const gdata::GetDataCallback& callback) { + const google_apis::GetDataCallback& callback) { if (search_string.empty()) { base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(callback, gdata::HTTP_SUCCESS, + base::Bind(callback, google_apis::HTTP_SUCCESS, base::Passed(&feed_data_))); } else { base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(callback, gdata::HTTP_SUCCESS, + base::Bind(callback, google_apis::HTTP_SUCCESS, base::Passed(&search_result_))); } } void MockDriveService::GetAccountMetadataStub( - const gdata::GetDataCallback& callback) { + const google_apis::GetDataCallback& callback) { base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(callback, gdata::HTTP_SUCCESS, + base::Bind(callback, google_apis::HTTP_SUCCESS, base::Passed(&account_metadata_))); } void MockDriveService::DeleteDocumentStub( const GURL& document_url, - const gdata::EntryActionCallback& callback) { + const google_apis::EntryActionCallback& callback) { base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(callback, gdata::HTTP_SUCCESS, document_url)); + base::Bind(callback, google_apis::HTTP_SUCCESS, document_url)); } void MockDriveService::DownloadDocumentStub( @@ -113,56 +113,58 @@ void MockDriveService::DownloadDocumentStub( const FilePath& local_tmp_path, const GURL& content_url, DocumentExportFormat format, - const gdata::DownloadActionCallback& callback) { + const google_apis::DownloadActionCallback& callback) { base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(callback, gdata::HTTP_SUCCESS, content_url, local_tmp_path)); + base::Bind(callback, google_apis::HTTP_SUCCESS, + content_url, local_tmp_path)); } void MockDriveService::CopyDocumentStub( const std::string& resource_id, const FilePath::StringType& new_name, - const gdata::GetDataCallback& callback) { + const google_apis::GetDataCallback& callback) { base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(callback, gdata::HTTP_SUCCESS, base::Passed(&document_data_))); + base::Bind(callback, google_apis::HTTP_SUCCESS, + base::Passed(&document_data_))); } void MockDriveService::RenameResourceStub( const GURL& resource_url, const FilePath::StringType& new_name, - const gdata::EntryActionCallback& callback) { + const google_apis::EntryActionCallback& callback) { base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(callback, gdata::HTTP_SUCCESS, resource_url)); + base::Bind(callback, google_apis::HTTP_SUCCESS, resource_url)); } void MockDriveService::AddResourceToDirectoryStub( const GURL& parent_content_url, const GURL& resource_url, - const gdata::EntryActionCallback& callback) { + const google_apis::EntryActionCallback& callback) { base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(callback, gdata::HTTP_SUCCESS, resource_url)); + base::Bind(callback, google_apis::HTTP_SUCCESS, resource_url)); } void MockDriveService::RemoveResourceFromDirectoryStub( const GURL& parent_content_url, const GURL& resource_url, const std::string& resource_id, - const gdata::EntryActionCallback& callback) { + const google_apis::EntryActionCallback& callback) { base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(callback, gdata::HTTP_SUCCESS, resource_url)); + base::Bind(callback, google_apis::HTTP_SUCCESS, resource_url)); } void MockDriveService::CreateDirectoryStub( const GURL& parent_content_url, const FilePath::StringType& directory_name, - const gdata::GetDataCallback& callback) { + const google_apis::GetDataCallback& callback) { base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(callback, gdata::HTTP_SUCCESS, + base::Bind(callback, google_apis::HTTP_SUCCESS, base::Passed(&directory_data_))); } @@ -170,9 +172,9 @@ void MockDriveService::DownloadFileStub( const FilePath& virtual_path, const FilePath& local_tmp_path, const GURL& content_url, - const gdata::DownloadActionCallback& download_action_callback, - const gdata::GetContentCallback& get_content_callback) { - gdata::GDataErrorCode error = gdata::HTTP_SUCCESS; + const google_apis::DownloadActionCallback& download_action_callback, + const google_apis::GetContentCallback& get_content_callback) { + google_apis::GDataErrorCode error = google_apis::HTTP_SUCCESS; if (file_data_.get()) { int file_data_size = static_cast<int>(file_data_->size()); ASSERT_EQ(file_data_size, diff --git a/chrome/browser/chromeos/drive/mock_drive_service.h b/chrome/browser/chromeos/drive/mock_drive_service.h index 32b9129..a8e46f5 100644 --- a/chrome/browser/chromeos/drive/mock_drive_service.h +++ b/chrome/browser/chromeos/drive/mock_drive_service.h @@ -31,64 +31,70 @@ class MockDriveService : public DriveServiceInterface { MOCK_METHOD0(CancelAll, void(void)); MOCK_METHOD1(CancelForFilePath, bool(const FilePath& file_path)); MOCK_CONST_METHOD0(GetProgressStatusList, - gdata::OperationProgressStatusList()); - MOCK_METHOD1(Authenticate, void(const gdata::AuthStatusCallback& callback)); - MOCK_METHOD5(GetDocuments, void(const GURL& feed_url, - int64 start_changestamp, - const std::string& search_string, - const std::string& directory_resource_id, - const gdata::GetDataCallback& callback)); - MOCK_METHOD2(GetDocumentEntry, void(const std::string& resource_id, - const gdata::GetDataCallback& callback)); + google_apis::OperationProgressStatusList()); + MOCK_METHOD1(Authenticate, + void(const google_apis::AuthStatusCallback& callback)); + MOCK_METHOD5(GetDocuments, + void(const GURL& feed_url, + int64 start_changestamp, + const std::string& search_string, + const std::string& directory_resource_id, + const google_apis::GetDataCallback& callback)); + MOCK_METHOD2(GetDocumentEntry, + void(const std::string& resource_id, + const google_apis::GetDataCallback& callback)); MOCK_METHOD1(GetAccountMetadata, - void(const gdata::GetDataCallback& callback)); + void(const google_apis::GetDataCallback& callback)); MOCK_METHOD1(GetApplicationInfo, - void(const gdata::GetDataCallback& callback)); + void(const google_apis::GetDataCallback& callback)); MOCK_METHOD2(DeleteDocument, void(const GURL& document_url, - const gdata::EntryActionCallback& callback)); + const google_apis::EntryActionCallback& callback)); MOCK_METHOD5(DownloadDocument, void(const FilePath& virtual_path, const FilePath& local_cache_path, const GURL& content_url, DocumentExportFormat format, - const gdata::DownloadActionCallback& callback)); - MOCK_METHOD3(CopyDocument, void(const std::string& resource_id, - const FilePath::StringType& new_name, - const gdata::GetDataCallback& callback)); + const google_apis::DownloadActionCallback& callback)); + MOCK_METHOD3(CopyDocument, + void(const std::string& resource_id, + const FilePath::StringType& new_name, + const google_apis::GetDataCallback& callback)); MOCK_METHOD3(RenameResource, void(const GURL& resource_url, const FilePath::StringType& new_name, - const gdata::EntryActionCallback& callback)); + const google_apis::EntryActionCallback& callback)); MOCK_METHOD3(AddResourceToDirectory, void(const GURL& parent_content_url, const GURL& resource_url, - const gdata::EntryActionCallback& callback)); + const google_apis::EntryActionCallback& callback)); MOCK_METHOD4(RemoveResourceFromDirectory, void(const GURL& parent_content_url, const GURL& resource_url, const std::string& resource_id, - const gdata::EntryActionCallback& callback)); + const google_apis::EntryActionCallback& callback)); MOCK_METHOD3(CreateDirectory, void(const GURL& parent_content_url, const FilePath::StringType& directory_name, - const gdata::GetDataCallback& callback)); - MOCK_METHOD5(DownloadFile, - void(const FilePath& virtual_path, - const FilePath& local_cache_path, - const GURL& content_url, - const gdata::DownloadActionCallback& - donwload_action_callback, - const gdata::GetContentCallback& get_content_callback)); + const google_apis::GetDataCallback& callback)); + MOCK_METHOD5( + DownloadFile, + void(const FilePath& virtual_path, + const FilePath& local_cache_path, + const GURL& content_url, + const google_apis::DownloadActionCallback& + donwload_action_callback, + const google_apis::GetContentCallback& get_content_callback)); MOCK_METHOD2(InitiateUpload, - void(const gdata::InitiateUploadParams& upload_file_info, - const gdata::InitiateUploadCallback& callback)); + void(const google_apis::InitiateUploadParams& upload_file_info, + const google_apis::InitiateUploadCallback& callback)); MOCK_METHOD2(ResumeUpload, - void(const gdata::ResumeUploadParams& upload_file_info, - const gdata::ResumeUploadCallback& callback)); - MOCK_METHOD3(AuthorizeApp, void(const GURL& resource_url, - const std::string& app_ids, - const gdata::GetDataCallback& callback)); + void(const google_apis::ResumeUploadParams& upload_file_info, + const google_apis::ResumeUploadCallback& callback)); + MOCK_METHOD3(AuthorizeApp, + void(const GURL& resource_url, + const std::string& app_ids, + const google_apis::GetDataCallback& callback)); MOCK_CONST_METHOD0(HasAccessToken, bool()); MOCK_CONST_METHOD0(HasRefreshToken, bool()); @@ -116,7 +122,7 @@ class MockDriveService : public DriveServiceInterface { // Will call |callback| with HTTP_SUCCESS and the token "test_auth_token" // as the token. - void AuthenticateStub(const gdata::AuthStatusCallback& callback); + void AuthenticateStub(const google_apis::AuthStatusCallback& callback); // Will call |callback| with HTTP_SUCCESS and a StringValue with the current // value of |feed_data_|. @@ -124,52 +130,54 @@ class MockDriveService : public DriveServiceInterface { int64 start_changestamp, const std::string& search_string, const std::string& directory_resource_id, - const gdata::GetDataCallback& callback); + const google_apis::GetDataCallback& callback); // Will call |callback| with HTTP_SUCCESS and a StringValue with the current // value of |account_metadata_|. - void GetAccountMetadataStub(const gdata::GetDataCallback& callback); + void GetAccountMetadataStub(const google_apis::GetDataCallback& callback); // Will call |callback| with HTTP_SUCCESS and the |document_url|. void DeleteDocumentStub(const GURL& document_url, - const gdata::EntryActionCallback& callback); + const google_apis::EntryActionCallback& callback); // Will call |callback| with HTTP_SUCCESS, the given URL, and the host+path // portion of the URL as the temporary file path. - void DownloadDocumentStub(const FilePath& virtual_path, - const FilePath& local_tmp_path, - const GURL& content_url, - DocumentExportFormat format, - const gdata::DownloadActionCallback& callback); + void DownloadDocumentStub( + const FilePath& virtual_path, + const FilePath& local_tmp_path, + const GURL& content_url, + DocumentExportFormat format, + const google_apis::DownloadActionCallback& callback); // Will call |callback| with HTTP_SUCCESS and the current value of // |document_data_|. void CopyDocumentStub(const std::string& resource_id, const FilePath::StringType& new_name, - const gdata::GetDataCallback& callback); + const google_apis::GetDataCallback& callback); // Will call |callback| with HTTP_SUCCESS and the |document_url|. void RenameResourceStub(const GURL& document_url, const FilePath::StringType& new_name, - const gdata::EntryActionCallback& callback); + const google_apis::EntryActionCallback& callback); // Will call |callback| with HTTP_SUCCESS and the |resource_url|. - void AddResourceToDirectoryStub(const GURL& parent_content_url, - const GURL& resource_url, - const gdata::EntryActionCallback& callback); + void AddResourceToDirectoryStub( + const GURL& parent_content_url, + const GURL& resource_url, + const google_apis::EntryActionCallback& callback); // Will call |callback| with HTTP_SUCCESS and the |resource_url|. void RemoveResourceFromDirectoryStub( const GURL& parent_content_url, const GURL& resource_url, const std::string& resource_id, - const gdata::EntryActionCallback& callback); + const google_apis::EntryActionCallback& callback); // Will call |callback| with HTTP_SUCCESS and the current value of // |directory_data_|. void CreateDirectoryStub(const GURL& parent_content_url, const FilePath::StringType& directory_name, - const gdata::GetDataCallback& callback); + const google_apis::GetDataCallback& callback); // Will call |callback| with HTTP_SUCCESS, the given URL, and the host+path // portion of the URL as the temporary file path. If |file_data_| is not null, @@ -178,8 +186,8 @@ class MockDriveService : public DriveServiceInterface { const FilePath& virtual_path, const FilePath& local_tmp_path, const GURL& content_url, - const gdata::DownloadActionCallback& download_action_callback, - const gdata::GetContentCallback& get_content_callback); + const google_apis::DownloadActionCallback& download_action_callback, + const google_apis::GetContentCallback& get_content_callback); // Account meta data to be returned from GetAccountMetadata. scoped_ptr<base::Value> account_metadata_; diff --git a/chrome/browser/chromeos/drive/mock_drive_web_apps_registry.h b/chrome/browser/chromeos/drive/mock_drive_web_apps_registry.h index 532e4e9..662f5f8 100644 --- a/chrome/browser/chromeos/drive/mock_drive_web_apps_registry.h +++ b/chrome/browser/chromeos/drive/mock_drive_web_apps_registry.h @@ -23,8 +23,9 @@ class MockDriveWebAppsRegistry : public DriveWebAppsRegistryInterface { MOCK_METHOD1(GetExtensionsForWebStoreApp, std::set<std::string>(const std::string& web_store_id)); MOCK_METHOD1(UpdateFromFeed, - void(const gdata::AccountMetadataFeed& metadata)); - MOCK_METHOD1(UpdateFromApplicationList, void(const gdata::AppList& applist)); + void(const google_apis::AccountMetadataFeed& metadata)); + MOCK_METHOD1(UpdateFromApplicationList, + void(const google_apis::AppList& applist)); }; } // namespace drive diff --git a/chrome/browser/chromeos/drive/stale_cache_files_remover_unittest.cc b/chrome/browser/chromeos/drive/stale_cache_files_remover_unittest.cc index d32282f..c3eb6d1 100644 --- a/chrome/browser/chromeos/drive/stale_cache_files_remover_unittest.cc +++ b/chrome/browser/chromeos/drive/stale_cache_files_remover_unittest.cc @@ -113,7 +113,7 @@ class StaleCacheFilesRemoverTest : public testing::Test { stale_cache_files_remover_.reset(new StaleCacheFilesRemover(file_system_, cache_)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); } virtual void TearDown() OVERRIDE { @@ -127,7 +127,7 @@ class StaleCacheFilesRemoverTest : public testing::Test { SetFreeDiskSpaceGetterForTesting(NULL); cache_->DestroyOnUIThread(); // The cache destruction requires to post a task to the blocking pool. - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); profile_.reset(NULL); } @@ -162,7 +162,7 @@ class StaleCacheFilesRemoverTest : public testing::Test { TEST_F(StaleCacheFilesRemoverTest, RemoveStaleCacheFiles) { FilePath dummy_file = - gdata::test_util::GetTestFilePath("gdata/root_feed.json"); + google_apis::test_util::GetTestFilePath("gdata/root_feed.json"); std::string resource_id("pdf:1a2b3c"); std::string md5("abcdef0123456789"); @@ -173,7 +173,7 @@ TEST_F(StaleCacheFilesRemoverTest, RemoveStaleCacheFiles) { cache_->StoreOnUIThread(resource_id, md5, dummy_file, DriveCache::FILE_OPERATION_COPY, base::Bind(&VerifyCacheFileState)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); // Verify that the cache file exists. FilePath path = cache_->GetCacheFilePath(resource_id, @@ -197,7 +197,7 @@ TEST_F(StaleCacheFilesRemoverTest, RemoveStaleCacheFiles) { &error, &unused, &entry_proto)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); file_system_->GetEntryInfoByPath( @@ -205,7 +205,7 @@ TEST_F(StaleCacheFilesRemoverTest, RemoveStaleCacheFiles) { base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback, &error, &entry_proto)); - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); EXPECT_FALSE(entry_proto.get()); @@ -213,7 +213,7 @@ TEST_F(StaleCacheFilesRemoverTest, RemoveStaleCacheFiles) { LoadRootFeedDocument("gdata/root_feed.json"); // Wait for StaleCacheFilesRemover to finish cleaning up the stale file. - gdata::test_util::RunBlockingPoolTask(); + google_apis::test_util::RunBlockingPoolTask(); // Verify that the cache file is deleted. path = cache_->GetCacheFilePath(resource_id, diff --git a/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc b/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc index 0d6df25..e259737 100644 --- a/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc +++ b/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc @@ -364,14 +364,15 @@ IN_PROC_BROWSER_TEST_F(RemoteFileSystemExtensionApiTest, scoped_ptr<base::Value> dir_value(LoadJSONFile(kTestDirectory)); EXPECT_CALL(*mock_drive_service_, CreateDirectory(_, _, _)) - .WillOnce(MockCreateDirectoryCallback(gdata::HTTP_SUCCESS, &dir_value)); + .WillOnce(MockCreateDirectoryCallback( + google_apis::HTTP_SUCCESS, &dir_value)); // Then the test will try to read an existing file file. // Remote filesystem should first request root feed from gdata server. scoped_ptr<base::Value> documents_value(LoadJSONFile(kTestRootFeed)); EXPECT_CALL(*mock_drive_service_, GetDocuments(_, _, _, _, _)) - .WillOnce(MockGetDocumentsCallback(gdata::HTTP_SUCCESS, + .WillOnce(MockGetDocumentsCallback(google_apis::HTTP_SUCCESS, &documents_value)); // When file browser tries to read the file, remote filesystem should detect @@ -385,7 +386,7 @@ IN_PROC_BROWSER_TEST_F(RemoteFileSystemExtensionApiTest, LoadJSONFile(kTestDocumentToDownloadEntry)); EXPECT_CALL(*mock_drive_service_, GetDocumentEntry("file:1_file_resource_id", _)) - .WillOnce(MockGetDocumentEntryCallback(gdata::HTTP_SUCCESS, + .WillOnce(MockGetDocumentEntryCallback(google_apis::HTTP_SUCCESS, &document_to_download_value)); // We expect to download url defined in document entry returned by @@ -393,7 +394,7 @@ IN_PROC_BROWSER_TEST_F(RemoteFileSystemExtensionApiTest, EXPECT_CALL(*mock_drive_service_, DownloadFile(_, _, GURL("https://file_content_url_changed"), _, _)) - .WillOnce(MockDownloadFileCallback(gdata::HTTP_SUCCESS)); + .WillOnce(MockDownloadFileCallback(google_apis::HTTP_SUCCESS)); // On exit, all operations in progress should be cancelled. EXPECT_CALL(*mock_drive_service_, CancelAll()); @@ -411,14 +412,14 @@ IN_PROC_BROWSER_TEST_F(RemoteFileSystemExtensionApiTest, ContentSearch) { scoped_ptr<base::Value> documents_value(LoadJSONFile(kTestRootFeed)); EXPECT_CALL(*mock_drive_service_, GetDocuments(_, _, "", _, _)) - .WillOnce(MockGetDocumentsCallback(gdata::HTTP_SUCCESS, + .WillOnce(MockGetDocumentsCallback(google_apis::HTTP_SUCCESS, &documents_value)); // We return the whole test file system in serch results. scoped_ptr<base::Value> search_value(LoadJSONFile(kTestRootFeed)); EXPECT_CALL(*mock_drive_service_, GetDocuments(_, _, "foo", _, _)) - .WillOnce(MockGetDocumentsCallback(gdata::HTTP_SUCCESS, + .WillOnce(MockGetDocumentsCallback(google_apis::HTTP_SUCCESS, &search_value)); // Test will try to create a snapshot of the returned file. @@ -426,7 +427,7 @@ IN_PROC_BROWSER_TEST_F(RemoteFileSystemExtensionApiTest, ContentSearch) { LoadJSONFile(kTestDocumentToDownloadEntry)); EXPECT_CALL(*mock_drive_service_, GetDocumentEntry("file:1_file_resource_id", _)) - .WillOnce(MockGetDocumentEntryCallback(gdata::HTTP_SUCCESS, + .WillOnce(MockGetDocumentEntryCallback(google_apis::HTTP_SUCCESS, &document_to_download_value)); // We expect to download url defined in document entry returned by @@ -434,7 +435,7 @@ IN_PROC_BROWSER_TEST_F(RemoteFileSystemExtensionApiTest, ContentSearch) { EXPECT_CALL(*mock_drive_service_, DownloadFile(_, _, GURL("https://file_content_url_changed"), _, _)) - .WillOnce(MockDownloadFileCallback(gdata::HTTP_SUCCESS)); + .WillOnce(MockDownloadFileCallback(google_apis::HTTP_SUCCESS)); // On exit, all operations in progress should be cancelled. EXPECT_CALL(*mock_drive_service_, CancelAll()); diff --git a/chrome/browser/chromeos/extensions/file_browser_event_router.cc b/chrome/browser/chromeos/extensions/file_browser_event_router.cc index 5212a6e..5b54564 100644 --- a/chrome/browser/chromeos/extensions/file_browser_event_router.cc +++ b/chrome/browser/chromeos/extensions/file_browser_event_router.cc @@ -243,13 +243,14 @@ void FileBrowserEventRouter::MountDrive( void FileBrowserEventRouter::OnAuthenticated( const base::Closure& callback, - gdata::GDataErrorCode error, + google_apis::GDataErrorCode error, const std::string& token) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); chromeos::MountError error_code; // For the file manager to work offline, GDATA_NO_CONNECTION is allowed. - if (error == gdata::HTTP_SUCCESS || error == gdata::GDATA_NO_CONNECTION) + if (error == google_apis::HTTP_SUCCESS || + error == google_apis::GDATA_NO_CONNECTION) error_code = chromeos::MOUNT_ERROR_NONE; else error_code = chromeos::MOUNT_ERROR_NOT_AUTHENTICATED; @@ -418,7 +419,7 @@ void FileBrowserEventRouter::Observe( } void FileBrowserEventRouter::OnProgressUpdate( - const gdata::OperationProgressStatusList& list) { + const google_apis::OperationProgressStatusList& list) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); scoped_ptr<ListValue> event_list( @@ -476,10 +477,10 @@ void FileBrowserEventRouter::OnFileSystemBeingUnmounted() { } void FileBrowserEventRouter::OnAuthenticationFailed( - gdata::GDataErrorCode error) { + google_apis::GDataErrorCode error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (error == gdata::GDATA_NO_CONNECTION) + if (error == google_apis::GDATA_NO_CONNECTION) return; // Raise a MountCompleted event to notify the File Manager. diff --git a/chrome/browser/chromeos/extensions/file_browser_event_router.h b/chrome/browser/chromeos/extensions/file_browser_event_router.h index 7f6f12c..1567dc1 100644 --- a/chrome/browser/chromeos/extensions/file_browser_event_router.h +++ b/chrome/browser/chromeos/extensions/file_browser_event_router.h @@ -86,8 +86,9 @@ class FileBrowserEventRouter // drive::DriveServiceObserver overrides. virtual void OnProgressUpdate( - const gdata::OperationProgressStatusList& list) OVERRIDE; - virtual void OnAuthenticationFailed(gdata::GDataErrorCode error) OVERRIDE; + const google_apis::OperationProgressStatusList& list) OVERRIDE; + virtual void OnAuthenticationFailed( + google_apis::GDataErrorCode error) OVERRIDE; // drive::DriveFileSystemInterface::Observer overrides. virtual void OnDirectoryChanged(const FilePath& directory_path) OVERRIDE; @@ -200,7 +201,7 @@ class FileBrowserEventRouter // Used to implement MountDrive(). Called after the authentication. void OnAuthenticated(const base::Closure& callback, - gdata::GDataErrorCode error, + google_apis::GDataErrorCode error, const std::string& tokeni); scoped_refptr<FileWatcherDelegate> delegate_; diff --git a/chrome/browser/chromeos/extensions/file_browser_private_api.cc b/chrome/browser/chromeos/extensions/file_browser_private_api.cc index 545d968..cd8fb98 100644 --- a/chrome/browser/chromeos/extensions/file_browser_private_api.cc +++ b/chrome/browser/chromeos/extensions/file_browser_private_api.cc @@ -80,7 +80,7 @@ using content::SiteInstance; using content::WebContents; using extensions::Extension; using file_handler_util::FileTaskExecutor; -using gdata::InstalledApp; +using google_apis::InstalledApp; namespace { @@ -2434,7 +2434,7 @@ void GetDriveFilesFunction::GetFileOrSendResponse() { system_service->file_system()->GetFileByPath( drive_path, base::Bind(&GetDriveFilesFunction::OnFileReady, this), - gdata::GetContentCallback()); + google_apis::GetContentCallback()); } @@ -2477,7 +2477,7 @@ ListValue* GetFileTransfersFunction::GetFileTransfersList() { if (!system_service) return NULL; - gdata::OperationProgressStatusList list = + google_apis::OperationProgressStatusList list = system_service->drive_service()->GetProgressStatusList(); return file_manager_util::ProgressStatusVectorToListValue( profile_, source_url_.GetOrigin(), list); diff --git a/chrome/browser/chromeos/extensions/file_browser_private_api.h b/chrome/browser/chromeos/extensions/file_browser_private_api.h index a4836b0..e15b5d4 100644 --- a/chrome/browser/chromeos/extensions/file_browser_private_api.h +++ b/chrome/browser/chromeos/extensions/file_browser_private_api.h @@ -709,7 +709,7 @@ class SearchDriveFunction : public AsyncExtensionFunction { void OnFileSystemOpened(base::PlatformFileError result, const std::string& file_system_name, const GURL& file_system_url); - // Callback for gdata::SearchAsync called after file system is opened. + // Callback for google_apis::SearchAsync called after file system is opened. void OnSearch(drive::DriveFileError error, const GURL& next_feed, scoped_ptr<std::vector<drive::SearchResultInfo> > result_paths); diff --git a/chrome/browser/chromeos/extensions/file_manager_util.cc b/chrome/browser/chromeos/extensions/file_manager_util.cc index 99e919e..6cfc6f4 100644 --- a/chrome/browser/chromeos/extensions/file_manager_util.cc +++ b/chrome/browser/chromeos/extensions/file_manager_util.cc @@ -185,7 +185,7 @@ std::string GetDialogTypeAsString( DictionaryValue* ProgessStatusToDictionaryValue( Profile* profile, const GURL& origin_url, - const gdata::OperationProgressStatus& status) { + const google_apis::OperationProgressStatus& status) { scoped_ptr<DictionaryValue> result(new DictionaryValue()); GURL file_url; if (file_manager_util::ConvertFileToFileSystemUrl(profile, @@ -754,7 +754,7 @@ bool ExecuteBuiltinHandler(Browser* browser, const FilePath& path, system_service->file_system()->GetFileByPath( drive::util::ExtractDrivePath(path), base::Bind(&OnCRXDownloadCallback, browser), - gdata::GetContentCallback()); + google_apis::GetContentCallback()); } else { InstallCRX(browser, path); } @@ -809,9 +809,10 @@ bool ShouldBeOpenedWithPdfPlugin(Profile* profile, const char* file_extension) { ListValue* ProgressStatusVectorToListValue( Profile* profile, const GURL& origin_url, - const gdata::OperationProgressStatusList& list) { + const google_apis::OperationProgressStatusList& list) { scoped_ptr<ListValue> result_list(new ListValue()); - for (gdata::OperationProgressStatusList::const_iterator iter = list.begin(); + for (google_apis::OperationProgressStatusList::const_iterator iter = + list.begin(); iter != list.end(); ++iter) { result_list->Append( ProgessStatusToDictionaryValue(profile, origin_url, *iter)); diff --git a/chrome/browser/chromeos/extensions/file_manager_util.h b/chrome/browser/chromeos/extensions/file_manager_util.h index a9a16c1..6d1dad3 100644 --- a/chrome/browser/chromeos/extensions/file_manager_util.h +++ b/chrome/browser/chromeos/extensions/file_manager_util.h @@ -91,7 +91,7 @@ bool ShouldBeOpenedWithPdfPlugin(Profile* profile, const char* file_extension); // Converts the vector of progress status to their JSON (Value) form. base::ListValue* ProgressStatusVectorToListValue( Profile* profile, const GURL& origin_url, - const gdata::OperationProgressStatusList& list); + const google_apis::OperationProgressStatusList& list); } // namespace file_manager_util diff --git a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc index 4e15c3e..f4705b5 100644 --- a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc +++ b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc @@ -107,9 +107,10 @@ void ExtractIMEInfo(const input_method::InputMethodDescriptor& ime, } ash::DriveOperationStatusList GetDriveStatusList( - const gdata::OperationProgressStatusList& list) { + const google_apis::OperationProgressStatusList& list) { ash::DriveOperationStatusList results; - for (gdata::OperationProgressStatusList::const_iterator it = list.begin(); + for (google_apis::OperationProgressStatusList::const_iterator it = + list.begin(); it != list.end(); ++it) { ash::DriveOperationStatus status; status.file_path = it->file_path; @@ -1096,9 +1097,9 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate, NotifyRefreshIME(false); } - // gdata::DriveServiceObserver overrides. + // google_apis::DriveServiceObserver overrides. virtual void OnProgressUpdate( - const gdata::OperationProgressStatusList& list) OVERRIDE { + const google_apis::OperationProgressStatusList& list) OVERRIDE { std::vector<ash::DriveOperationStatus> ui_list = GetDriveStatusList(list); NotifyRefreshDrive(ui_list); @@ -1107,11 +1108,12 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate, // raise events that will let us properly clear the uber tray state. if (list.size() > 0) { bool has_in_progress_items = false; - for (gdata::OperationProgressStatusList::const_iterator it = list.begin(); - it != list.end(); ++it) { - if (it->transfer_state == gdata::OPERATION_STARTED || - it->transfer_state == gdata::OPERATION_IN_PROGRESS || - it->transfer_state == gdata::OPERATION_SUSPENDED) { + for (google_apis::OperationProgressStatusList::const_iterator it = + list.begin(); + it != list.end(); ++it) { + if (it->transfer_state == google_apis::OPERATION_STARTED || + it->transfer_state == google_apis::OPERATION_IN_PROGRESS || + it->transfer_state == google_apis::OPERATION_SUSPENDED) { has_in_progress_items = true; break; } diff --git a/chrome/browser/google_apis/auth_service.cc b/chrome/browser/google_apis/auth_service.cc index 215faf7..abdc038df 100644 --- a/chrome/browser/google_apis/auth_service.cc +++ b/chrome/browser/google_apis/auth_service.cc @@ -28,7 +28,7 @@ using content::BrowserThread; -namespace gdata { +namespace google_apis { void AuthService::Initialize(Profile* profile) { profile_ = profile; @@ -65,7 +65,7 @@ void AuthService::StartAuthentication(OperationRegistry* registry, if (HasAccessToken()) { relay_proxy->PostTask(FROM_HERE, - base::Bind(callback, gdata::HTTP_SUCCESS, access_token_)); + base::Bind(callback, google_apis::HTTP_SUCCESS, access_token_)); } else if (HasRefreshToken()) { BrowserThread::PostTask( BrowserThread::UI, @@ -79,7 +79,7 @@ void AuthService::StartAuthentication(OperationRegistry* registry, callback)))); } else { relay_proxy->PostTask(FROM_HERE, - base::Bind(callback, gdata::GDATA_NOT_READY, std::string())); + base::Bind(callback, google_apis::GDATA_NOT_READY, std::string())); } } @@ -151,4 +151,4 @@ bool AuthService::CanAuthenticate(Profile* profile) { return true; } -} // namespace gdata +} // namespace google_apis diff --git a/chrome/browser/google_apis/auth_service.h b/chrome/browser/google_apis/auth_service.h index 71825b4..a3499fd 100644 --- a/chrome/browser/google_apis/auth_service.h +++ b/chrome/browser/google_apis/auth_service.h @@ -17,7 +17,7 @@ class Profile; -namespace gdata { +namespace google_apis { class OperationRegistry; class AuthServiceObserver; @@ -99,6 +99,6 @@ class AuthService : public content::NotificationObserver { DISALLOW_COPY_AND_ASSIGN(AuthService); }; -} // namespace gdata +} // namespace google_apis #endif // CHROME_BROWSER_GOOGLE_APIS_AUTH_SERVICE_H_ diff --git a/chrome/browser/google_apis/auth_service_observer.h b/chrome/browser/google_apis/auth_service_observer.h index 4a0d0ec..cba9e36 100644 --- a/chrome/browser/google_apis/auth_service_observer.h +++ b/chrome/browser/google_apis/auth_service_observer.h @@ -5,7 +5,7 @@ #ifndef CHROME_BROWSER_GOOGLE_APIS_AUTH_SERVICE_OBSERVER_H_ #define CHROME_BROWSER_GOOGLE_APIS_AUTH_SERVICE_OBSERVER_H_ -namespace gdata { +namespace google_apis { // Interface for classes that need to observe events from AuthService. // All events are notified on UI thread. @@ -18,6 +18,6 @@ class AuthServiceObserver { virtual ~AuthServiceObserver() {} }; -} // namespace gdata +} // namespace google_apis #endif // CHROME_BROWSER_GOOGLE_APIS_AUTH_SERVICE_OBSERVER_H_ diff --git a/chrome/browser/google_apis/drive_api_operations.cc b/chrome/browser/google_apis/drive_api_operations.cc index 193196f..7e92fe4 100644 --- a/chrome/browser/google_apis/drive_api_operations.cc +++ b/chrome/browser/google_apis/drive_api_operations.cc @@ -22,7 +22,7 @@ const char kDriveV2FileURLFormat[] = } // namespace // TODO(kochi): Rename to namespace drive. http://crbug.com/136371 -namespace gdata { +namespace google_apis { //============================== GetAboutOperation ============================= @@ -110,4 +110,4 @@ GURL GetFileOperation::GetURL() const { return GURL(base::StringPrintf(kDriveV2FileURLFormat, file_id_.c_str())); } -} // namespace gdata +} // namespace google_apis diff --git a/chrome/browser/google_apis/drive_api_operations.h b/chrome/browser/google_apis/drive_api_operations.h index a4b4e1e..9f49229 100644 --- a/chrome/browser/google_apis/drive_api_operations.h +++ b/chrome/browser/google_apis/drive_api_operations.h @@ -10,7 +10,7 @@ #include "chrome/browser/google_apis/operations_base.h" // TODO(kochi): Rename to namespace drive. http://crbug.com/136371 -namespace gdata { +namespace google_apis { //============================== GetAboutOperation ============================= @@ -115,6 +115,6 @@ class GetFileOperation : public GetDataOperation { DISALLOW_COPY_AND_ASSIGN(GetFileOperation); }; -} // namespace gdata +} // namespace google_apis #endif // CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_OPERATIONS_H_ diff --git a/chrome/browser/google_apis/drive_api_parser.cc b/chrome/browser/google_apis/drive_api_parser.cc index f6f64b7..58fa09d 100644 --- a/chrome/browser/google_apis/drive_api_parser.cc +++ b/chrome/browser/google_apis/drive_api_parser.cc @@ -140,14 +140,14 @@ const char kGoogleTableMimeType[] = "application/vnd.google-apps.table"; // Maps category name to enum IconCategory. struct AppIconCategoryMap { - gdata::DriveAppIcon::IconCategory category; + google_apis::DriveAppIcon::IconCategory category; const char* category_name; }; const AppIconCategoryMap kAppIconCategoryMap[] = { - { gdata::DriveAppIcon::DOCUMENT, "document" }, - { gdata::DriveAppIcon::APPLICATION, "application" }, - { gdata::DriveAppIcon::SHARED_DOCUMENT, "documentShared" }, + { google_apis::DriveAppIcon::DOCUMENT, "document" }, + { google_apis::DriveAppIcon::APPLICATION, "application" }, + { google_apis::DriveAppIcon::SHARED_DOCUMENT, "documentShared" }, }; // Checks if the JSON is expected kind. In Drive API, JSON data structure has @@ -165,7 +165,7 @@ bool IsResourceKindExpected(const base::Value& value, } // namespace // TODO(kochi): Rename to namespace drive. http://crbug.com/136371 -namespace gdata { +namespace google_apis { //////////////////////////////////////////////////////////////////////////////// // AboutResource implementation @@ -412,15 +412,15 @@ void FileResource::RegisterJSONConverter( converter->RegisterCustomField<base::Time>( kCreatedDate, &FileResource::created_date_, - &gdata::util::GetTimeFromString); + &google_apis::util::GetTimeFromString); converter->RegisterCustomField<base::Time>( kModifiedByMeDate, &FileResource::modified_by_me_date_, - &gdata::util::GetTimeFromString); + &google_apis::util::GetTimeFromString); converter->RegisterCustomField<base::Time>( kLastViewedByMeDate, &FileResource::last_viewed_by_me_date_, - &gdata::util::GetTimeFromString); + &google_apis::util::GetTimeFromString); converter->RegisterCustomField<GURL>(kDownloadUrl, &FileResource::download_url_, GetGURLFromString); @@ -648,4 +648,4 @@ bool FileLabels::Parse(const base::Value& value) { return true; } -} // namespace gdata +} // namespace google_apis diff --git a/chrome/browser/google_apis/drive_api_parser.h b/chrome/browser/google_apis/drive_api_parser.h index c5ae544..3ff0f9f1 100644 --- a/chrome/browser/google_apis/drive_api_parser.h +++ b/chrome/browser/google_apis/drive_api_parser.h @@ -30,7 +30,7 @@ class RepeatedMessageConverter; } // namespace base // TODO(kochi): Rename to namespace drive. http://crbug.com/136371 -namespace gdata { +namespace google_apis { // About resource represents the account information about the current user. // https://developers.google.com/drive/v2/reference/about @@ -593,6 +593,6 @@ class ChangeList { DISALLOW_COPY_AND_ASSIGN(ChangeList); }; -} // namespace gdata +} // namespace google_apis #endif // CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_PARSER_H_ diff --git a/chrome/browser/google_apis/drive_api_parser_unittest.cc b/chrome/browser/google_apis/drive_api_parser_unittest.cc index e4aa323..efe7405 100644 --- a/chrome/browser/google_apis/drive_api_parser_unittest.cc +++ b/chrome/browser/google_apis/drive_api_parser_unittest.cc @@ -22,7 +22,7 @@ using base::Value; using base::DictionaryValue; using base::ListValue; -namespace gdata { +namespace google_apis { // TODO(nhiroki): Make it possible to run these tests on any platforms after // moving json files to out of 'chromeos' directory (http://crbug.com/149788). @@ -162,13 +162,13 @@ TEST(DriveAPIParserTest, FileListParser) { EXPECT_TRUE(file1.labels().is_viewed()); base::Time created_time; - ASSERT_TRUE(gdata::util::GetTimeFromString("2012-07-24T08:51:16.570Z", - &created_time)); + ASSERT_TRUE(google_apis::util::GetTimeFromString("2012-07-24T08:51:16.570Z", + &created_time)); EXPECT_EQ(created_time, file1.created_date()); base::Time modified_time; - ASSERT_TRUE(gdata::util::GetTimeFromString("2012-07-27T05:43:20.269Z", - &modified_time)); + ASSERT_TRUE(google_apis::util::GetTimeFromString("2012-07-27T05:43:20.269Z", + &modified_time)); EXPECT_EQ(modified_time, file1.modified_by_me_date()); ASSERT_EQ(1U, file1.parents().size()); @@ -294,4 +294,4 @@ TEST(DriveAPIParserTest, ChangeListParser) { } #endif // OS_CHROMEOS -} // namespace gdata +} // namespace google_apis diff --git a/chrome/browser/google_apis/drive_entry_kinds.h b/chrome/browser/google_apis/drive_entry_kinds.h index 54bf164..06f1e69 100644 --- a/chrome/browser/google_apis/drive_entry_kinds.h +++ b/chrome/browser/google_apis/drive_entry_kinds.h @@ -5,7 +5,7 @@ #ifndef CHROME_BROWSER_GOOGLE_APIS_DRIVE_ENTRY_KINDS_H_ #define CHROME_BROWSER_GOOGLE_APIS_DRIVE_ENTRY_KINDS_H_ -namespace gdata { +namespace google_apis { // DriveEntryKind specifies the kind of a Drive entry. // @@ -34,6 +34,6 @@ enum DriveEntryKind { ENTRY_KIND_MAX_VALUE, }; -} // namespace gdata +} // namespace google_apis #endif // CHROME_BROWSER_GOOGLE_APIS_DRIVE_ENTRY_KINDS_H_ diff --git a/chrome/browser/google_apis/drive_service_interface.h b/chrome/browser/google_apis/drive_service_interface.h index 412a929..3357cde 100644 --- a/chrome/browser/google_apis/drive_service_interface.h +++ b/chrome/browser/google_apis/drive_service_interface.h @@ -49,10 +49,10 @@ class DriveServiceObserver { // Called when an operation started, made some progress, or finished. virtual void OnProgressUpdate( - const gdata::OperationProgressStatusList& list) {} + const google_apis::OperationProgressStatusList& list) {} // Called when GData authentication failed. - virtual void OnAuthenticationFailed(gdata::GDataErrorCode error) {} + virtual void OnAuthenticationFailed(google_apis::GDataErrorCode error) {} protected: virtual ~DriveServiceObserver() {} @@ -92,14 +92,16 @@ class DriveServiceInterface { virtual bool CancelForFilePath(const FilePath& file_path) = 0; // Obtains the list of currently active operations. - virtual gdata::OperationProgressStatusList GetProgressStatusList() const = 0; + virtual google_apis::OperationProgressStatusList GetProgressStatusList() + const = 0; // Authentication service: // Authenticates the user by fetching the auth token as // needed. |callback| will be run with the error code and the auth // token, on the thread this function is run. - virtual void Authenticate(const gdata::AuthStatusCallback& callback) = 0; + virtual void Authenticate( + const google_apis::AuthStatusCallback& callback) = 0; // True if OAuth2 access token is retrieved and believed to be fresh. virtual bool HasAccessToken() const = 0; @@ -128,27 +130,31 @@ class DriveServiceInterface { int64 start_changestamp, const std::string& search_query, const std::string& directory_resource_id, - const gdata::GetDataCallback& callback) = 0; + const google_apis::GetDataCallback& callback) = 0; // Fetches single entry metadata from server. The entry's resource id equals // |resource_id|. // Upon completion, invokes |callback| with results on the calling thread. - virtual void GetDocumentEntry(const std::string& resource_id, - const gdata::GetDataCallback& callback) = 0; + virtual void GetDocumentEntry( + const std::string& resource_id, + const google_apis::GetDataCallback& callback) = 0; // Gets the account metadata from the server using the default account // metadata URL. Upon completion, invokes |callback| with results on the // calling thread. - virtual void GetAccountMetadata(const gdata::GetDataCallback& callback) = 0; + virtual void GetAccountMetadata( + const google_apis::GetDataCallback& callback) = 0; // Gets the application information from the server. // Upon completion, invokes |callback| with results on the calling thread. - virtual void GetApplicationInfo(const gdata::GetDataCallback& callback) = 0; + virtual void GetApplicationInfo( + const google_apis::GetDataCallback& callback) = 0; // Deletes a document identified by its 'self' |url| and |etag|. // Upon completion, invokes |callback| with results on the calling thread. - virtual void DeleteDocument(const GURL& document_url, - const gdata::EntryActionCallback& callback) = 0; + virtual void DeleteDocument( + const GURL& document_url, + const google_apis::EntryActionCallback& callback) = 0; // Downloads a document identified by its |content_url| in a given |format|. // Upon completion, invokes |callback| with results on the calling thread. @@ -157,7 +163,7 @@ class DriveServiceInterface { const FilePath& local_cache_path, const GURL& content_url, DocumentExportFormat format, - const gdata::DownloadActionCallback& callback) = 0; + const google_apis::DownloadActionCallback& callback) = 0; // Makes a copy of a document identified by its |resource_id|. // The copy is named as the UTF-8 encoded |new_name| and is not added to any @@ -166,14 +172,15 @@ class DriveServiceInterface { // calling thread. virtual void CopyDocument(const std::string& resource_id, const FilePath::StringType& new_name, - const gdata::GetDataCallback& callback) = 0; + const google_apis::GetDataCallback& callback) = 0; // Renames a document or collection identified by its 'self' link // |document_url| to the UTF-8 encoded |new_name|. Upon completion, // invokes |callback| with results on the calling thread. - virtual void RenameResource(const GURL& resource_url, - const FilePath::StringType& new_name, - const gdata::EntryActionCallback& callback) = 0; + virtual void RenameResource( + const GURL& resource_url, + const FilePath::StringType& new_name, + const google_apis::EntryActionCallback& callback) = 0; // Adds a resource (document, file, or collection) identified by its // 'self' link |resource_url| to a collection with a content link @@ -182,7 +189,7 @@ class DriveServiceInterface { virtual void AddResourceToDirectory( const GURL& parent_content_url, const GURL& resource_url, - const gdata::EntryActionCallback& callback) = 0; + const google_apis::EntryActionCallback& callback) = 0; // Removes a resource (document, file, collection) identified by its // 'self' link |resource_url| from a collection with a content link @@ -192,15 +199,16 @@ class DriveServiceInterface { const GURL& parent_content_url, const GURL& resource_url, const std::string& resource_id, - const gdata::EntryActionCallback& callback) = 0; + const google_apis::EntryActionCallback& callback) = 0; // Creates new collection with |directory_name| under parent directory // identified with |parent_content_url|. If |parent_content_url| is empty, // the new collection will be created in the root. Upon completion, // invokes |callback| and passes newly created entry on the calling thread. - virtual void CreateDirectory(const GURL& parent_content_url, - const FilePath::StringType& directory_name, - const gdata::GetDataCallback& callback) = 0; + virtual void CreateDirectory( + const GURL& parent_content_url, + const FilePath::StringType& directory_name, + const google_apis::GetDataCallback& callback) = 0; // Downloads a file identified by its |content_url|. The downloaded file will // be stored at |local_cache_path| location. Upon completion, invokes @@ -212,23 +220,24 @@ class DriveServiceInterface { const FilePath& virtual_path, const FilePath& local_cache_path, const GURL& content_url, - const gdata::DownloadActionCallback& download_action_callback, - const gdata::GetContentCallback& get_content_callback) = 0; + const google_apis::DownloadActionCallback& download_action_callback, + const google_apis::GetContentCallback& get_content_callback) = 0; // Initiates uploading of a document/file. virtual void InitiateUpload( - const gdata::InitiateUploadParams& params, - const gdata::InitiateUploadCallback& callback) = 0; + const google_apis::InitiateUploadParams& params, + const google_apis::InitiateUploadCallback& callback) = 0; // Resumes uploading of a document/file on the calling thread. - virtual void ResumeUpload(const gdata::ResumeUploadParams& params, - const gdata::ResumeUploadCallback& callback) = 0; + virtual void ResumeUpload( + const google_apis::ResumeUploadParams& params, + const google_apis::ResumeUploadCallback& callback) = 0; // Authorizes a Drive app with the id |app_id| to open the given document. // Upon completion, invokes |callback| with results on the calling thread. virtual void AuthorizeApp(const GURL& resource_url, const std::string& app_id, - const gdata::GetDataCallback& callback) = 0; + const google_apis::GetDataCallback& callback) = 0; }; } // namespace drive diff --git a/chrome/browser/google_apis/drive_upload_mode.h b/chrome/browser/google_apis/drive_upload_mode.h index 6ac4f1e..718be85 100644 --- a/chrome/browser/google_apis/drive_upload_mode.h +++ b/chrome/browser/google_apis/drive_upload_mode.h @@ -5,7 +5,7 @@ #ifndef CHROME_BROWSER_GOOGLE_APIS_DRIVE_UPLOAD_MODE_H_ #define CHROME_BROWSER_GOOGLE_APIS_DRIVE_UPLOAD_MODE_H_ -namespace gdata { +namespace google_apis { // The mode for uploading. enum UploadMode { @@ -14,6 +14,6 @@ enum UploadMode { UPLOAD_INVALID, // Used as an invalid value. }; -} // namespace gdata +} // namespace google_apis #endif // CHROME_BROWSER_GOOGLE_APIS_DRIVE_UPLOAD_MODE_H_ diff --git a/chrome/browser/google_apis/gdata_errorcode.h b/chrome/browser/google_apis/gdata_errorcode.h index c98f721..c18fb0c 100644 --- a/chrome/browser/google_apis/gdata_errorcode.h +++ b/chrome/browser/google_apis/gdata_errorcode.h @@ -5,7 +5,7 @@ #ifndef CHROME_BROWSER_GOOGLE_APIS_GDATA_ERRORCODE_H_ #define CHROME_BROWSER_GOOGLE_APIS_GDATA_ERRORCODE_H_ -namespace gdata { +namespace google_apis { // HTTP errors that can be returned by GData service. enum GDataErrorCode { @@ -31,6 +31,6 @@ enum GDataErrorCode { GDATA_NOT_READY = -105, }; -} // namespace gdata +} // namespace google_apis #endif // CHROME_BROWSER_GOOGLE_APIS_GDATA_ERRORCODE_H_ diff --git a/chrome/browser/google_apis/gdata_operations.cc b/chrome/browser/google_apis/gdata_operations.cc index 046671d..dc22004 100644 --- a/chrome/browser/google_apis/gdata_operations.cc +++ b/chrome/browser/google_apis/gdata_operations.cc @@ -157,7 +157,7 @@ GURL FormatDocumentListURL(const std::string& directory_resource_id) { } // namespace -namespace gdata { +namespace google_apis { //============================ Structs =========================== @@ -1014,4 +1014,4 @@ void GetContactPhotoOperation::RunCallbackOnPrematureFailure( callback_.Run(code, data.Pass()); } -} // namespace gdata +} // namespace google_apis diff --git a/chrome/browser/google_apis/gdata_operations.h b/chrome/browser/google_apis/gdata_operations.h index af3262e..48bf2a8 100644 --- a/chrome/browser/google_apis/gdata_operations.h +++ b/chrome/browser/google_apis/gdata_operations.h @@ -12,7 +12,7 @@ #include "chrome/browser/google_apis/operations_base.h" #include "net/base/io_buffer.h" -namespace gdata { +namespace google_apis { class GDataEntry; class DocumentEntry; @@ -424,7 +424,7 @@ struct ResumeUploadParams { // Callback type for DocumentServiceInterface::ResumeUpload. typedef base::Callback<void( const ResumeUploadResponse& response, - scoped_ptr<gdata::DocumentEntry> new_entry)> ResumeUploadCallback; + scoped_ptr<google_apis::DocumentEntry> new_entry)> ResumeUploadCallback; // This class performs the operation for resuming the upload of a file. class ResumeUploadOperation : public UrlFetchOperationBase { @@ -545,6 +545,6 @@ class GetContactPhotoOperation : public UrlFetchOperationBase { DISALLOW_COPY_AND_ASSIGN(GetContactPhotoOperation); }; -} // namespace gdata +} // namespace google_apis #endif // CHROME_BROWSER_GOOGLE_APIS_GDATA_OPERATIONS_H_ diff --git a/chrome/browser/google_apis/gdata_operations_unittest.cc b/chrome/browser/google_apis/gdata_operations_unittest.cc index b1cedc0..1ffbdfeb 100644 --- a/chrome/browser/google_apis/gdata_operations_unittest.cc +++ b/chrome/browser/google_apis/gdata_operations_unittest.cc @@ -13,7 +13,7 @@ #include "content/public/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" -namespace gdata { +namespace google_apis { namespace { @@ -82,9 +82,9 @@ class GDataOperationsTest : public testing::Test { TEST_F(GDataOperationsTest, GetDataOperationParseJson) { scoped_ptr<base::Value> value; GDataErrorCode error; - gdata::GetDataCallback cb = base::Bind(&GetDataOperationParseJsonCallback, - &error, - &value); + google_apis::GetDataCallback cb = + base::Bind(&GetDataOperationParseJsonCallback, + &error, &value); JsonParseTestGetDataOperation* getData = new JsonParseTestGetDataOperation(runner_->operation_registry(), cb); getData->NotifyStart(); @@ -151,9 +151,9 @@ TEST_F(GDataOperationsTest, GetDataOperationParseJson) { TEST_F(GDataOperationsTest, GetDataOperationParseInvalidJson) { scoped_ptr<base::Value> value; GDataErrorCode error; - gdata::GetDataCallback cb = base::Bind(&GetDataOperationParseJsonCallback, - &error, - &value); + google_apis::GetDataCallback cb = + base::Bind(&GetDataOperationParseJsonCallback, + &error, &value); JsonParseTestGetDataOperation* getData = new JsonParseTestGetDataOperation(runner_->operation_registry(), cb); getData->NotifyStart(); @@ -178,4 +178,4 @@ TEST_F(GDataOperationsTest, GetDataOperationParseInvalidJson) { } } -} // namespace gdata +} // namespace google_apis diff --git a/chrome/browser/google_apis/gdata_test_util.cc b/chrome/browser/google_apis/gdata_test_util.cc index 07602c3..cf3de4f 100644 --- a/chrome/browser/google_apis/gdata_test_util.cc +++ b/chrome/browser/google_apis/gdata_test_util.cc @@ -14,7 +14,7 @@ #include "testing/gtest/include/gtest/gtest.h" -namespace gdata { +namespace google_apis { namespace test_util { // This class is used to monitor if any task is posted to a message loop. @@ -74,4 +74,4 @@ scoped_ptr<base::Value> LoadJSONFile(const std::string& relative_path) { } } // namespace test_util -} // namespace gdata +} // namespace google_apis diff --git a/chrome/browser/google_apis/gdata_test_util.h b/chrome/browser/google_apis/gdata_test_util.h index 1c12491..788709e 100644 --- a/chrome/browser/google_apis/gdata_test_util.h +++ b/chrome/browser/google_apis/gdata_test_util.h @@ -17,7 +17,7 @@ namespace base { class Value; } -namespace gdata { +namespace google_apis { namespace test_util { // Runs a task posted to the blocking pool, including subsequent tasks posted @@ -38,6 +38,6 @@ FilePath GetTestFilePath(const std::string& relative_path); scoped_ptr<base::Value> LoadJSONFile(const std::string& relative_path); } // namespace test_util -} // namespace gdata +} // namespace google_apis #endif // CHROME_BROWSER_GOOGLE_APIS_GDATA_TEST_UTIL_H_ diff --git a/chrome/browser/google_apis/gdata_util.cc b/chrome/browser/google_apis/gdata_util.cc index 7b437d3..eb05f80 100644 --- a/chrome/browser/google_apis/gdata_util.cc +++ b/chrome/browser/google_apis/gdata_util.cc @@ -26,7 +26,7 @@ using content::BrowserThread; -namespace gdata { +namespace google_apis { namespace util { namespace { @@ -210,4 +210,4 @@ void PostBlockingPoolSequencedTaskAndReply( } } // namespace util -} // namespace gdata +} // namespace google_apis diff --git a/chrome/browser/google_apis/gdata_util.h b/chrome/browser/google_apis/gdata_util.h index 17f5b8f..11334d4 100644 --- a/chrome/browser/google_apis/gdata_util.h +++ b/chrome/browser/google_apis/gdata_util.h @@ -23,7 +23,7 @@ namespace tracked_objects { class Location; } // tracked_objects -namespace gdata { +namespace google_apis { namespace util { // Returns true if Drive v2 API is enabled via commandline switch. @@ -55,6 +55,6 @@ void PostBlockingPoolSequencedTaskAndReply( const base::Closure& reply_task); } // namespace util -} // namespace gdata +} // namespace google_apis #endif // CHROME_BROWSER_GOOGLE_APIS_GDATA_UTIL_H_ diff --git a/chrome/browser/google_apis/gdata_util_unittest.cc b/chrome/browser/google_apis/gdata_util_unittest.cc index 06cf464a..f3caf65 100644 --- a/chrome/browser/google_apis/gdata_util_unittest.cc +++ b/chrome/browser/google_apis/gdata_util_unittest.cc @@ -13,7 +13,7 @@ #include "chrome/browser/chromeos/system/timezone_settings.h" #endif // OS_CHROMEOS -namespace gdata { +namespace google_apis { namespace util { #if defined(OS_CHROMEOS) // TODO(yoshiki): Find platform independent way to get/set local timezone. @@ -100,4 +100,4 @@ TEST(GDataUtilTest, FormatTimeAsString) { } } // namespace util -} // namespace gdata +} // namespace google_apis diff --git a/chrome/browser/google_apis/gdata_wapi_parser.cc b/chrome/browser/google_apis/gdata_wapi_parser.cc index 6d626a1..11d2155 100644 --- a/chrome/browser/google_apis/gdata_wapi_parser.cc +++ b/chrome/browser/google_apis/gdata_wapi_parser.cc @@ -23,7 +23,7 @@ using base::Value; using base::DictionaryValue; using base::ListValue; -namespace gdata { +namespace google_apis { namespace { @@ -581,7 +581,7 @@ void FeedEntry::RegisterJSONConverter( converter->RegisterCustomField<base::Time>( kUpdatedField, &FeedEntry::updated_time_, - &gdata::util::GetTimeFromString); + &google_apis::util::GetTimeFromString); } //////////////////////////////////////////////////////////////////////////////// @@ -615,10 +615,10 @@ void DocumentEntry::RegisterJSONConverter( converter->RegisterStringField(kTitleTField, &DocumentEntry::title_); converter->RegisterCustomField<base::Time>( kPublishedField, &DocumentEntry::published_time_, - &gdata::util::GetTimeFromString); + &google_apis::util::GetTimeFromString); converter->RegisterCustomField<base::Time>( kLastViewedField, &DocumentEntry::last_viewed_time_, - &gdata::util::GetTimeFromString); + &google_apis::util::GetTimeFromString); converter->RegisterRepeatedMessage( kFeedLinkField, &DocumentEntry::feed_links_); converter->RegisterNestedField(kContentField, &DocumentEntry::content_); @@ -809,12 +809,12 @@ DocumentEntry* DocumentEntry::CreateFromXml(XmlReader* xml_reader) { } else if (xml_reader->NodeName() == kUpdatedNode) { std::string time; if (xml_reader->ReadElementContent(&time)) - gdata::util::GetTimeFromString(time, &entry->updated_time_); + google_apis::util::GetTimeFromString(time, &entry->updated_time_); skip_read = true; } else if (xml_reader->NodeName() == kPublishedNode) { std::string time; if (xml_reader->ReadElementContent(&time)) - gdata::util::GetTimeFromString(time, &entry->published_time_); + google_apis::util::GetTimeFromString(time, &entry->published_time_); skip_read = true; } else if (xml_reader->NodeName() == kIDNode) { xml_reader->ReadElementContent(&entry->id_); @@ -848,7 +848,7 @@ DocumentEntry* DocumentEntry::CreateFromXml(XmlReader* xml_reader) { } else if (xml_reader->NodeName() == kLastViewedNode) { std::string time; if (xml_reader->ReadElementContent(&time)) - gdata::util::GetTimeFromString(time, &entry->last_viewed_time_); + google_apis::util::GetTimeFromString(time, &entry->last_viewed_time_); skip_read = true; } else { DVLOG(1) << "Unknown node " << xml_reader->NodeName(); @@ -1184,4 +1184,4 @@ bool AccountMetadataFeed::Parse(const base::Value& value) { return true; } -} // namespace gdata +} // namespace google_apis diff --git a/chrome/browser/google_apis/gdata_wapi_parser.h b/chrome/browser/google_apis/gdata_wapi_parser.h index 05dc656..3e338e1 100644 --- a/chrome/browser/google_apis/gdata_wapi_parser.h +++ b/chrome/browser/google_apis/gdata_wapi_parser.h @@ -36,7 +36,7 @@ class RepeatedMessageConverter; // Defines data elements of Google Documents API as described in // http://code.google.com/apis/documents/. -namespace gdata { +namespace google_apis { // TODO(kochi): These forward declarations will be unnecessary once // http://crbug.com/142293 is resolved. @@ -728,6 +728,6 @@ class AccountMetadataFeed { }; -} // namespace gdata +} // namespace google_apis #endif // CHROME_BROWSER_GOOGLE_APIS_GDATA_WAPI_PARSER_H_ diff --git a/chrome/browser/google_apis/gdata_wapi_parser_unittest.cc b/chrome/browser/google_apis/gdata_wapi_parser_unittest.cc index cf65254..c428eb1 100644 --- a/chrome/browser/google_apis/gdata_wapi_parser_unittest.cc +++ b/chrome/browser/google_apis/gdata_wapi_parser_unittest.cc @@ -23,7 +23,7 @@ using base::Value; using base::DictionaryValue; using base::ListValue; -namespace gdata { +namespace google_apis { class GDataWAPIParserTest : public testing::Test { protected: @@ -68,8 +68,8 @@ TEST_F(GDataWAPIParserTest, DocumentFeedJsonParser) { ASSERT_TRUE(feed.get()); base::Time update_time; - ASSERT_TRUE(gdata::util::GetTimeFromString("2011-12-14T01:03:21.151Z", - &update_time)); + ASSERT_TRUE(google_apis::util::GetTimeFromString("2011-12-14T01:03:21.151Z", + &update_time)); EXPECT_EQ(1, feed->start_index()); EXPECT_EQ(1000, feed->items_per_page()); @@ -108,10 +108,10 @@ TEST_F(GDataWAPIParserTest, DocumentFeedJsonParser) { EXPECT_EQ(ASCIIToUTF16("Entry 1 Title"), folder_entry->title()); base::Time entry1_update_time; base::Time entry1_publish_time; - ASSERT_TRUE(gdata::util::GetTimeFromString("2011-04-01T18:34:08.234Z", - &entry1_update_time)); - ASSERT_TRUE(gdata::util::GetTimeFromString("2010-11-07T05:03:54.719Z", - &entry1_publish_time)); + ASSERT_TRUE(google_apis::util::GetTimeFromString("2011-04-01T18:34:08.234Z", + &entry1_update_time)); + ASSERT_TRUE(google_apis::util::GetTimeFromString("2010-11-07T05:03:54.719Z", + &entry1_publish_time)); EXPECT_EQ(entry1_update_time, folder_entry->updated_time()); EXPECT_EQ(entry1_publish_time, folder_entry->published_time()); @@ -199,10 +199,10 @@ TEST_F(GDataWAPIParserTest, DocumentEntryXmlParser) { EXPECT_EQ(ASCIIToUTF16("Xml Entry File Title.tar"), entry->title()); base::Time entry1_update_time; base::Time entry1_publish_time; - ASSERT_TRUE(gdata::util::GetTimeFromString("2011-04-01T18:34:08.234Z", - &entry1_update_time)); - ASSERT_TRUE(gdata::util::GetTimeFromString("2010-11-07T05:03:54.719Z", - &entry1_publish_time)); + ASSERT_TRUE(google_apis::util::GetTimeFromString("2011-04-01T18:34:08.234Z", + &entry1_update_time)); + ASSERT_TRUE(google_apis::util::GetTimeFromString("2010-11-07T05:03:54.719Z", + &entry1_publish_time)); EXPECT_EQ(entry1_update_time, entry->updated_time()); EXPECT_EQ(entry1_publish_time, entry->published_time()); @@ -393,4 +393,4 @@ TEST_F(GDataWAPIParserTest, DocumentEntryClassifyEntryKind) { DocumentEntry::ClassifyEntryKind(ENTRY_KIND_PDF)); } -} // namespace gdata +} // namespace google_apis diff --git a/chrome/browser/google_apis/gdata_wapi_service.cc b/chrome/browser/google_apis/gdata_wapi_service.cc index 02ee8be..75d5cc2 100644 --- a/chrome/browser/google_apis/gdata_wapi_service.cc +++ b/chrome/browser/google_apis/gdata_wapi_service.cc @@ -79,7 +79,7 @@ GDataWapiService::~GDataWapiService() { } } -gdata::AuthService* GDataWapiService::auth_service_for_testing() { +google_apis::AuthService* GDataWapiService::auth_service_for_testing() { return runner_->auth_service(); } @@ -92,7 +92,7 @@ void GDataWapiService::Initialize(Profile* profile) { scopes.push_back(kUserContentScope); // Drive App scope is required for even WAPI v3 apps access. scopes.push_back(kDriveAppsScope); - runner_.reset(new gdata::OperationRunner(profile, scopes)); + runner_.reset(new google_apis::OperationRunner(profile, scopes)); runner_->Initialize(); runner_->auth_service()->AddObserver(this); @@ -123,59 +123,63 @@ bool GDataWapiService::CancelForFilePath(const FilePath& file_path) { return operation_registry()->CancelForFilePath(file_path); } -gdata::OperationProgressStatusList GDataWapiService::GetProgressStatusList() - const { +google_apis::OperationProgressStatusList +GDataWapiService::GetProgressStatusList() const { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); return operation_registry()->GetProgressStatusList(); } -void GDataWapiService::Authenticate(const gdata::AuthStatusCallback& callback) { +void GDataWapiService::Authenticate( + const google_apis::AuthStatusCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); runner_->Authenticate(callback); } -void GDataWapiService::GetDocuments(const GURL& url, - int64 start_changestamp, - const std::string& search_query, - const std::string& directory_resource_id, - const gdata::GetDataCallback& callback) { +void GDataWapiService::GetDocuments( + const GURL& url, + int64 start_changestamp, + const std::string& search_query, + const std::string& directory_resource_id, + const google_apis::GetDataCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // Drive V2 API defines changestamp in int64, while DocumentsList API uses // int32. This narrowing should not cause any trouble. - gdata::GetDocumentsOperation* operation = - new gdata::GetDocumentsOperation(operation_registry(), - url, - static_cast<int>(start_changestamp), - search_query, - directory_resource_id, - callback); + google_apis::GetDocumentsOperation* operation = + new google_apis::GetDocumentsOperation( + operation_registry(), + url, + static_cast<int>(start_changestamp), + search_query, + directory_resource_id, + callback); runner_->StartOperationWithRetry(operation); } void GDataWapiService::GetDocumentEntry( const std::string& resource_id, - const gdata::GetDataCallback& callback) { + const google_apis::GetDataCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - gdata::GetDocumentEntryOperation* operation = - new gdata::GetDocumentEntryOperation(operation_registry(), - resource_id, - callback); + google_apis::GetDocumentEntryOperation* operation = + new google_apis::GetDocumentEntryOperation(operation_registry(), + resource_id, + callback); runner_->StartOperationWithRetry(operation); } void GDataWapiService::GetAccountMetadata( - const gdata::GetDataCallback& callback) { + const google_apis::GetDataCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - gdata::GetAccountMetadataOperation* operation = - new gdata::GetAccountMetadataOperation(operation_registry(), callback); + google_apis::GetAccountMetadataOperation* operation = + new google_apis::GetAccountMetadataOperation( + operation_registry(), callback); runner_->StartOperationWithRetry(operation); } void GDataWapiService::GetApplicationInfo( - const gdata::GetDataCallback& callback) { + const google_apis::GetDataCallback& callback) { // For WAPI, AccountMetadata includes Drive application information. GetAccountMetadata(callback); } @@ -185,7 +189,7 @@ void GDataWapiService::DownloadDocument( const FilePath& local_cache_path, const GURL& document_url, DocumentExportFormat format, - const gdata::DownloadActionCallback& callback) { + const google_apis::DownloadActionCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DownloadFile( @@ -195,128 +199,131 @@ void GDataWapiService::DownloadDocument( "exportFormat", GetExportFormatParam(format)), callback, - gdata::GetContentCallback()); + google_apis::GetContentCallback()); } void GDataWapiService::DownloadFile( const FilePath& virtual_path, const FilePath& local_cache_path, const GURL& document_url, - const gdata::DownloadActionCallback& download_action_callback, - const gdata::GetContentCallback& get_content_callback) { + const google_apis::DownloadActionCallback& download_action_callback, + const google_apis::GetContentCallback& get_content_callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); runner_->StartOperationWithRetry( - new gdata::DownloadFileOperation(operation_registry(), - download_action_callback, - get_content_callback, document_url, - virtual_path, local_cache_path)); + new google_apis::DownloadFileOperation(operation_registry(), + download_action_callback, + get_content_callback, document_url, + virtual_path, local_cache_path)); } void GDataWapiService::DeleteDocument( const GURL& document_url, - const gdata::EntryActionCallback& callback) { + const google_apis::EntryActionCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); runner_->StartOperationWithRetry( - new gdata::DeleteDocumentOperation(operation_registry(), callback, - document_url)); + new google_apis::DeleteDocumentOperation(operation_registry(), callback, + document_url)); } void GDataWapiService::CreateDirectory( const GURL& parent_content_url, const FilePath::StringType& directory_name, - const gdata::GetDataCallback& callback) { + const google_apis::GetDataCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); runner_->StartOperationWithRetry( - new gdata::CreateDirectoryOperation(operation_registry(), callback, - parent_content_url, directory_name)); + new google_apis::CreateDirectoryOperation( + operation_registry(), callback, parent_content_url, directory_name)); } -void GDataWapiService::CopyDocument(const std::string& resource_id, - const FilePath::StringType& new_name, - const gdata::GetDataCallback& callback) { +void GDataWapiService::CopyDocument( + const std::string& resource_id, + const FilePath::StringType& new_name, + const google_apis::GetDataCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); runner_->StartOperationWithRetry( - new gdata::CopyDocumentOperation(operation_registry(), callback, - resource_id, new_name)); + new google_apis::CopyDocumentOperation(operation_registry(), callback, + resource_id, new_name)); } void GDataWapiService::RenameResource( const GURL& resource_url, const FilePath::StringType& new_name, - const gdata::EntryActionCallback& callback) { + const google_apis::EntryActionCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); runner_->StartOperationWithRetry( - new gdata::RenameResourceOperation(operation_registry(), callback, - resource_url, new_name)); + new google_apis::RenameResourceOperation(operation_registry(), callback, + resource_url, new_name)); } void GDataWapiService::AddResourceToDirectory( const GURL& parent_content_url, const GURL& resource_url, - const gdata::EntryActionCallback& callback) { + const google_apis::EntryActionCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); runner_->StartOperationWithRetry( - new gdata::AddResourceToDirectoryOperation(operation_registry(), - callback, - parent_content_url, - resource_url)); + new google_apis::AddResourceToDirectoryOperation(operation_registry(), + callback, + parent_content_url, + resource_url)); } void GDataWapiService::RemoveResourceFromDirectory( const GURL& parent_content_url, const GURL& resource_url, const std::string& resource_id, - const gdata::EntryActionCallback& callback) { + const google_apis::EntryActionCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); runner_->StartOperationWithRetry( - new gdata::RemoveResourceFromDirectoryOperation(operation_registry(), - callback, - parent_content_url, - resource_url, - resource_id)); + new google_apis::RemoveResourceFromDirectoryOperation( + operation_registry(), + callback, + parent_content_url, + resource_url, + resource_id)); } void GDataWapiService::InitiateUpload( - const gdata::InitiateUploadParams& params, - const gdata::InitiateUploadCallback& callback) { + const google_apis::InitiateUploadParams& params, + const google_apis::InitiateUploadCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (params.upload_location.is_empty()) { if (!callback.is_null()) - callback.Run(gdata::HTTP_BAD_REQUEST, GURL()); + callback.Run(google_apis::HTTP_BAD_REQUEST, GURL()); return; } runner_->StartOperationWithRetry( - new gdata::InitiateUploadOperation( + new google_apis::InitiateUploadOperation( operation_registry(), callback, params)); } void GDataWapiService::ResumeUpload( - const gdata::ResumeUploadParams& params, - const gdata::ResumeUploadCallback& callback) { + const google_apis::ResumeUploadParams& params, + const google_apis::ResumeUploadCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); runner_->StartOperationWithRetry( - new gdata::ResumeUploadOperation( + new google_apis::ResumeUploadOperation( operation_registry(), callback, params)); } -void GDataWapiService::AuthorizeApp(const GURL& resource_url, - const std::string& app_ids, - const gdata::GetDataCallback& callback) { +void GDataWapiService::AuthorizeApp( + const GURL& resource_url, + const std::string& app_ids, + const google_apis::GetDataCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); runner_->StartOperationWithRetry( - new gdata::AuthorizeAppsOperation(operation_registry(), callback, - resource_url, app_ids)); + new google_apis::AuthorizeAppsOperation(operation_registry(), callback, + resource_url, app_ids)); } bool GDataWapiService::HasAccessToken() const { @@ -331,7 +338,7 @@ bool GDataWapiService::HasRefreshToken() const { return runner_->auth_service()->HasRefreshToken(); } -gdata::OperationRegistry* GDataWapiService::operation_registry() const { +google_apis::OperationRegistry* GDataWapiService::operation_registry() const { return runner_->operation_registry(); } @@ -344,13 +351,14 @@ void GDataWapiService::OnOAuth2RefreshTokenChanged() { } void GDataWapiService::OnProgressUpdate( - const gdata::OperationProgressStatusList& list) { + const google_apis::OperationProgressStatusList& list) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); FOR_EACH_OBSERVER( DriveServiceObserver, observers_, OnProgressUpdate(list)); } -void GDataWapiService::OnAuthenticationFailed(gdata::GDataErrorCode error) { +void GDataWapiService::OnAuthenticationFailed( + google_apis::GDataErrorCode error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); FOR_EACH_OBSERVER( DriveServiceObserver, observers_, OnAuthenticationFailed(error)); diff --git a/chrome/browser/google_apis/gdata_wapi_service.h b/chrome/browser/google_apis/gdata_wapi_service.h index d6822a1..c0ca0c4 100644 --- a/chrome/browser/google_apis/gdata_wapi_service.h +++ b/chrome/browser/google_apis/gdata_wapi_service.h @@ -18,7 +18,7 @@ class FilePath; class GURL; class Profile; -namespace gdata { +namespace google_apis { class AuthService; class OperationRunner; } @@ -30,15 +30,15 @@ namespace drive { // Details of API call are abstracted in each operation class and this class // works as a thin wrapper for the API. class GDataWapiService : public DriveServiceInterface, - public gdata::AuthServiceObserver, - public gdata::OperationRegistryObserver { + public google_apis::AuthServiceObserver, + public google_apis::OperationRegistryObserver { public: // Instance is usually created by DriveSystemServiceFactory and owned by // DriveFileSystem. GDataWapiService(); virtual ~GDataWapiService(); - gdata::AuthService* auth_service_for_testing(); + google_apis::AuthService* auth_service_for_testing(); // DriveServiceInterface Overrides virtual void Initialize(Profile* profile) OVERRIDE; @@ -47,82 +47,86 @@ class GDataWapiService : public DriveServiceInterface, virtual bool CanStartOperation() const OVERRIDE; virtual void CancelAll() OVERRIDE; virtual bool CancelForFilePath(const FilePath& file_path) OVERRIDE; - virtual gdata::OperationProgressStatusList GetProgressStatusList() + virtual google_apis::OperationProgressStatusList GetProgressStatusList() const OVERRIDE; virtual void Authenticate( - const gdata::AuthStatusCallback& callback) OVERRIDE; + const google_apis::AuthStatusCallback& callback) OVERRIDE; virtual bool HasAccessToken() const OVERRIDE; virtual bool HasRefreshToken() const OVERRIDE; - virtual void GetDocuments(const GURL& feed_url, - int64 start_changestamp, - const std::string& search_query, - const std::string& directory_resource_id, - const gdata::GetDataCallback& callback) OVERRIDE; + virtual void GetDocuments( + const GURL& feed_url, + int64 start_changestamp, + const std::string& search_query, + const std::string& directory_resource_id, + const google_apis::GetDataCallback& callback) OVERRIDE; virtual void GetDocumentEntry (const std::string& resource_id, - const gdata::GetDataCallback& callback) OVERRIDE; + const google_apis::GetDataCallback& callback) OVERRIDE; virtual void GetAccountMetadata( - const gdata::GetDataCallback& callback) OVERRIDE; + const google_apis::GetDataCallback& callback) OVERRIDE; virtual void GetApplicationInfo( - const gdata::GetDataCallback& callback) OVERRIDE; + const google_apis::GetDataCallback& callback) OVERRIDE; virtual void DeleteDocument( const GURL& document_url, - const gdata::EntryActionCallback& callback) OVERRIDE; + const google_apis::EntryActionCallback& callback) OVERRIDE; virtual void DownloadDocument( const FilePath& virtual_path, const FilePath& local_cache_path, const GURL& content_url, DocumentExportFormat format, - const gdata::DownloadActionCallback& callback) OVERRIDE; + const google_apis::DownloadActionCallback& callback) OVERRIDE; virtual void DownloadFile( const FilePath& virtual_path, const FilePath& local_cache_path, const GURL& content_url, - const gdata::DownloadActionCallback& download_action_callback, - const gdata::GetContentCallback& get_content_callback) OVERRIDE; - virtual void CopyDocument(const std::string& resource_id, - const FilePath::StringType& new_name, - const gdata::GetDataCallback& callback) OVERRIDE; + const google_apis::DownloadActionCallback& download_action_callback, + const google_apis::GetContentCallback& get_content_callback) OVERRIDE; + virtual void CopyDocument( + const std::string& resource_id, + const FilePath::StringType& new_name, + const google_apis::GetDataCallback& callback) OVERRIDE; virtual void RenameResource( const GURL& document_url, const FilePath::StringType& new_name, - const gdata::EntryActionCallback& callback) OVERRIDE; + const google_apis::EntryActionCallback& callback) OVERRIDE; virtual void AddResourceToDirectory( const GURL& parent_content_url, const GURL& resource_url, - const gdata::EntryActionCallback& callback) OVERRIDE; + const google_apis::EntryActionCallback& callback) OVERRIDE; virtual void RemoveResourceFromDirectory( const GURL& parent_content_url, const GURL& resource_url, const std::string& resource_id, - const gdata::EntryActionCallback& callback) OVERRIDE; + const google_apis::EntryActionCallback& callback) OVERRIDE; virtual void CreateDirectory( const GURL& parent_content_url, const FilePath::StringType& directory_name, - const gdata::GetDataCallback& callback) OVERRIDE; + const google_apis::GetDataCallback& callback) OVERRIDE; virtual void InitiateUpload( - const gdata::InitiateUploadParams& params, - const gdata::InitiateUploadCallback& callback) OVERRIDE; + const google_apis::InitiateUploadParams& params, + const google_apis::InitiateUploadCallback& callback) OVERRIDE; virtual void ResumeUpload( - const gdata::ResumeUploadParams& params, - const gdata::ResumeUploadCallback& callback) OVERRIDE; - virtual void AuthorizeApp(const GURL& resource_url, - const std::string& app_id, - const gdata::GetDataCallback& callback) OVERRIDE; + const google_apis::ResumeUploadParams& params, + const google_apis::ResumeUploadCallback& callback) OVERRIDE; + virtual void AuthorizeApp( + const GURL& resource_url, + const std::string& app_id, + const google_apis::GetDataCallback& callback) OVERRIDE; private: - gdata::OperationRegistry* operation_registry() const; + google_apis::OperationRegistry* operation_registry() const; // AuthService::Observer override. virtual void OnOAuth2RefreshTokenChanged() OVERRIDE; // DriveServiceObserver Overrides virtual void OnProgressUpdate( - const gdata::OperationProgressStatusList& list) OVERRIDE; - virtual void OnAuthenticationFailed(gdata::GDataErrorCode error) OVERRIDE; + const google_apis::OperationProgressStatusList& list) OVERRIDE; + virtual void OnAuthenticationFailed( + google_apis::GDataErrorCode error) OVERRIDE; - scoped_ptr<gdata::OperationRunner> runner_; + scoped_ptr<google_apis::OperationRunner> runner_; ObserverList<DriveServiceObserver> observers_; DISALLOW_COPY_AND_ASSIGN(GDataWapiService); diff --git a/chrome/browser/google_apis/gdata_wapi_service_browsertest.cc b/chrome/browser/google_apis/gdata_wapi_service_browsertest.cc index decb58e..afd76d1 100644 --- a/chrome/browser/google_apis/gdata_wapi_service_browsertest.cc +++ b/chrome/browser/google_apis/gdata_wapi_service_browsertest.cc @@ -51,9 +51,9 @@ class GDataTest : public InProcessBrowserTest { }; // The test callback for GDataWapiService::DownloadFile(). -void TestDownloadCallback(gdata::GDataErrorCode* result, +void TestDownloadCallback(google_apis::GDataErrorCode* result, std::string* contents, - gdata::GDataErrorCode error, + google_apis::GDataErrorCode error, const GURL& content_url, const FilePath& temp_file) { *result = error; @@ -63,9 +63,9 @@ void TestDownloadCallback(gdata::GDataErrorCode* result, } // The test callback for GDataWapiService::GetDocuments(). -void TestGetDocumentsCallback(gdata::GDataErrorCode* result_code, +void TestGetDocumentsCallback(google_apis::GDataErrorCode* result_code, base::Value** result_data, - gdata::GDataErrorCode error, + google_apis::GDataErrorCode error, scoped_ptr<base::Value> feed_data) { *result_code = error; *result_data = feed_data.release(); @@ -75,7 +75,7 @@ void TestGetDocumentsCallback(gdata::GDataErrorCode* result_code, } // namespace IN_PROC_BROWSER_TEST_F(GDataTest, Download) { - gdata::GDataErrorCode result = gdata::GDATA_OTHER_ERROR; + google_apis::GDataErrorCode result = google_apis::GDATA_OTHER_ERROR; std::string contents; service_->DownloadFile( FilePath(FILE_PATH_LITERAL("/dummy/gdata/testfile.txt")), @@ -83,10 +83,10 @@ IN_PROC_BROWSER_TEST_F(GDataTest, Download) { FILE_PATH_LITERAL("cached_testfile.txt"))), gdata_test_server_.GetURL("files/chromeos/gdata/testfile.txt"), base::Bind(&TestDownloadCallback, &result, &contents), - gdata::GetContentCallback()); + google_apis::GetContentCallback()); content::RunMessageLoop(); - EXPECT_EQ(gdata::HTTP_SUCCESS, result); + EXPECT_EQ(google_apis::HTTP_SUCCESS, result); FilePath expected_filepath = gdata_test_server_.document_root().Append( FilePath(FILE_PATH_LITERAL("chromeos/gdata/testfile.txt"))); std::string expected_contents; @@ -95,7 +95,7 @@ IN_PROC_BROWSER_TEST_F(GDataTest, Download) { } IN_PROC_BROWSER_TEST_F(GDataTest, NonExistingDownload) { - gdata::GDataErrorCode result = gdata::GDATA_OTHER_ERROR; + google_apis::GDataErrorCode result = google_apis::GDATA_OTHER_ERROR; std::string dummy_contents; service_->DownloadFile( FilePath(FILE_PATH_LITERAL("/dummy/gdata/no-such-file.txt")), @@ -103,15 +103,15 @@ IN_PROC_BROWSER_TEST_F(GDataTest, NonExistingDownload) { FILE_PATH_LITERAL("cache_no-such-file.txt"))), gdata_test_server_.GetURL("files/chromeos/gdata/no-such-file.txt"), base::Bind(&TestDownloadCallback, &result, &dummy_contents), - gdata::GetContentCallback()); + google_apis::GetContentCallback()); content::RunMessageLoop(); - EXPECT_EQ(gdata::HTTP_NOT_FOUND, result); + EXPECT_EQ(google_apis::HTTP_NOT_FOUND, result); // Do not verify the not found message. } IN_PROC_BROWSER_TEST_F(GDataTest, GetDocuments) { - gdata::GDataErrorCode result = gdata::GDATA_OTHER_ERROR; + google_apis::GDataErrorCode result = google_apis::GDATA_OTHER_ERROR; base::Value* result_data = NULL; service_->GetDocuments( gdata_test_server_.GetURL("files/chromeos/gdata/root_feed.json"), @@ -121,7 +121,7 @@ IN_PROC_BROWSER_TEST_F(GDataTest, GetDocuments) { base::Bind(&TestGetDocumentsCallback, &result, &result_data)); content::RunMessageLoop(); - EXPECT_EQ(gdata::HTTP_SUCCESS, result); + EXPECT_EQ(google_apis::HTTP_SUCCESS, result); ASSERT_TRUE(result_data); FilePath expected_filepath = gdata_test_server_.document_root().Append( FilePath(FILE_PATH_LITERAL("chromeos/gdata/root_feed.json"))); @@ -136,7 +136,7 @@ IN_PROC_BROWSER_TEST_F(GDataTest, GetDocuments) { IN_PROC_BROWSER_TEST_F(GDataTest, GetDocumentsFailure) { // testfile.txt exists but the response is not JSON, so it should // emit a parse error instead. - gdata::GDataErrorCode result = gdata::GDATA_OTHER_ERROR; + google_apis::GDataErrorCode result = google_apis::GDATA_OTHER_ERROR; base::Value* result_data = NULL; service_->GetDocuments( gdata_test_server_.GetURL("files/chromeos/gdata/testfile.txt"), @@ -146,7 +146,7 @@ IN_PROC_BROWSER_TEST_F(GDataTest, GetDocumentsFailure) { base::Bind(&TestGetDocumentsCallback, &result, &result_data)); content::RunMessageLoop(); - EXPECT_EQ(gdata::GDATA_PARSE_ERROR, result); + EXPECT_EQ(google_apis::GDATA_PARSE_ERROR, result); EXPECT_FALSE(result_data); } diff --git a/chrome/browser/google_apis/operation_registry.cc b/chrome/browser/google_apis/operation_registry.cc index 9653346..e0eddb7 100644 --- a/chrome/browser/google_apis/operation_registry.cc +++ b/chrome/browser/google_apis/operation_registry.cc @@ -15,7 +15,7 @@ const int64 kNotificationFrequencyInMilliseconds = 1000; } // namespace -namespace gdata { +namespace google_apis { std::string OperationTypeToString(OperationType type) { switch (type) { @@ -346,4 +346,4 @@ void OperationRegistry::NotifyStatusToObservers() { OnProgressUpdate(list)); } -} // namespace gdata +} // namespace google_apis diff --git a/chrome/browser/google_apis/operation_registry.h b/chrome/browser/google_apis/operation_registry.h index b72b35d..bc87f34 100644 --- a/chrome/browser/google_apis/operation_registry.h +++ b/chrome/browser/google_apis/operation_registry.h @@ -15,7 +15,7 @@ #include "base/time.h" #include "chrome/browser/google_apis/gdata_errorcode.h" -namespace gdata { +namespace google_apis { class OperationRegistryObserver; @@ -184,6 +184,6 @@ class OperationRegistryObserver { virtual ~OperationRegistryObserver() {} }; -} // namespace gdata +} // namespace google_apis #endif // CHROME_BROWSER_GOOGLE_APIS_OPERATION_REGISTRY_H_ diff --git a/chrome/browser/google_apis/operation_registry_unittest.cc b/chrome/browser/google_apis/operation_registry_unittest.cc index 3bb4c6b..6d80a68 100644 --- a/chrome/browser/google_apis/operation_registry_unittest.cc +++ b/chrome/browser/google_apis/operation_registry_unittest.cc @@ -14,7 +14,7 @@ using testing::ElementsAre; -namespace gdata { +namespace google_apis { namespace { @@ -254,4 +254,4 @@ TEST_F(OperationRegistryTest, RestartOperation) { EXPECT_EQ(NULL, op1.get()); // deleted } -} // namespace gdata +} // namespace google_apis diff --git a/chrome/browser/google_apis/operation_runner.cc b/chrome/browser/google_apis/operation_runner.cc index f8e1e10..0a9a12b 100644 --- a/chrome/browser/google_apis/operation_runner.cc +++ b/chrome/browser/google_apis/operation_runner.cc @@ -12,7 +12,7 @@ using content::BrowserThread; -namespace gdata { +namespace google_apis { OperationRunner::OperationRunner(Profile* profile, const std::vector<std::string>& scopes) @@ -98,4 +98,4 @@ void OperationRunner::RetryOperation( StartOperation(operation); } -} // namespace gdata +} // namespace google_apis diff --git a/chrome/browser/google_apis/operation_runner.h b/chrome/browser/google_apis/operation_runner.h index 92193ec..598124b 100644 --- a/chrome/browser/google_apis/operation_runner.h +++ b/chrome/browser/google_apis/operation_runner.h @@ -16,7 +16,7 @@ class Profile; -namespace gdata { +namespace google_apis { class AuthenticatedOperationInterface; class AuthService; @@ -77,6 +77,6 @@ class OperationRunner { DISALLOW_COPY_AND_ASSIGN(OperationRunner); }; -} // namespace gdata +} // namespace google_apis #endif // CHROME_BROWSER_GOOGLE_APIS_OPERATION_RUNNER_H_ diff --git a/chrome/browser/google_apis/operations_base.cc b/chrome/browser/google_apis/operations_base.cc index 941585e..e222dca 100644 --- a/chrome/browser/google_apis/operations_base.cc +++ b/chrome/browser/google_apis/operations_base.cc @@ -93,7 +93,7 @@ std::string GetDriveUserAgent() { } // namespace -namespace gdata { +namespace google_apis { //================================ AuthOperation =============================== @@ -439,13 +439,13 @@ void GetDataOperation::ParseResponse(GDataErrorCode fetch_error_code, } void GetDataOperation::OnDataParsed( - gdata::GDataErrorCode fetch_error_code, + google_apis::GDataErrorCode fetch_error_code, scoped_ptr<base::Value>* value) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); bool success = true; if (!value->get()) { - fetch_error_code = gdata::GDATA_PARSE_ERROR; + fetch_error_code = google_apis::GDATA_PARSE_ERROR; success = false; } @@ -466,4 +466,4 @@ void GetDataOperation::RunCallback(GDataErrorCode fetch_error_code, callback_.Run(fetch_error_code, value.Pass()); } -} // namespace gdata +} // namespace google_apis diff --git a/chrome/browser/google_apis/operations_base.h b/chrome/browser/google_apis/operations_base.h index a880880..4d948df 100644 --- a/chrome/browser/google_apis/operations_base.h +++ b/chrome/browser/google_apis/operations_base.h @@ -20,7 +20,7 @@ class OAuth2AccessTokenFetcher; -namespace gdata { +namespace google_apis { //================================ AuthOperation =============================== @@ -234,7 +234,7 @@ class GetDataOperation : public UrlFetchOperationBase { private: // Called when ParseJsonOnBlockingPool() is completed. - void OnDataParsed(gdata::GDataErrorCode fetch_error_code, + void OnDataParsed(google_apis::GDataErrorCode fetch_error_code, scoped_ptr<base::Value>* value); GetDataCallback callback_; @@ -245,6 +245,6 @@ class GetDataOperation : public UrlFetchOperationBase { DISALLOW_COPY_AND_ASSIGN(GetDataOperation); }; -} // namespace gdata +} // namespace google_apis #endif // CHROME_BROWSER_GOOGLE_APIS_OPERATIONS_BASE_H_ diff --git a/chrome/browser/google_apis/task_util.cc b/chrome/browser/google_apis/task_util.cc index 34e7df2..7d048ee 100644 --- a/chrome/browser/google_apis/task_util.cc +++ b/chrome/browser/google_apis/task_util.cc @@ -9,7 +9,7 @@ using content::BrowserThread; -namespace gdata { +namespace google_apis { void RunTaskOnThread(scoped_refptr<base::MessageLoopProxy> relay_proxy, const base::Closure& task) { @@ -26,4 +26,4 @@ void RunTaskOnUIThread(const base::Closure& task) { BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), task); } -} // namespace gdata +} // namespace google_apis diff --git a/chrome/browser/google_apis/task_util.h b/chrome/browser/google_apis/task_util.h index 7c9492d..01134f6 100644 --- a/chrome/browser/google_apis/task_util.h +++ b/chrome/browser/google_apis/task_util.h @@ -8,7 +8,7 @@ #include "base/bind.h" #include "base/message_loop_proxy.h" -namespace gdata { +namespace google_apis { // Runs task on the thread to which |relay_proxy| belongs. void RunTaskOnThread(scoped_refptr<base::MessageLoopProxy> relay_proxy, @@ -116,6 +116,6 @@ CallbackType CreateRelayCallback(const CallbackType& callback) { callback); } -} // namespace gdata +} // namespace google_apis #endif // CHROME_BROWSER_GOOGLE_APIS_TASK_UTIL_H_ diff --git a/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc b/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc index a0c6b15..91dba40 100644 --- a/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc +++ b/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc @@ -77,8 +77,9 @@ void GetGCacheContents(const FilePath& root_path, entry->SetDouble("size", size); entry->SetBoolean("is_directory", is_directory); entry->SetBoolean("is_symbolic_link", is_symbolic_link); - entry->SetString("last_modified", - gdata::util::FormatTimeAsStringLocaltime(last_modified)); + entry->SetString( + "last_modified", + google_apis::util::FormatTimeAsStringLocaltime(last_modified)); files[current] = entry; total_size += size; @@ -107,7 +108,7 @@ void GetFreeDiskSpace(const FilePath& home_path, std::string FormatEntry(const FilePath& path, const drive::DriveEntryProto& entry) { using base::StringAppendF; - using gdata::util::FormatTimeAsString; + using google_apis::util::FormatTimeAsString; std::string out; StringAppendF(&out, "%s\n", path.AsUTF8Unsafe().c_str()); @@ -203,7 +204,7 @@ class DriveInternalsWebUIHandler : public content::WebUIMessageHandler { void OnGetFreeDiskSpace(base::DictionaryValue* local_storage_summary); // Called when GetAccountMetadata() call to DriveService is complete. - void OnGetAccountMetadata(gdata::GDataErrorCode status, + void OnGetAccountMetadata(google_apis::GDataErrorCode status, scoped_ptr<base::Value> data); // Called when the page requests periodic update. @@ -220,8 +221,8 @@ class DriveInternalsWebUIHandler : public content::WebUIMessageHandler { }; void DriveInternalsWebUIHandler::OnGetAccountMetadata( - gdata::GDataErrorCode status, scoped_ptr<base::Value> data) { - if (status != gdata::HTTP_SUCCESS) { + google_apis::GDataErrorCode status, scoped_ptr<base::Value> data) { + if (status != google_apis::HTTP_SUCCESS) { LOG(ERROR) << "Failed to get account metadata"; return; } @@ -229,9 +230,9 @@ void DriveInternalsWebUIHandler::OnGetAccountMetadata( base::DictionaryValue account_metadata; - if (gdata::util::IsDriveV2ApiEnabled()) { - scoped_ptr<gdata::AboutResource> about_resource; - about_resource = gdata::AboutResource::CreateFrom(*data); + if (google_apis::util::IsDriveV2ApiEnabled()) { + scoped_ptr<google_apis::AboutResource> about_resource; + about_resource = google_apis::AboutResource::CreateFrom(*data); account_metadata.SetDouble("account-quota-total", about_resource->quota_bytes_total()); @@ -244,8 +245,8 @@ void DriveInternalsWebUIHandler::OnGetAccountMetadata( // http://crbug.com/154241 return; } else { - scoped_ptr<gdata::AccountMetadataFeed> feed; - feed = gdata::AccountMetadataFeed::CreateFrom(*data); + scoped_ptr<google_apis::AccountMetadataFeed> feed; + feed = google_apis::AccountMetadataFeed::CreateFrom(*data); account_metadata.SetDouble("account-quota-total", feed->quota_bytes_total()); @@ -255,7 +256,7 @@ void DriveInternalsWebUIHandler::OnGetAccountMetadata( base::ListValue* installed_apps = new base::ListValue(); for (size_t i = 0; i < feed->installed_apps().size(); ++i) { - const gdata::InstalledApp* app = feed->installed_apps()[i]; + const google_apis::InstalledApp* app = feed->installed_apps()[i]; base::DictionaryValue* app_data = new base::DictionaryValue(); app_data->SetString("app_name", app->app_name()); app_data->SetString("app_id", app->app_id()); @@ -475,25 +476,26 @@ void DriveInternalsWebUIHandler::OnPeriodicUpdate(const base::ListValue* args) { void DriveInternalsWebUIHandler::UpdateInFlightOperations( const drive::DriveServiceInterface* drive_service) { - gdata::OperationProgressStatusList + google_apis::OperationProgressStatusList progress_status_list = drive_service->GetProgressStatusList(); base::ListValue in_flight_operations; for (size_t i = 0; i < progress_status_list.size(); ++i) { - const gdata::OperationProgressStatus& status = progress_status_list[i]; + const google_apis::OperationProgressStatus& status = + progress_status_list[i]; base::DictionaryValue* dict = new DictionaryValue; dict->SetInteger("operation_id", status.operation_id); dict->SetString( "operation_type", - gdata::OperationTypeToString(status.operation_type)); + google_apis::OperationTypeToString(status.operation_type)); dict->SetString("file_path", status.file_path.AsUTF8Unsafe()); dict->SetString( "transfer_state", - gdata::OperationTransferStateToString(status.transfer_state)); + google_apis::OperationTransferStateToString(status.transfer_state)); dict->SetString( "start_time", - gdata::util::FormatTimeAsStringLocaltime(status.start_time)); + google_apis::util::FormatTimeAsStringLocaltime(status.start_time)); dict->SetDouble("progress_current", status.progress_current); dict->SetDouble("progress_total", status.progress_total); in_flight_operations.Append(dict); diff --git a/chrome/browser/ui/webui/screenshot_source.cc b/chrome/browser/ui/webui/screenshot_source.cc index 91541e9..357d7b3 100644 --- a/chrome/browser/ui/webui/screenshot_source.cc +++ b/chrome/browser/ui/webui/screenshot_source.cc @@ -196,7 +196,7 @@ void ScreenshotSource::SendScreenshot(const std::string& screenshot_path, decoded_filename, base::Bind(&ScreenshotSource::GetSavedScreenshotCallback, base::Unretained(this), screenshot_path, request_id), - gdata::GetContentCallback()); + google_apis::GetContentCallback()); } else { BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, |