diff options
author | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-12 07:06:35 +0000 |
---|---|---|
committer | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-12 07:06:35 +0000 |
commit | d9d04df4dd96e5db9934ed83265b09e5b2cce59e (patch) | |
tree | 29eba5ca697b986d19c1cb478e250ec34ae46c8f | |
parent | 23de8745d5ed47d7ebcd517ef1df56839df41adf (diff) | |
download | chromium_src-d9d04df4dd96e5db9934ed83265b09e5b2cce59e.zip chromium_src-d9d04df4dd96e5db9934ed83265b09e5b2cce59e.tar.gz chromium_src-d9d04df4dd96e5db9934ed83265b09e5b2cce59e.tar.bz2 |
drive: Rename 'gdata' namespace to 'drive' in chrome/browser/chromeos/drive
'gdata' namespace was a misnomer. 'drive' should be a better name for code
in 'drive' directory, which implements the C++ side of Google Drive on
Chrome OS.
BUG=136371
TEST=compiles
TBR=thestig@chromium.org
# for changes outside of 'chromeos', which is just s/gdata::/drive::/g. i'm glad that strlen("gdata") == strlen("drive")
Review URL: https://codereview.chromium.org/11106007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161523 0039d316-1c4b-4281-b951-d872f2087c98
108 files changed, 1376 insertions, 1266 deletions
diff --git a/chrome/browser/chromeos/drive/document_entry_conversion.cc b/chrome/browser/chromeos/drive/document_entry_conversion.cc index dc8b667..bf6cc9a 100644 --- a/chrome/browser/chromeos/drive/document_entry_conversion.cc +++ b/chrome/browser/chromeos/drive/document_entry_conversion.cc @@ -13,10 +13,10 @@ #include "googleurl/src/gurl.h" #include "net/base/escape.h" -namespace gdata { +namespace drive { DriveEntryProto ConvertDocumentEntryToDriveEntryProto( - const DocumentEntry& doc) { + const gdata::DocumentEntry& doc) { DriveEntryProto entry_proto; // For regular files, the 'filename' and 'title' attribute in the metadata @@ -29,11 +29,11 @@ DriveEntryProto ConvertDocumentEntryToDriveEntryProto( entry_proto.set_resource_id(doc.resource_id()); entry_proto.set_content_url(doc.content_url().spec()); - const Link* edit_link = doc.GetLinkByType(Link::LINK_EDIT); + const gdata::Link* edit_link = doc.GetLinkByType(gdata::Link::LINK_EDIT); if (edit_link) entry_proto.set_edit_url(edit_link->href().spec()); - const Link* parent_link = doc.GetLinkByType(Link::LINK_PARENT); + const gdata::Link* parent_link = doc.GetLinkByType(gdata::Link::LINK_PARENT); if (parent_link) { entry_proto.set_parent_resource_id( util::ExtractResourceIdFromUrl(parent_link->href())); @@ -59,8 +59,8 @@ DriveEntryProto ConvertDocumentEntryToDriveEntryProto( // The resumable-edit-media link should only be present for regular // files as hosted documents are not uploadable. - const Link* upload_link = doc.GetLinkByType( - Link::LINK_RESUMABLE_EDIT_MEDIA); + const gdata::Link* upload_link = doc.GetLinkByType( + gdata::Link::LINK_RESUMABLE_EDIT_MEDIA); if (upload_link) entry_proto.set_upload_url(upload_link->href().spec()); } else if (doc.is_hosted_document()) { @@ -79,23 +79,25 @@ 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 Link* thumbnail_link = doc.GetLinkByType(Link::LINK_THUMBNAIL); + const gdata::Link* thumbnail_link = doc.GetLinkByType( + gdata::Link::LINK_THUMBNAIL); if (thumbnail_link) file_specific_info->set_thumbnail_url(thumbnail_link->href().spec()); - const Link* alternate_link = doc.GetLinkByType(Link::LINK_ALTERNATE); + const gdata::Link* alternate_link = doc.GetLinkByType( + gdata::Link::LINK_ALTERNATE); if (alternate_link) file_specific_info->set_alternate_url(alternate_link->href().spec()); } else if (doc.is_folder()) { - const Link* upload_link = doc.GetLinkByType( - Link::LINK_RESUMABLE_CREATE_MEDIA); + const gdata::Link* upload_link = doc.GetLinkByType( + gdata::Link::LINK_RESUMABLE_CREATE_MEDIA); if (upload_link) entry_proto.set_upload_url(upload_link->href().spec()); } else { - NOTREACHED() << "Unknown DocumentEntry type"; + NOTREACHED() << "Unknown gdata::DocumentEntry type"; } return entry_proto; } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/document_entry_conversion.h b/chrome/browser/chromeos/drive/document_entry_conversion.h index 992764b..e378f2f 100644 --- a/chrome/browser/chromeos/drive/document_entry_conversion.h +++ b/chrome/browser/chromeos/drive/document_entry_conversion.h @@ -12,14 +12,17 @@ class GURL; namespace gdata { - class DocumentEntry; +} + +namespace drive { + class DriveEntryProto; -// Converts a DocumentEntry into a DriveEntryProto. +// Converts a gdata::DocumentEntry into a DriveEntryProto. DriveEntryProto ConvertDocumentEntryToDriveEntryProto( - const DocumentEntry& document_entry); + const gdata::DocumentEntry& document_entry); -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DOCUMENT_ENTRY_CONVERSION_H_ diff --git a/chrome/browser/chromeos/drive/document_entry_conversion_unittest.cc b/chrome/browser/chromeos/drive/document_entry_conversion_unittest.cc index df72660..bcbf25e 100644 --- a/chrome/browser/chromeos/drive/document_entry_conversion_unittest.cc +++ b/chrome/browser/chromeos/drive/document_entry_conversion_unittest.cc @@ -12,15 +12,15 @@ #include "googleurl/src/gurl.h" #include "testing/gtest/include/gtest/gtest.h" -namespace gdata { +namespace drive { TEST(DocumentEntryConversionTest, ConvertDocumentEntryToDriveEntryProto_File) { scoped_ptr<base::Value> value = - test_util::LoadJSONFile("gdata/file_entry.json"); + gdata::test_util::LoadJSONFile("gdata/file_entry.json"); ASSERT_TRUE(value.get()); - scoped_ptr<DocumentEntry> document_entry( - DocumentEntry::ExtractAndParse(*value)); + scoped_ptr<gdata::DocumentEntry> document_entry( + gdata::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(ENTRY_KIND_FILE, entry_proto.kind()); + EXPECT_EQ(gdata::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 = - test_util::LoadJSONFile("gdata/hosted_document_entry.json"); + gdata::test_util::LoadJSONFile("gdata/hosted_document_entry.json"); ASSERT_TRUE(value.get()); - scoped_ptr<DocumentEntry> document_entry( - DocumentEntry::ExtractAndParse(*value)); + scoped_ptr<gdata::DocumentEntry> document_entry( + gdata::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(ENTRY_KIND_DOCUMENT, entry_proto.kind()); + EXPECT_EQ(gdata::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 = - test_util::LoadJSONFile("gdata/directory_entry.json"); + gdata::test_util::LoadJSONFile("gdata/directory_entry.json"); ASSERT_TRUE(value.get()); - scoped_ptr<DocumentEntry> document_entry( - DocumentEntry::ExtractAndParse(*value)); + scoped_ptr<gdata::DocumentEntry> document_entry( + gdata::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(ENTRY_KIND_FOLDER, entry_proto.kind()); + EXPECT_EQ(gdata::ENTRY_KIND_FOLDER, entry_proto.kind()); // 2011-04-01T18:34:08.234Z base::Time::Exploded exploded; @@ -230,11 +230,12 @@ TEST(DocumentEntryConversionTest, TEST(DocumentEntryConversionTest, ConvertDocumentEntryToDriveEntryProto_DeletedHostedDocument) { scoped_ptr<base::Value> value = - test_util::LoadJSONFile("gdata/deleted_hosted_document_entry.json"); + gdata::test_util::LoadJSONFile( + "gdata/deleted_hosted_document_entry.json"); ASSERT_TRUE(value.get()); - scoped_ptr<DocumentEntry> document_entry( - DocumentEntry::ExtractAndParse(*value)); + scoped_ptr<gdata::DocumentEntry> document_entry( + gdata::DocumentEntry::ExtractAndParse(*value)); ASSERT_TRUE(document_entry.get()); DriveEntryProto entry_proto = @@ -249,7 +250,7 @@ TEST(DocumentEntryConversionTest, EXPECT_EQ("", entry_proto.parent_resource_id()); EXPECT_TRUE(entry_proto.deleted()); // The document was deleted. - EXPECT_EQ(ENTRY_KIND_DOCUMENT, entry_proto.kind()); + EXPECT_EQ(gdata::ENTRY_KIND_DOCUMENT, entry_proto.kind()); // 2012-04-10T22:50:55.797Z base::Time::Exploded exploded; @@ -307,4 +308,4 @@ TEST(DocumentEntryConversionTest, EXPECT_EQ(0, entry_proto.file_info().size()); } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/drive.proto b/chrome/browser/chromeos/drive/drive.proto index fa62c2bb..3afb133 100644 --- a/chrome/browser/chromeos/drive/drive.proto +++ b/chrome/browser/chromeos/drive/drive.proto @@ -8,7 +8,7 @@ syntax = "proto2"; option optimize_for = LITE_RUNTIME; -package gdata; +package drive; // Represents base::PlatformFileInfo. message PlatformFileInfoProto { diff --git a/chrome/browser/chromeos/drive/drive_api_service.cc b/chrome/browser/chromeos/drive/drive_api_service.cc index 268b9b7..8bdfbf76 100644 --- a/chrome/browser/chromeos/drive/drive_api_service.cc +++ b/chrome/browser/chromeos/drive/drive_api_service.cc @@ -19,7 +19,7 @@ using content::BrowserThread; -namespace gdata { +namespace drive { namespace { @@ -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 OperationRunner(profile, scopes)); + runner_.reset(new gdata::OperationRunner(profile, scopes)); runner_->Initialize(); runner_->auth_service()->AddObserver(this); @@ -82,12 +82,13 @@ bool DriveAPIService::CancelForFilePath(const FilePath& file_path) { return operation_registry()->CancelForFilePath(file_path); } -OperationProgressStatusList DriveAPIService::GetProgressStatusList() const { +gdata::OperationProgressStatusList +DriveAPIService::GetProgressStatusList() const { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); return operation_registry()->GetProgressStatusList(); } -void DriveAPIService::Authenticate(const AuthStatusCallback& callback) { +void DriveAPIService::Authenticate(const gdata::AuthStatusCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); runner_->Authenticate(callback); } @@ -96,7 +97,7 @@ void DriveAPIService::GetDocuments(const GURL& url, int64 start_changestamp, const std::string& search_query, const std::string& directory_resource_id, - const GetDataCallback& callback) { + const gdata::GetDataCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (search_query.empty()) @@ -111,11 +112,11 @@ void DriveAPIService::GetDocuments(const GURL& url, void DriveAPIService::GetFilelist(const GURL& url, const std::string& search_query, - const GetDataCallback& callback) { + const gdata::GetDataCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); runner_->StartOperationWithRetry( - new GetFilelistOperation(operation_registry(), + new gdata::GetFilelistOperation(operation_registry(), url, search_query, callback)); @@ -123,37 +124,40 @@ void DriveAPIService::GetFilelist(const GURL& url, void DriveAPIService::GetChangelist(const GURL& url, int64 start_changestamp, - const GetDataCallback& callback) { + const gdata::GetDataCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); runner_->StartOperationWithRetry( - new GetChangelistOperation(operation_registry(), + new gdata::GetChangelistOperation(operation_registry(), url, start_changestamp, callback)); } void DriveAPIService::GetDocumentEntry(const std::string& resource_id, - const GetDataCallback& callback) { + const gdata::GetDataCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - runner_->StartOperationWithRetry(new GetFileOperation(operation_registry(), - resource_id, - callback)); + runner_->StartOperationWithRetry(new gdata::GetFileOperation( + operation_registry(), + resource_id, + callback)); } -void DriveAPIService::GetAccountMetadata(const GetDataCallback& callback) { +void DriveAPIService::GetAccountMetadata( + const gdata::GetDataCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); runner_->StartOperationWithRetry( - new GetAboutOperation(operation_registry(), callback)); + new gdata::GetAboutOperation(operation_registry(), callback)); } -void DriveAPIService::GetApplicationInfo(const GetDataCallback& callback) { +void DriveAPIService::GetApplicationInfo( + const gdata::GetDataCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); runner_->StartOperationWithRetry( - new GetApplistOperation(operation_registry(), callback)); + new gdata::GetApplistOperation(operation_registry(), callback)); } void DriveAPIService::DownloadDocument( @@ -161,7 +165,7 @@ void DriveAPIService::DownloadDocument( const FilePath& local_cache_path, const GURL& document_url, DocumentExportFormat format, - const DownloadActionCallback& callback) { + const gdata::DownloadActionCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // TODO(kochi): Implement this. @@ -172,16 +176,17 @@ void DriveAPIService::DownloadFile( const FilePath& virtual_path, const FilePath& local_cache_path, const GURL& document_url, - const DownloadActionCallback& download_action_callback, - const GetContentCallback& get_content_callback) { + const gdata::DownloadActionCallback& download_action_callback, + const gdata::GetContentCallback& get_content_callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // TODO(kochi): Implement this. NOTREACHED(); } -void DriveAPIService::DeleteDocument(const GURL& document_url, - const EntryActionCallback& callback) { +void DriveAPIService::DeleteDocument( + const GURL& document_url, + const gdata::EntryActionCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // TODO(kochi): Implement this. @@ -191,7 +196,7 @@ void DriveAPIService::DeleteDocument(const GURL& document_url, void DriveAPIService::CreateDirectory( const GURL& parent_content_url, const FilePath::StringType& directory_name, - const GetDataCallback& callback) { + const gdata::GetDataCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // TODO(kochi): Implement this. @@ -200,16 +205,17 @@ void DriveAPIService::CreateDirectory( void DriveAPIService::CopyDocument(const std::string& resource_id, const FilePath::StringType& new_name, - const GetDataCallback& callback) { + const gdata::GetDataCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // TODO(kochi): Implement this. NOTREACHED(); } -void DriveAPIService::RenameResource(const GURL& resource_url, - const FilePath::StringType& new_name, - const EntryActionCallback& callback) { +void DriveAPIService::RenameResource( + const GURL& resource_url, + const FilePath::StringType& new_name, + const gdata::EntryActionCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // TODO(kochi): Implement this. @@ -219,7 +225,7 @@ void DriveAPIService::RenameResource(const GURL& resource_url, void DriveAPIService::AddResourceToDirectory( const GURL& parent_content_url, const GURL& resource_url, - const EntryActionCallback& callback) { + const gdata::EntryActionCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // TODO(kochi): Implement this. @@ -230,23 +236,25 @@ void DriveAPIService::RemoveResourceFromDirectory( const GURL& parent_content_url, const GURL& resource_url, const std::string& resource_id, - const EntryActionCallback& callback) { + const gdata::EntryActionCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // TODO(kochi): Implement this. NOTREACHED(); } -void DriveAPIService::InitiateUpload(const InitiateUploadParams& params, - const InitiateUploadCallback& callback) { +void DriveAPIService::InitiateUpload( + const gdata::InitiateUploadParams& params, + const gdata::InitiateUploadCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // TODO(kochi): Implement this. NOTREACHED(); } -void DriveAPIService::ResumeUpload(const ResumeUploadParams& params, - const ResumeUploadCallback& callback) { +void DriveAPIService::ResumeUpload( + const gdata::ResumeUploadParams& params, + const gdata::ResumeUploadCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // TODO(kochi): Implement this. @@ -255,7 +263,7 @@ void DriveAPIService::ResumeUpload(const ResumeUploadParams& params, void DriveAPIService::AuthorizeApp(const GURL& resource_url, const std::string& app_ids, - const GetDataCallback& callback) { + const gdata::GetDataCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // TODO(kochi): Implement this. @@ -274,7 +282,7 @@ bool DriveAPIService::HasRefreshToken() const { return runner_->auth_service()->HasRefreshToken(); } -OperationRegistry* DriveAPIService::operation_registry() const { +gdata::OperationRegistry* DriveAPIService::operation_registry() const { return runner_->operation_registry(); } @@ -287,16 +295,16 @@ void DriveAPIService::OnOAuth2RefreshTokenChanged() { } void DriveAPIService::OnProgressUpdate( - const OperationProgressStatusList& list) { + const gdata::OperationProgressStatusList& list) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); FOR_EACH_OBSERVER( DriveServiceObserver, observers_, OnProgressUpdate(list)); } -void DriveAPIService::OnAuthenticationFailed(GDataErrorCode error) { +void DriveAPIService::OnAuthenticationFailed(gdata::GDataErrorCode error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); FOR_EACH_OBSERVER( DriveServiceObserver, observers_, OnAuthenticationFailed(error)); } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/drive_api_service.h b/chrome/browser/chromeos/drive/drive_api_service.h index f8066b8..a4e3777 100644 --- a/chrome/browser/chromeos/drive/drive_api_service.h +++ b/chrome/browser/chromeos/drive/drive_api_service.h @@ -19,15 +19,17 @@ class GURL; class Profile; namespace gdata { - class OperationRunner; +} + +namespace drive { // This class provides documents feed service calls for Drive V2 API. // 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 AuthServiceObserver, - public OperationRegistryObserver { + public gdata::AuthServiceObserver, + public gdata::OperationRegistryObserver { public: // Instance is usually created by DriveSystemServiceFactory and owned by // DriveFileSystem. @@ -41,62 +43,72 @@ class DriveAPIService : public DriveServiceInterface, virtual bool CanStartOperation() const OVERRIDE; virtual void CancelAll() OVERRIDE; virtual bool CancelForFilePath(const FilePath& file_path) OVERRIDE; - virtual OperationProgressStatusList GetProgressStatusList() const OVERRIDE; - virtual void Authenticate(const AuthStatusCallback& callback) OVERRIDE; + virtual gdata::OperationProgressStatusList GetProgressStatusList() + const OVERRIDE; + virtual void Authenticate( + const gdata::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 GetDataCallback& callback) OVERRIDE; - virtual void GetDocumentEntry(const std::string& resource_id, - const GetDataCallback& callback) OVERRIDE; - - virtual void GetAccountMetadata(const GetDataCallback& callback) OVERRIDE; - virtual void GetApplicationInfo(const GetDataCallback& callback) OVERRIDE; - virtual void DeleteDocument(const GURL& document_url, - const EntryActionCallback& callback) OVERRIDE; + const gdata::GetDataCallback& callback) OVERRIDE; + virtual void GetDocumentEntry( + const std::string& resource_id, + const gdata::GetDataCallback& callback) OVERRIDE; + + virtual void GetAccountMetadata( + const gdata::GetDataCallback& callback) OVERRIDE; + virtual void GetApplicationInfo( + const gdata::GetDataCallback& callback) OVERRIDE; + virtual void DeleteDocument( + const GURL& document_url, + const gdata::EntryActionCallback& callback) OVERRIDE; virtual void DownloadDocument( const FilePath& virtual_path, const FilePath& local_cache_path, const GURL& content_url, DocumentExportFormat format, - const DownloadActionCallback& callback) OVERRIDE; + const gdata::DownloadActionCallback& callback) OVERRIDE; virtual void DownloadFile( const FilePath& virtual_path, const FilePath& local_cache_path, const GURL& content_url, - const DownloadActionCallback& download_action_callback, - const GetContentCallback& get_content_callback) OVERRIDE; + 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 GetDataCallback& callback) OVERRIDE; - virtual void RenameResource(const GURL& document_url, - const FilePath::StringType& new_name, - const EntryActionCallback& callback) OVERRIDE; + const gdata::GetDataCallback& callback) OVERRIDE; + virtual void RenameResource( + const GURL& document_url, + const FilePath::StringType& new_name, + const gdata::EntryActionCallback& callback) OVERRIDE; virtual void AddResourceToDirectory( const GURL& parent_content_url, const GURL& resource_url, - const EntryActionCallback& callback) OVERRIDE; + const gdata::EntryActionCallback& callback) OVERRIDE; virtual void RemoveResourceFromDirectory( const GURL& parent_content_url, const GURL& resource_url, const std::string& resource_id, - const EntryActionCallback& callback) OVERRIDE; - virtual void CreateDirectory(const GURL& parent_content_url, - const FilePath::StringType& directory_name, - const GetDataCallback& callback) OVERRIDE; - virtual void InitiateUpload(const InitiateUploadParams& params, - const InitiateUploadCallback& callback) OVERRIDE; - virtual void ResumeUpload(const ResumeUploadParams& params, - const ResumeUploadCallback& callback) OVERRIDE; + const gdata::EntryActionCallback& callback) OVERRIDE; + virtual void CreateDirectory( + const GURL& parent_content_url, + const FilePath::StringType& directory_name, + const gdata::GetDataCallback& callback) OVERRIDE; + virtual void InitiateUpload( + const gdata::InitiateUploadParams& params, + const gdata::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 GetDataCallback& callback) OVERRIDE; + const gdata::GetDataCallback& callback) OVERRIDE; private: - OperationRegistry* operation_registry() const; + gdata::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| @@ -106,7 +118,7 @@ class DriveAPIService : public DriveServiceInterface, // Upon completion, invokes |callback| with results on calling thread. void GetChangelist(const GURL& url, int64 start_changestamp, - const GetDataCallback& callback); + const gdata::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 @@ -115,23 +127,23 @@ class DriveAPIService : public DriveServiceInterface, // https://developers.google.com/drive/search-parameters void GetFilelist(const GURL& url, const std::string& search_query, - const GetDataCallback& callback); + const gdata::GetDataCallback& callback); // AuthService::Observer override. virtual void OnOAuth2RefreshTokenChanged() OVERRIDE; // DriveServiceObserver Overrides virtual void OnProgressUpdate( - const OperationProgressStatusList& list) OVERRIDE; - virtual void OnAuthenticationFailed(GDataErrorCode error) OVERRIDE; + const gdata::OperationProgressStatusList& list) OVERRIDE; + virtual void OnAuthenticationFailed(gdata::GDataErrorCode error) OVERRIDE; Profile* profile_; - scoped_ptr<OperationRunner> runner_; + scoped_ptr<gdata::OperationRunner> runner_; ObserverList<DriveServiceObserver> observers_; DISALLOW_COPY_AND_ASSIGN(DriveAPIService); }; -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_API_SERVICE_H_ diff --git a/chrome/browser/chromeos/drive/drive_cache.cc b/chrome/browser/chromeos/drive/drive_cache.cc index 74fc214..2c85631 100644 --- a/chrome/browser/chromeos/drive/drive_cache.cc +++ b/chrome/browser/chromeos/drive/drive_cache.cc @@ -23,7 +23,7 @@ using content::BrowserThread; -namespace gdata { +namespace drive { namespace { const FilePath::CharType kDriveCacheVersionDir[] = FILE_PATH_LITERAL("v1"); @@ -1627,4 +1627,4 @@ void SetFreeDiskSpaceGetterForTesting(FreeDiskSpaceGetterInterface* getter) { global_free_disk_getter_for_testing = getter; } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/drive_cache.h b/chrome/browser/chromeos/drive/drive_cache.h index a6b59e4..46a5d44 100644 --- a/chrome/browser/chromeos/drive/drive_cache.h +++ b/chrome/browser/chromeos/drive/drive_cache.h @@ -23,7 +23,7 @@ class SequencedTaskRunner; } // namespace base -namespace gdata { +namespace drive { class DriveCacheEntry; class DriveCacheMetadata; @@ -464,6 +464,6 @@ class FreeDiskSpaceGetterInterface { void SetFreeDiskSpaceGetterForTesting( FreeDiskSpaceGetterInterface* getter); -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_CACHE_H_ diff --git a/chrome/browser/chromeos/drive/drive_cache_metadata.cc b/chrome/browser/chromeos/drive/drive_cache_metadata.cc index d2df321..182a1a1 100644 --- a/chrome/browser/chromeos/drive/drive_cache_metadata.cc +++ b/chrome/browser/chromeos/drive/drive_cache_metadata.cc @@ -13,7 +13,7 @@ #include "chrome/browser/chromeos/drive/drive.pb.h" #include "chrome/browser/chromeos/drive/drive_file_system_util.h" -namespace gdata { +namespace drive { namespace { @@ -642,4 +642,4 @@ void DriveCacheMetadata::AssertOnSequencedWorkerPool() { blocking_task_runner_->RunsTasksOnCurrentThread()); } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/drive_cache_metadata.h b/chrome/browser/chromeos/drive/drive_cache_metadata.h index bfcf33d..47adf3c 100644 --- a/chrome/browser/chromeos/drive/drive_cache_metadata.h +++ b/chrome/browser/chromeos/drive/drive_cache_metadata.h @@ -12,7 +12,7 @@ #include "base/file_path.h" #include "chrome/browser/chromeos/drive/drive_cache.h" -namespace gdata { +namespace drive { // DriveCacheMetadata is interface to maintain metadata of DriveCache's cached // files. This class only manages metadata. File operations are done by @@ -85,6 +85,6 @@ class DriveCacheMetadata { DISALLOW_COPY_AND_ASSIGN(DriveCacheMetadata); }; -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_CACHE_METADATA_H_ diff --git a/chrome/browser/chromeos/drive/drive_cache_metadata_unittest.cc b/chrome/browser/chromeos/drive/drive_cache_metadata_unittest.cc index 6eb06d4..e440655 100644 --- a/chrome/browser/chromeos/drive/drive_cache_metadata_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_cache_metadata_unittest.cc @@ -11,7 +11,7 @@ #include "chrome/browser/chromeos/drive/drive_test_util.h" #include "testing/gtest/include/gtest/gtest.h" -namespace gdata { +namespace drive { class DriveCacheMetadataTest : public testing::Test { public: @@ -421,4 +421,4 @@ TEST(DriveCacheMetadataExtraTest, CannotOpenDB) { EXPECT_FALSE(metadata->Initialize(cache_paths)); } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/drive_cache_observer.h b/chrome/browser/chromeos/drive/drive_cache_observer.h index 3357363..05f9755 100644 --- a/chrome/browser/chromeos/drive/drive_cache_observer.h +++ b/chrome/browser/chromeos/drive/drive_cache_observer.h @@ -7,7 +7,7 @@ #include <string> -namespace gdata { +namespace drive { // Interface for classes that need to observe events from DriveCache. // All events are notified on UI thread. @@ -28,6 +28,6 @@ class DriveCacheObserver { virtual ~DriveCacheObserver() {} }; -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_CACHE_OBSERVER_H_ diff --git a/chrome/browser/chromeos/drive/drive_cache_unittest.cc b/chrome/browser/chromeos/drive/drive_cache_unittest.cc index 160f9cc..d9b94e8 100644 --- a/chrome/browser/chromeos/drive/drive_cache_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_cache_unittest.cc @@ -26,7 +26,7 @@ using ::testing::AtLeast; using ::testing::Return; using ::testing::StrictMock; -namespace gdata { +namespace drive { namespace { const char kSymLinkToDevNull[] = "/dev/null"; @@ -163,7 +163,7 @@ class DriveCacheTest : public testing::Test { cache_->RequestInitializeOnUIThread( base::Bind(&test_util::CopyResultFromInitializeCacheCallback, &initialization_success)); - test_util::RunBlockingPoolTask(); + gdata::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. - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); profile_.reset(NULL); } @@ -210,7 +210,8 @@ class DriveCacheTest : public testing::Test { // Copy file from data dir to cache subdir, naming it per cache files // convention. if (test_util::ToCacheEntry(resource.cache_state).is_present()) { - FilePath source_path = test_util::GetTestFilePath(resource.source_file); + FilePath source_path = + gdata::test_util::GetTestFilePath(resource.source_file); ASSERT_TRUE(file_util::CopyFile(source_path, dest_path)); } else { dest_path = FilePath(FILE_PATH_LITERAL(kSymLinkToDevNull)); @@ -241,7 +242,7 @@ class DriveCacheTest : public testing::Test { DVLOG(1) << "PrepareForInitCacheTest finished"; cache_->ForceRescanOnUIThreadForTesting(); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); } void TestInitializeCache() { @@ -289,7 +290,7 @@ class DriveCacheTest : public testing::Test { resource_id, md5)); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); } void TestStoreToCache( @@ -309,7 +310,7 @@ class DriveCacheTest : public testing::Test { base::Bind(&DriveCacheTest::VerifyCacheFileState, base::Unretained(this))); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); } void VerifyGetFromCache(const std::string& resource_id, @@ -343,7 +344,7 @@ class DriveCacheTest : public testing::Test { base::Bind(&DriveCacheTest::VerifyRemoveFromCache, base::Unretained(this))); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); } void VerifyRemoveFromCache(DriveFileError error, @@ -456,7 +457,7 @@ class DriveCacheTest : public testing::Test { base::Bind(&DriveCacheTest::VerifyCacheFileState, base::Unretained(this))); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); } void TestUnpin( @@ -474,7 +475,7 @@ class DriveCacheTest : public testing::Test { base::Bind(&DriveCacheTest::VerifyCacheFileState, base::Unretained(this))); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); } void TestMarkDirty( @@ -496,7 +497,7 @@ class DriveCacheTest : public testing::Test { resource_id, md5)); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); } void VerifyMarkDirty(const std::string& resource_id, @@ -533,7 +534,7 @@ class DriveCacheTest : public testing::Test { base::Bind(&DriveCacheTest::VerifyCacheFileState, base::Unretained(this))); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); } void TestClearDirty( @@ -551,7 +552,7 @@ class DriveCacheTest : public testing::Test { base::Bind(&DriveCacheTest::VerifyCacheFileState, base::Unretained(this))); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); } void TestSetMountedState( @@ -571,7 +572,7 @@ class DriveCacheTest : public testing::Test { base::Bind(&DriveCacheTest::VerifySetMountedState, base::Unretained(this), resource_id, md5, to_mount)); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); } void VerifySetMountedState(const std::string& resource_id, @@ -692,7 +693,7 @@ class DriveCacheTest : public testing::Test { md5, cache_entry, &result)); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); return result; } @@ -817,7 +818,7 @@ TEST_F(DriveCacheTest, StoreToCacheSimple) { // Store an existing file. TestStoreToCache(resource_id, md5, - test_util::GetTestFilePath("gdata/root_feed.json"), + gdata::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_); @@ -835,7 +836,7 @@ TEST_F(DriveCacheTest, StoreToCacheSimple) { md5 = "new_md5"; num_callback_invocations_ = 0; TestStoreToCache(resource_id, md5, - test_util::GetTestFilePath("gdata/subdir_feed.json"), + gdata::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_); @@ -853,7 +854,7 @@ TEST_F(DriveCacheTest, GetFromCacheSimple) { std::string md5("abcdef0123456789"); // First store a file to cache. TestStoreToCache(resource_id, md5, - test_util::GetTestFilePath("gdata/root_feed.json"), + gdata::test_util::GetTestFilePath("gdata/root_feed.json"), DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); @@ -888,7 +889,7 @@ TEST_F(DriveCacheTest, RemoveFromCacheSimple) { std::string md5("abcdef0123456789"); // First store a file to cache. TestStoreToCache(resource_id, md5, - test_util::GetTestFilePath("gdata/root_feed.json"), + gdata::test_util::GetTestFilePath("gdata/root_feed.json"), DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); @@ -901,7 +902,7 @@ TEST_F(DriveCacheTest, RemoveFromCacheSimple) { // which is an extension separator. resource_id = "pdf:`~!@#$%^&*()-_=+[{|]}\\;',<.>/?"; TestStoreToCache(resource_id, md5, - test_util::GetTestFilePath("gdata/root_feed.json"), + gdata::test_util::GetTestFilePath("gdata/root_feed.json"), DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); @@ -922,7 +923,7 @@ TEST_F(DriveCacheTest, PinAndUnpin) { // First store a file to cache. TestStoreToCache(resource_id, md5, - test_util::GetTestFilePath("gdata/root_feed.json"), + gdata::test_util::GetTestFilePath("gdata/root_feed.json"), DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); @@ -1000,7 +1001,7 @@ TEST_F(DriveCacheTest, StoreToCachePinned) { // Store an existing file to a previously pinned file. num_callback_invocations_ = 0; TestStoreToCache(resource_id, md5, - test_util::GetTestFilePath("gdata/root_feed.json"), + gdata::test_util::GetTestFilePath("gdata/root_feed.json"), DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_PINNED | @@ -1040,7 +1041,7 @@ TEST_F(DriveCacheTest, GetFromCachePinned) { // Store an existing file to the previously pinned non-existent file. TestStoreToCache(resource_id, md5, - test_util::GetTestFilePath("gdata/root_feed.json"), + gdata::test_util::GetTestFilePath("gdata/root_feed.json"), DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_PINNED | @@ -1065,7 +1066,7 @@ TEST_F(DriveCacheTest, RemoveFromCachePinned) { // Store a file to cache, and pin it. TestStoreToCache(resource_id, md5, - test_util::GetTestFilePath("gdata/root_feed.json"), + gdata::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, @@ -1085,7 +1086,7 @@ TEST_F(DriveCacheTest, RemoveFromCachePinned) { EXPECT_CALL(*mock_cache_observer_, OnCachePinned(resource_id, md5)).Times(1); TestStoreToCache(resource_id, md5, - test_util::GetTestFilePath("gdata/root_feed.json"), + gdata::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, @@ -1109,7 +1110,7 @@ TEST_F(DriveCacheTest, DirtyCacheSimple) { // First store a file to cache. TestStoreToCache(resource_id, md5, - test_util::GetTestFilePath("gdata/root_feed.json"), + gdata::test_util::GetTestFilePath("gdata/root_feed.json"), DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); @@ -1150,7 +1151,7 @@ TEST_F(DriveCacheTest, DirtyCachePinned) { // First store a file to cache and pin it. TestStoreToCache(resource_id, md5, - test_util::GetTestFilePath("gdata/root_feed.json"), + gdata::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, @@ -1202,7 +1203,7 @@ TEST_F(DriveCacheTest, PinAndUnpinDirtyCache) { // First store a file to cache and mark it as dirty. TestStoreToCache(resource_id, md5, - test_util::GetTestFilePath("gdata/root_feed.json"), + gdata::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, @@ -1251,7 +1252,7 @@ TEST_F(DriveCacheTest, DirtyCacheRepetitive) { // First store a file to cache. TestStoreToCache(resource_id, md5, - test_util::GetTestFilePath("gdata/root_feed.json"), + gdata::test_util::GetTestFilePath("gdata/root_feed.json"), DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); @@ -1355,7 +1356,7 @@ TEST_F(DriveCacheTest, DirtyCacheInvalid) { // Store a file to cache. TestStoreToCache(resource_id, md5, - test_util::GetTestFilePath("gdata/root_feed.json"), + gdata::test_util::GetTestFilePath("gdata/root_feed.json"), DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); @@ -1383,7 +1384,7 @@ TEST_F(DriveCacheTest, DirtyCacheInvalid) { num_callback_invocations_ = 0; md5 = "new_md5"; TestStoreToCache(resource_id, md5, - test_util::GetTestFilePath("gdata/subdir_feed.json"), + 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 | @@ -1403,7 +1404,7 @@ TEST_F(DriveCacheTest, RemoveFromDirtyCache) { // Store a file to cache, pin it, mark it dirty and commit it. TestStoreToCache(resource_id, md5, - test_util::GetTestFilePath("gdata/root_feed.json"), + gdata::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, @@ -1441,7 +1442,7 @@ TEST_F(DriveCacheTest, MountUnmount) { // First store a file to cache in the tmp subdir. TestStoreToCache(resource_id, md5, - test_util::GetTestFilePath("gdata/root_feed.json"), + gdata::test_util::GetTestFilePath("gdata/root_feed.json"), DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); @@ -1485,7 +1486,7 @@ TEST_F(DriveCacheTest, GetResourceIdsOfBacklogOnUIThread) { std::vector<std::string> to_upload; cache_->GetResourceIdsOfBacklogOnUIThread( base::Bind(&OnGetResourceIdsOfBacklog, &to_fetch, &to_upload)); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); sort(to_fetch.begin(), to_fetch.end()); ASSERT_EQ(1U, to_fetch.size()); @@ -1503,7 +1504,7 @@ TEST_F(DriveCacheTest, GetResourceIdsOfExistingPinnedFilesOnUIThread) { std::vector<std::string> resource_ids; cache_->GetResourceIdsOfExistingPinnedFilesOnUIThread( base::Bind(&OnGetResourceIds, &resource_ids)); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); sort(resource_ids.begin(), resource_ids.end()); ASSERT_EQ(2U, resource_ids.size()); @@ -1517,7 +1518,7 @@ TEST_F(DriveCacheTest, GetResourceIdsOfAllFilesOnUIThread) { std::vector<std::string> resource_ids; cache_->GetResourceIdsOfAllFilesOnUIThread( base::Bind(&OnGetResourceIds, &resource_ids)); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); sort(resource_ids.begin(), resource_ids.end()); ASSERT_EQ(6U, resource_ids.size()); @@ -1541,7 +1542,7 @@ TEST_F(DriveCacheTest, ClearAllOnUIThread) { // Store an existing file. TestStoreToCache(resource_id, md5, - test_util::GetTestFilePath("gdata/root_feed.json"), + gdata::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_); @@ -1555,7 +1556,7 @@ TEST_F(DriveCacheTest, ClearAllOnUIThread) { cache_->ClearAllOnUIThread(base::Bind(&OnClearAll, &error, &file_path)); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); // Verify that all the cache is removed. @@ -1572,7 +1573,7 @@ TEST_F(DriveCacheTest, StoreToCacheNoSpace) { // Try to store an existing file. TestStoreToCache(resource_id, md5, - test_util::GetTestFilePath("gdata/root_feed.json"), + gdata::test_util::GetTestFilePath("gdata/root_feed.json"), DRIVE_FILE_ERROR_NO_SPACE, test_util::TEST_CACHE_STATE_NONE, DriveCache::CACHE_TYPE_TMP); @@ -1600,11 +1601,11 @@ TEST(DriveCacheExtraTest, InitializationFailure) { cache->RequestInitializeOnUIThread( base::Bind(&test_util::CopyResultFromInitializeCacheCallback, &success)); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); EXPECT_FALSE(success); cache->DestroyOnUIThread(); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/drive_download_observer.cc b/chrome/browser/chromeos/drive/drive_download_observer.cc index dcc80381..81de5de 100644 --- a/chrome/browser/chromeos/drive/drive_download_observer.cc +++ b/chrome/browser/chromeos/drive/drive_download_observer.cc @@ -25,7 +25,7 @@ using content::BrowserThread; using content::DownloadManager; using content::DownloadItem; -namespace gdata { +namespace drive { namespace { // Threshold file size after which we stream the file. @@ -50,8 +50,10 @@ 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<DocumentEntry> entry) { entry_ = entry.Pass(); } - scoped_ptr<DocumentEntry> entry_passed() { return entry_.Pass(); } + void set_entry(scoped_ptr<gdata::DocumentEntry> entry) { + entry_ = entry.Pass(); + } + scoped_ptr<gdata::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) { @@ -65,7 +67,7 @@ class UploadingUserData : public DownloadCompletionBlocker { DriveUploader* uploader_; int upload_id_; FilePath virtual_dir_path_; - scoped_ptr<DocumentEntry> entry_; + scoped_ptr<gdata::DocumentEntry> entry_; bool is_overwrite_; std::string resource_id_; std::string md5_; @@ -179,11 +181,11 @@ void OnEntryFound(Profile* profile, void OnAuthenticate(Profile* profile, const FilePath& drive_path, const base::Closure& substitute_callback, - GDataErrorCode error, + gdata::GDataErrorCode error, const std::string& token) { DVLOG(1) << "OnAuthenticate"; - if (error == HTTP_SUCCESS) { + if (error == gdata::HTTP_SUCCESS) { const FilePath drive_dir_path = util::ExtractDrivePath(drive_path.DirName()); // Ensure the directory exists. This also forces DriveFileSystem to @@ -664,7 +666,7 @@ void DriveDownloadObserver::OnUploadComplete( DriveFileError error, const FilePath& drive_path, const FilePath& file_path, - scoped_ptr<DocumentEntry> document_entry) { + scoped_ptr<gdata::DocumentEntry> document_entry) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(document_entry.get()); @@ -698,8 +700,8 @@ void DriveDownloadObserver::MoveFileToDriveCache(DownloadItem* download) { return; } - // Pass ownership of the DocumentEntry object. - scoped_ptr<DocumentEntry> entry = upload_data->entry_passed(); + // Pass ownership of the gdata::DocumentEntry object. + scoped_ptr<gdata::DocumentEntry> entry = upload_data->entry_passed(); if (!entry.get()) { NOTREACHED(); return; @@ -715,7 +717,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(UPLOAD_NEW_FILE, + file_system_->AddUploadedFile(gdata::UPLOAD_NEW_FILE, upload_data->virtual_dir_path(), entry.Pass(), download->GetTargetFilePath(), @@ -745,4 +747,4 @@ std::string DriveDownloadObserver::UploaderParams::DebugString() const { "]"; } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/drive_download_observer.h b/chrome/browser/chromeos/drive/drive_download_observer.h index 138a172..36697d7 100644 --- a/chrome/browser/chromeos/drive/drive_download_observer.h +++ b/chrome/browser/chromeos/drive/drive_download_observer.h @@ -18,8 +18,11 @@ class Profile; namespace gdata { - class DocumentEntry; +} + +namespace drive { + class DriveEntryProto; class DriveFileSystemInterface; class DriveUploader; @@ -191,7 +194,7 @@ class DriveDownloadObserver : public content::DownloadManager::Observer, DriveFileError error, const FilePath& drive_path, const FilePath& file_path, - scoped_ptr<DocumentEntry> document_entry); + scoped_ptr<gdata::DocumentEntry> document_entry); // Moves the downloaded file to drive cache. // Must be called after DriveDownloadObserver receives COMPLETE notification. @@ -219,6 +222,6 @@ class DriveDownloadObserver : public content::DownloadManager::Observer, DISALLOW_COPY_AND_ASSIGN(DriveDownloadObserver); }; -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_DOWNLOAD_OBSERVER_H_ diff --git a/chrome/browser/chromeos/drive/drive_file_error.cc b/chrome/browser/chromeos/drive/drive_file_error.cc index e23abc6..6b7a2ad 100644 --- a/chrome/browser/chromeos/drive/drive_file_error.cc +++ b/chrome/browser/chromeos/drive/drive_file_error.cc @@ -6,7 +6,7 @@ #include "base/logging.h" -namespace gdata { +namespace drive { base::PlatformFileError DriveFileErrorToPlatformError(DriveFileError error) { switch (error) { @@ -69,4 +69,4 @@ base::PlatformFileError DriveFileErrorToPlatformError(DriveFileError error) { return base::PLATFORM_FILE_ERROR_FAILED; } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/drive_file_error.h b/chrome/browser/chromeos/drive/drive_file_error.h index 96f15c0..0e333e5 100644 --- a/chrome/browser/chromeos/drive/drive_file_error.h +++ b/chrome/browser/chromeos/drive/drive_file_error.h @@ -7,7 +7,7 @@ #include "base/platform_file.h" -namespace gdata { +namespace drive { enum DriveFileError { DRIVE_FILE_OK = 0, @@ -33,6 +33,6 @@ enum DriveFileError { // Returns a PlatformFileError that corresponds to the DriveFileError provided. base::PlatformFileError DriveFileErrorToPlatformError(DriveFileError error); -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FILE_ERROR_H_ diff --git a/chrome/browser/chromeos/drive/drive_file_system.cc b/chrome/browser/chromeos/drive/drive_file_system.cc index 42b9c19..d7385bb8 100644 --- a/chrome/browser/chromeos/drive/drive_file_system.cc +++ b/chrome/browser/chromeos/drive/drive_file_system.cc @@ -38,7 +38,7 @@ using content::BrowserThread; -namespace gdata { +namespace drive { namespace { const char kMimeTypeJson[] = "application/json"; @@ -195,7 +195,7 @@ void GetDocumentResourceIdOnBlockingPool( std::string* resource_id) { DCHECK(resource_id); - if (DocumentEntry::HasHostedDocumentExtension(local_file_path)) { + if (gdata::DocumentEntry::HasHostedDocumentExtension(local_file_path)) { std::string error; DictionaryValue* dict_value = NULL; JSONFileValueSerializer serializer(local_file_path); @@ -355,7 +355,7 @@ struct DriveFileSystem::GetFileFromCacheParams { const std::string& md5, const std::string& mime_type, const GetFileCallback& get_file_callback, - const GetContentCallback& get_content_callback) + const gdata::GetContentCallback& get_content_callback) : virtual_file_path(virtual_file_path), local_tmp_path(local_tmp_path), content_url(content_url), @@ -374,7 +374,7 @@ struct DriveFileSystem::GetFileFromCacheParams { std::string md5; std::string mime_type; GetFileCallback get_file_callback; - GetContentCallback get_content_callback; + gdata::GetContentCallback get_content_callback; }; // DriveFileSystem::StartFileUploadParams implementation. @@ -393,9 +393,9 @@ struct DriveFileSystem::StartFileUploadParams { // DriveFileSystem::AddUploadedFileParams implementation. struct DriveFileSystem::AddUploadedFileParams { - AddUploadedFileParams(UploadMode upload_mode, + AddUploadedFileParams(gdata::UploadMode upload_mode, const FilePath& directory_path, - scoped_ptr<DocumentEntry> doc_entry, + scoped_ptr<gdata::DocumentEntry> doc_entry, const FilePath& file_content_path, DriveCache::FileOperationType cache_operation, const base::Closure& callback) @@ -407,9 +407,9 @@ struct DriveFileSystem::AddUploadedFileParams { callback(callback) { } - UploadMode upload_mode; + gdata::UploadMode upload_mode; FilePath directory_path; - scoped_ptr<DocumentEntry> doc_entry; + scoped_ptr<gdata::DocumentEntry> doc_entry; FilePath file_content_path; DriveCache::FileOperationType cache_operation; base::Closure callback; @@ -575,11 +575,11 @@ void DriveFileSystem::GetEntryInfoByResourceId( BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(!callback.is_null()); - RunTaskOnUIThread( + gdata::RunTaskOnUIThread( base::Bind(&DriveFileSystem::GetEntryInfoByResourceIdOnUIThread, ui_weak_ptr_, resource_id, - CreateRelayCallback(callback))); + gdata::CreateRelayCallback(callback))); } void DriveFileSystem::GetEntryInfoByResourceIdOnUIThread( @@ -659,7 +659,7 @@ void DriveFileSystem::TransferFileFromRemoteToLocal( ui_weak_ptr_, local_dest_file_path, callback), - GetContentCallback()); + gdata::GetContentCallback()); } void DriveFileSystem::TransferFileFromLocalToRemote( @@ -702,7 +702,7 @@ void DriveFileSystem::TransferFileFromLocalToRemoteAfterGetEntryInfo( } std::string* resource_id = new std::string; - util::PostBlockingPoolSequencedTaskAndReply( + gdata::util::PostBlockingPoolSequencedTaskAndReply( FROM_HERE, blocking_task_runner_, base::Bind(&GetDocumentResourceIdOnBlockingPool, @@ -752,7 +752,7 @@ void DriveFileSystem::TransferRegularFile( new DriveFileError(DRIVE_FILE_OK); int64* file_size = new int64; std::string* content_type = new std::string; - util::PostBlockingPoolSequencedTaskAndReply( + gdata::util::PostBlockingPoolSequencedTaskAndReply( FROM_HERE, blocking_task_runner_, base::Bind(&GetLocalFileInfoOnBlockingPool, @@ -836,11 +836,11 @@ void DriveFileSystem::OnTransferCompleted( DriveFileError error, const FilePath& drive_path, const FilePath& file_path, - scoped_ptr<DocumentEntry> document_entry) { + scoped_ptr<gdata::DocumentEntry> document_entry) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (error == DRIVE_FILE_OK && document_entry.get()) { - AddUploadedFile(UPLOAD_NEW_FILE, + AddUploadedFile(gdata::UPLOAD_NEW_FILE, drive_path.DirName(), document_entry.Pass(), file_path, @@ -858,11 +858,11 @@ void DriveFileSystem::Copy(const FilePath& src_file_path, BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(!callback.is_null()); - RunTaskOnUIThread(base::Bind(&DriveFileSystem::CopyOnUIThread, - ui_weak_ptr_, - src_file_path, - dest_file_path, - CreateRelayCallback(callback))); + gdata::RunTaskOnUIThread(base::Bind(&DriveFileSystem::CopyOnUIThread, + ui_weak_ptr_, + src_file_path, + dest_file_path, + gdata::CreateRelayCallback(callback))); } void DriveFileSystem::CopyOnUIThread(const FilePath& src_file_path, @@ -928,7 +928,7 @@ void DriveFileSystem::CopyOnUIThreadAfterGetEntryInfoPair( ui_weak_ptr_, dest_file_path, callback), - GetContentCallback()); + gdata::GetContentCallback()); } void DriveFileSystem::OnGetFileCompleteForCopy( @@ -971,7 +971,7 @@ void DriveFileSystem::OnGetFileCompleteForTransferFile( // CopyLocalFileOnBlockingPool. DriveFileError* copy_file_error = new DriveFileError(DRIVE_FILE_OK); - util::PostBlockingPoolSequencedTaskAndReply( + gdata::util::PostBlockingPoolSequencedTaskAndReply( FROM_HERE, blocking_task_runner_, base::Bind(&CopyLocalFileOnBlockingPool, @@ -1005,11 +1005,11 @@ void DriveFileSystem::Move(const FilePath& src_file_path, BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(!callback.is_null()); - RunTaskOnUIThread(base::Bind(&DriveFileSystem::MoveOnUIThread, - ui_weak_ptr_, - src_file_path, - dest_file_path, - CreateRelayCallback(callback))); + gdata::RunTaskOnUIThread(base::Bind(&DriveFileSystem::MoveOnUIThread, + ui_weak_ptr_, + src_file_path, + dest_file_path, + gdata::CreateRelayCallback(callback))); } void DriveFileSystem::MoveOnUIThread(const FilePath& src_file_path, @@ -1087,11 +1087,11 @@ void DriveFileSystem::Remove(const FilePath& file_path, BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(!callback.is_null()); - RunTaskOnUIThread(base::Bind(&DriveFileSystem::RemoveOnUIThread, - ui_weak_ptr_, - file_path, - is_recursive, - CreateRelayCallback(callback))); + gdata::RunTaskOnUIThread(base::Bind(&DriveFileSystem::RemoveOnUIThread, + ui_weak_ptr_, + file_path, + is_recursive, + gdata::CreateRelayCallback(callback))); } void DriveFileSystem::RemoveOnUIThread( @@ -1113,12 +1113,13 @@ void DriveFileSystem::CreateDirectory( BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(!callback.is_null()); - RunTaskOnUIThread(base::Bind(&DriveFileSystem::CreateDirectoryOnUIThread, - ui_weak_ptr_, - directory_path, - is_exclusive, - is_recursive, - CreateRelayCallback(callback))); + gdata::RunTaskOnUIThread( + base::Bind(&DriveFileSystem::CreateDirectoryOnUIThread, + ui_weak_ptr_, + directory_path, + is_exclusive, + is_recursive, + gdata::CreateRelayCallback(callback))); } void DriveFileSystem::CreateDirectoryOnUIThread( @@ -1195,11 +1196,11 @@ void DriveFileSystem::CreateFile(const FilePath& file_path, BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(!callback.is_null()); - RunTaskOnUIThread(base::Bind(&DriveFileSystem::CreateFileOnUIThread, - ui_weak_ptr_, - file_path, - is_exclusive, - CreateRelayCallback(callback))); + gdata::RunTaskOnUIThread(base::Bind(&DriveFileSystem::CreateFileOnUIThread, + ui_weak_ptr_, + file_path, + is_exclusive, + gdata::CreateRelayCallback(callback))); } void DriveFileSystem::CreateFileOnUIThread( @@ -1261,23 +1262,23 @@ void DriveFileSystem::OnGetEntryInfoForCreateFile( void DriveFileSystem::GetFileByPath( const FilePath& file_path, const GetFileCallback& get_file_callback, - const GetContentCallback& get_content_callback) { + const gdata::GetContentCallback& get_content_callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(!get_file_callback.is_null()); - RunTaskOnUIThread( + gdata::RunTaskOnUIThread( base::Bind(&DriveFileSystem::GetFileByPathOnUIThread, ui_weak_ptr_, file_path, - CreateRelayCallback(get_file_callback), - CreateRelayCallback(get_content_callback))); + gdata::CreateRelayCallback(get_file_callback), + gdata::CreateRelayCallback(get_content_callback))); } void DriveFileSystem::GetFileByPathOnUIThread( const FilePath& file_path, const GetFileCallback& get_file_callback, - const GetContentCallback& get_content_callback) { + const gdata::GetContentCallback& get_content_callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!get_file_callback.is_null()); @@ -1286,14 +1287,14 @@ void DriveFileSystem::GetFileByPathOnUIThread( base::Bind(&DriveFileSystem::OnGetEntryInfoCompleteForGetFileByPath, ui_weak_ptr_, file_path, - CreateRelayCallback(get_file_callback), - CreateRelayCallback(get_content_callback))); + gdata::CreateRelayCallback(get_file_callback), + gdata::CreateRelayCallback(get_content_callback))); } void DriveFileSystem::OnGetEntryInfoCompleteForGetFileByPath( const FilePath& file_path, const GetFileCallback& get_file_callback, - const GetContentCallback& get_content_callback, + const gdata::GetContentCallback& get_content_callback, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -1314,7 +1315,7 @@ void DriveFileSystem::OnGetEntryInfoCompleteForGetFileByPath( void DriveFileSystem::GetResolvedFileByPath( const FilePath& file_path, const GetFileCallback& get_file_callback, - const GetContentCallback& get_content_callback, + const gdata::GetContentCallback& get_content_callback, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!get_file_callback.is_null()); @@ -1338,7 +1339,7 @@ void DriveFileSystem::GetResolvedFileByPath( FilePath* temp_file_path = new FilePath; std::string* mime_type = new std::string; DriveFileType* file_type = new DriveFileType(REGULAR_FILE); - util::PostBlockingPoolSequencedTaskAndReply( + gdata::util::PostBlockingPoolSequencedTaskAndReply( FROM_HERE, blocking_task_runner_, base::Bind(&CreateDocumentJsonFileOnBlockingPool, @@ -1385,21 +1386,21 @@ void DriveFileSystem::GetResolvedFileByPath( void DriveFileSystem::GetFileByResourceId( const std::string& resource_id, const GetFileCallback& get_file_callback, - const GetContentCallback& get_content_callback) { + const gdata::GetContentCallback& get_content_callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || BrowserThread::CurrentlyOn(BrowserThread::IO)); - RunTaskOnUIThread( + gdata::RunTaskOnUIThread( base::Bind(&DriveFileSystem::GetFileByResourceIdOnUIThread, ui_weak_ptr_, resource_id, - CreateRelayCallback(get_file_callback), - CreateRelayCallback(get_content_callback))); + gdata::CreateRelayCallback(get_file_callback), + gdata::CreateRelayCallback(get_content_callback))); } void DriveFileSystem::GetFileByResourceIdOnUIThread( const std::string& resource_id, const GetFileCallback& get_file_callback, - const GetContentCallback& get_content_callback) { + const gdata::GetContentCallback& get_content_callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!get_file_callback.is_null()); @@ -1413,7 +1414,7 @@ void DriveFileSystem::GetFileByResourceIdOnUIThread( void DriveFileSystem::GetFileByResourceIdAfterGetEntry( const GetFileCallback& get_file_callback, - const GetContentCallback& get_content_callback, + const gdata::GetContentCallback& get_content_callback, DriveFileError error, const FilePath& file_path, scoped_ptr<DriveEntryProto> entry_proto) { @@ -1471,7 +1472,7 @@ void DriveFileSystem::OnGetFileFromCache( } void DriveFileSystem::OnGetDocumentEntry(const GetFileFromCacheParams& params, - GDataErrorCode status, + gdata::GDataErrorCode status, scoped_ptr<base::Value> data) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!params.get_file_callback.is_null()); @@ -1485,7 +1486,8 @@ void DriveFileSystem::OnGetDocumentEntry(const GetFileFromCacheParams& params, return; } - scoped_ptr<DocumentEntry> doc_entry(DocumentEntry::ExtractAndParse(*data)); + scoped_ptr<gdata::DocumentEntry> doc_entry( + gdata::DocumentEntry::ExtractAndParse(*data)); GURL content_url = doc_entry->content_url(); int64 file_size = doc_entry->file_size(); @@ -1519,7 +1521,7 @@ void DriveFileSystem::CheckForSpaceBeforeDownload( } bool* has_enough_space = new bool(false); - util::PostBlockingPoolSequencedTaskAndReply( + gdata::util::PostBlockingPoolSequencedTaskAndReply( FROM_HERE, blocking_task_runner_, base::Bind(&DriveCache::FreeDiskSpaceIfNeededFor, @@ -1568,11 +1570,11 @@ void DriveFileSystem::GetEntryInfoByPath(const FilePath& file_path, BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(!callback.is_null()); - RunTaskOnUIThread( + gdata::RunTaskOnUIThread( base::Bind(&DriveFileSystem::GetEntryInfoByPathOnUIThread, ui_weak_ptr_, file_path, - CreateRelayCallback(callback))); + gdata::CreateRelayCallback(callback))); } void DriveFileSystem::GetEntryInfoByPathOnUIThread( @@ -1630,11 +1632,11 @@ void DriveFileSystem::ReadDirectoryByPath( BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(!callback.is_null()); - RunTaskOnUIThread( + gdata::RunTaskOnUIThread( base::Bind(&DriveFileSystem::ReadDirectoryByPathOnUIThread, ui_weak_ptr_, directory_path, - CreateRelayCallback(callback))); + gdata::CreateRelayCallback(callback))); } void DriveFileSystem::ReadDirectoryByPathOnUIThread( @@ -1692,7 +1694,7 @@ void DriveFileSystem::ReadDirectoryByPathOnUIThreadAfterRead( void DriveFileSystem::RequestDirectoryRefresh(const FilePath& directory_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || BrowserThread::CurrentlyOn(BrowserThread::IO)); - RunTaskOnUIThread( + gdata::RunTaskOnUIThread( base::Bind(&DriveFileSystem::RequestDirectoryRefreshOnUIThread, ui_weak_ptr_, directory_path)); @@ -1774,11 +1776,11 @@ void DriveFileSystem::UpdateFileByResourceId( BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(!callback.is_null()); - RunTaskOnUIThread( + gdata::RunTaskOnUIThread( base::Bind(&DriveFileSystem::UpdateFileByResourceIdOnUIThread, ui_weak_ptr_, resource_id, - CreateRelayCallback(callback))); + gdata::CreateRelayCallback(callback))); } void DriveFileSystem::UpdateFileByResourceIdOnUIThread( @@ -1845,7 +1847,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); - util::PostBlockingPoolSequencedTaskAndReply( + gdata::util::PostBlockingPoolSequencedTaskAndReply( FROM_HERE, blocking_task_runner_, base::Bind(&GetLocalFileSizeOnBlockingPool, @@ -1897,7 +1899,7 @@ void DriveFileSystem::OnUpdatedFileUploaded( DriveFileError error, const FilePath& drive_path, const FilePath& file_path, - scoped_ptr<DocumentEntry> document_entry) { + scoped_ptr<gdata::DocumentEntry> document_entry) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (error != DRIVE_FILE_OK) { @@ -1906,7 +1908,7 @@ void DriveFileSystem::OnUpdatedFileUploaded( return; } - AddUploadedFile(UPLOAD_EXISTING_FILE, + AddUploadedFile(gdata::UPLOAD_EXISTING_FILE, drive_path.DirName(), document_entry.Pass(), file_path, @@ -1918,9 +1920,10 @@ void DriveFileSystem::GetAvailableSpace( const GetAvailableSpaceCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || BrowserThread::CurrentlyOn(BrowserThread::IO)); - RunTaskOnUIThread(base::Bind(&DriveFileSystem::GetAvailableSpaceOnUIThread, - ui_weak_ptr_, - CreateRelayCallback(callback))); + gdata::RunTaskOnUIThread( + base::Bind(&DriveFileSystem::GetAvailableSpaceOnUIThread, + ui_weak_ptr_, + gdata::CreateRelayCallback(callback))); } void DriveFileSystem::GetAvailableSpaceOnUIThread( @@ -1940,7 +1943,7 @@ void DriveFileSystem::GetAvailableSpaceOnUIThread( void DriveFileSystem::OnGetAvailableSpace( const GetAvailableSpaceCallback& callback, - GDataErrorCode status, + gdata::GDataErrorCode status, scoped_ptr<base::Value> data) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -1951,9 +1954,9 @@ void DriveFileSystem::OnGetAvailableSpace( return; } - scoped_ptr<AccountMetadataFeed> feed; + scoped_ptr<gdata::AccountMetadataFeed> feed; if (data.get()) - feed = AccountMetadataFeed::CreateFrom(*data); + feed = gdata::AccountMetadataFeed::CreateFrom(*data); if (!feed.get()) { callback.Run(DRIVE_FILE_ERROR_FAILED, -1, -1); return; @@ -1966,7 +1969,7 @@ void DriveFileSystem::OnGetAvailableSpace( void DriveFileSystem::OnGetAboutResource( const GetAvailableSpaceCallback& callback, - GDataErrorCode status, + gdata::GDataErrorCode status, scoped_ptr<base::Value> resource_json) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -1977,9 +1980,9 @@ void DriveFileSystem::OnGetAboutResource( return; } - scoped_ptr<AboutResource> about; + scoped_ptr<gdata::AboutResource> about; if (resource_json.get()) - about = AboutResource::CreateFrom(*resource_json); + about = gdata::AboutResource::CreateFrom(*resource_json); if (!about.get()) { callback.Run(DRIVE_FILE_ERROR_FAILED, -1, -1); @@ -1993,7 +1996,7 @@ void DriveFileSystem::OnGetAboutResource( void DriveFileSystem::AddNewDirectory( const CreateDirectoryParams& params, - GDataErrorCode status, + gdata::GDataErrorCode status, scoped_ptr<base::Value> data) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!params.callback.is_null()); @@ -2006,7 +2009,8 @@ void DriveFileSystem::AddNewDirectory( resource_metadata_->AddEntryToDirectory( params.created_directory_path.DirName(), - scoped_ptr<DocumentEntry>(DocumentEntry::ExtractAndParse(*data)), + scoped_ptr<gdata::DocumentEntry>( + gdata::DocumentEntry::ExtractAndParse(*data)), base::Bind(&DriveFileSystem::ContinueCreateDirectory, ui_weak_ptr_, params)); @@ -2060,7 +2064,7 @@ void DriveFileSystem::OnSearch(const SearchCallback& search_callback, scoped_ptr<std::vector<SearchResultInfo> > result_vec(results); DCHECK_EQ(1u, params->feed_list.size()); - DocumentFeed* feed = params->feed_list[0]; + gdata::DocumentFeed* feed = params->feed_list[0]; // TODO(tbarzic): Limit total number of returned results for the query. GURL next_feed; @@ -2069,7 +2073,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<DocumentEntry*> entries; + std::vector<gdata::DocumentEntry*> entries; feed->ReleaseEntries(&entries); if (entries.empty()) { callback.Run(); @@ -2083,7 +2087,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<DocumentEntry>(entries[i]), + scoped_ptr<gdata::DocumentEntry>(entries[i]), base::Bind(&DriveFileSystem::AddToSearchResults, ui_weak_ptr_, results, @@ -2125,11 +2129,11 @@ void DriveFileSystem::Search(const std::string& search_query, BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(!callback.is_null()); - RunTaskOnUIThread(base::Bind(&DriveFileSystem::SearchAsyncOnUIThread, - ui_weak_ptr_, - search_query, - next_feed, - CreateRelayCallback(callback))); + gdata::RunTaskOnUIThread(base::Bind(&DriveFileSystem::SearchAsyncOnUIThread, + ui_weak_ptr_, + search_query, + next_feed, + gdata::CreateRelayCallback(callback))); } void DriveFileSystem::SearchAsyncOnUIThread( @@ -2176,7 +2180,7 @@ void DriveFileSystem::LoadRootFeedFromCacheForTesting() { } DriveFileError DriveFileSystem::UpdateFromFeedForTesting( - const ScopedVector<DocumentFeed>& feed_list, + const ScopedVector<gdata::DocumentFeed>& feed_list, int64 start_changestamp, int64 root_feed_changestamp) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -2189,7 +2193,7 @@ DriveFileError DriveFileSystem::UpdateFromFeedForTesting( void DriveFileSystem::OnCopyDocumentCompleted( const FilePath& dir_path, const FileOperationCallback& callback, - GDataErrorCode status, + gdata::GDataErrorCode status, scoped_ptr<base::Value> data) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -2205,7 +2209,8 @@ void DriveFileSystem::OnCopyDocumentCompleted( // destination directory by MoveEntryFromRootDirectory(). resource_metadata_->AddEntryToDirectory( resource_metadata_->root()->GetFilePath(), - scoped_ptr<DocumentEntry>(DocumentEntry::ExtractAndParse(*data)), + scoped_ptr<gdata::DocumentEntry>( + gdata::DocumentEntry::ExtractAndParse(*data)), base::Bind(&DriveFileSystem::MoveEntryFromRootDirectory, ui_weak_ptr_, dir_path, @@ -2214,7 +2219,7 @@ void DriveFileSystem::OnCopyDocumentCompleted( void DriveFileSystem::OnFileDownloaded( const GetFileFromCacheParams& params, - GDataErrorCode status, + gdata::GDataErrorCode status, const GURL& content_url, const FilePath& downloaded_file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -2222,7 +2227,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_CANCELLED) { + if (status == gdata::GDATA_CANCELLED) { cache_->GetCacheEntryOnUIThread( params.resource_id, params.md5, @@ -2241,7 +2246,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); - util::PostBlockingPoolSequencedTaskAndReply( + gdata::util::PostBlockingPoolSequencedTaskAndReply( FROM_HERE, blocking_task_runner_, base::Bind(&DriveCache::FreeDiskSpaceIfNeededFor, @@ -2271,7 +2276,7 @@ void DriveFileSystem::UnpinIfPinned( void DriveFileSystem::OnFileDownloadedAndSpaceChecked( const GetFileFromCacheParams& params, - GDataErrorCode status, + gdata::GDataErrorCode status, const GURL& content_url, const FilePath& downloaded_file_path, bool* has_enough_space) { @@ -2295,7 +2300,7 @@ void DriveFileSystem::OnFileDownloadedAndSpaceChecked( } else { // If we don't have enough space, remove the downloaded file, and // report "no space" error. - util::PostBlockingPoolSequencedTask( + gdata::util::PostBlockingPoolSequencedTask( FROM_HERE, blocking_task_runner_, base::Bind(base::IgnoreResult(&file_util::Delete), @@ -2322,7 +2327,7 @@ void DriveFileSystem::MoveEntryToDirectory( const FilePath& file_path, const FilePath& directory_path, const FileMoveCallback& callback, - GDataErrorCode status, + gdata::GDataErrorCode status, const GURL& /* document_url */) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -2469,9 +2474,9 @@ void DriveFileSystem::ContinueFindFirstMissingParentDirectory( } void DriveFileSystem::AddUploadedFile( - UploadMode upload_mode, + gdata::UploadMode upload_mode, const FilePath& directory_path, - scoped_ptr<DocumentEntry> entry, + scoped_ptr<gdata::DocumentEntry> entry, const FilePath& file_content_path, DriveCache::FileOperationType cache_operation, const base::Closure& callback) { @@ -2492,9 +2497,9 @@ void DriveFileSystem::AddUploadedFile( } void DriveFileSystem::AddUploadedFileOnUIThread( - UploadMode upload_mode, + gdata::UploadMode upload_mode, const FilePath& directory_path, - scoped_ptr<DocumentEntry> doc_entry, + scoped_ptr<gdata::DocumentEntry> doc_entry, const FilePath& file_content_path, DriveCache::FileOperationType cache_operation, const base::Closure& callback) { @@ -2514,7 +2519,7 @@ void DriveFileSystem::AddUploadedFileOnUIThread( base::Bind(&DriveFileSystem::ContinueAddUploadedFile, ui_weak_ptr_, base::Passed(¶ms)); - if (upload_mode == UPLOAD_EXISTING_FILE) { + if (upload_mode == gdata::UPLOAD_EXISTING_FILE) { // Remove the existing entry. resource_metadata_->RemoveEntryFromParent(resource_id, file_move_callback); } else { @@ -2537,7 +2542,7 @@ void DriveFileSystem::ContinueAddUploadedFile( // Get parameters before base::Passed() invalidates |params|. const FilePath& directory_path = params->directory_path; - scoped_ptr<DocumentEntry> doc_entry(params->doc_entry.Pass()); + scoped_ptr<gdata::DocumentEntry> doc_entry(params->doc_entry.Pass()); resource_metadata_->AddEntryToDirectory( directory_path, @@ -2564,7 +2569,7 @@ void DriveFileSystem::AddUploadedFileToCache( OnDirectoryChanged(file_path.DirName()); - if (params->upload_mode == UPLOAD_NEW_FILE) { + if (params->upload_mode == gdata::UPLOAD_NEW_FILE) { // Add the file to the cache if we have uploaded a new file. cache_->StoreOnUIThread(params->resource_id, params->md5, @@ -2572,7 +2577,7 @@ void DriveFileSystem::AddUploadedFileToCache( params->cache_operation, base::Bind(&OnCacheUpdatedForAddUploadedFile, params->callback)); - } else if (params->upload_mode == UPLOAD_EXISTING_FILE) { + } else if (params->upload_mode == gdata::UPLOAD_EXISTING_FILE) { // Clear the dirty bit if we have updated an existing file. cache_->ClearDirtyOnUIThread(params->resource_id, params->md5, @@ -2589,7 +2594,7 @@ void DriveFileSystem::AddUploadedFileToCache( void DriveFileSystem::UpdateEntryData(const std::string& resource_id, const std::string& md5, - scoped_ptr<DocumentEntry> entry, + scoped_ptr<gdata::DocumentEntry> entry, const FilePath& file_content_path, const base::Closure& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -2609,7 +2614,7 @@ void DriveFileSystem::UpdateEntryData(const std::string& resource_id, void DriveFileSystem::UpdateEntryDataOnUIThread( const UpdateEntryParams& params, - scoped_ptr<DocumentEntry> entry) { + scoped_ptr<gdata::DocumentEntry> entry) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); resource_metadata_->RefreshFile( @@ -2684,10 +2689,10 @@ void DriveFileSystem::OpenFile(const FilePath& file_path, const OpenFileCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || BrowserThread::CurrentlyOn(BrowserThread::IO)); - RunTaskOnUIThread(base::Bind(&DriveFileSystem::OpenFileOnUIThread, - ui_weak_ptr_, - file_path, - CreateRelayCallback(callback))); + gdata::RunTaskOnUIThread(base::Bind(&DriveFileSystem::OpenFileOnUIThread, + ui_weak_ptr_, + file_path, + gdata::CreateRelayCallback(callback))); } void DriveFileSystem::OpenFileOnUIThread(const FilePath& file_path, @@ -2754,7 +2759,7 @@ void DriveFileSystem::OnGetEntryInfoCompleteForOpenFile( GetFileCompleteForOpenParams( entry_proto_ptr->resource_id(), entry_proto_ptr->file_specific_info().file_md5())), - GetContentCallback(), + gdata::GetContentCallback(), entry_proto.Pass()); } @@ -2816,10 +2821,10 @@ void DriveFileSystem::CloseFile(const FilePath& file_path, BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(!callback.is_null()); - RunTaskOnUIThread(base::Bind(&DriveFileSystem::CloseFileOnUIThread, - ui_weak_ptr_, - file_path, - CreateRelayCallback(callback))); + gdata::RunTaskOnUIThread(base::Bind(&DriveFileSystem::CloseFileOnUIThread, + ui_weak_ptr_, + file_path, + gdata::CreateRelayCallback(callback))); } void DriveFileSystem::CloseFileOnUIThread( @@ -2973,7 +2978,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); - util::PostBlockingPoolSequencedTaskAndReply( + gdata::util::PostBlockingPoolSequencedTaskAndReply( FROM_HERE, blocking_task_runner_, base::Bind(&GetFileInfoOnBlockingPool, @@ -3007,4 +3012,4 @@ void DriveFileSystem::CheckLocalModificationAndRunAfterGetFileInfo( callback.Run(DRIVE_FILE_OK, entry_proto.Pass()); } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/drive_file_system.h b/chrome/browser/chromeos/drive/drive_file_system.h index ca2a3af..cfd6ac7 100644 --- a/chrome/browser/chromeos/drive/drive_file_system.h +++ b/chrome/browser/chromeos/drive/drive_file_system.h @@ -26,8 +26,11 @@ class SequencedTaskRunner; } namespace gdata { - class DocumentFeed; +} + +namespace drive { + class DriveFileSystemObserver; class DriveFunctionRemove; class DriveResourceMetadata; @@ -103,11 +106,11 @@ class DriveFileSystem : public DriveFileSystemInterface, virtual void GetFileByPath( const FilePath& file_path, const GetFileCallback& get_file_callback, - const GetContentCallback& get_content_callback) OVERRIDE; + const gdata::GetContentCallback& get_content_callback) OVERRIDE; virtual void GetFileByResourceId( const std::string& resource_id, const GetFileCallback& get_file_callback, - const GetContentCallback& get_content_callback) OVERRIDE; + const gdata::GetContentCallback& get_content_callback) OVERRIDE; virtual void UpdateFileByResourceId( const std::string& resource_id, const FileOperationCallback& callback) OVERRIDE; @@ -121,15 +124,15 @@ class DriveFileSystem : public DriveFileSystemInterface, const FilePath& directory_path) OVERRIDE; virtual void GetAvailableSpace( const GetAvailableSpaceCallback& callback) OVERRIDE; - virtual void AddUploadedFile(UploadMode upload_mode, + virtual void AddUploadedFile(gdata::UploadMode upload_mode, const FilePath& directory_path, - scoped_ptr<DocumentEntry> doc_entry, + scoped_ptr<gdata::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<DocumentEntry> entry, + scoped_ptr<gdata::DocumentEntry> entry, const FilePath& file_content_path, const base::Closure& callback) OVERRIDE; @@ -152,7 +155,7 @@ class DriveFileSystem : public DriveFileSystemInterface, // Used in tests to update the file system from |feed_list|. // See also the comment at GDataWapiFeedLoader::UpdateFromFeed(). DriveFileError UpdateFromFeedForTesting( - const ScopedVector<DocumentFeed>& feed_list, + const ScopedVector<gdata::DocumentFeed>& feed_list, int64 start_changestamp, int64 root_feed_changestamp); @@ -317,7 +320,7 @@ class DriveFileSystem : public DriveFileSystemInterface, void OnGetEntryInfoCompleteForGetFileByPath( const FilePath& file_path, const GetFileCallback& get_file_callback, - const GetContentCallback& get_content_callback, + const gdata::GetContentCallback& get_content_callback, DriveFileError error, scoped_ptr<DriveEntryProto> file_info); @@ -438,23 +441,23 @@ class DriveFileSystem : public DriveFileSystemInterface, // |callback| must not be null. void OnCopyDocumentCompleted(const FilePath& dir_path, const FileOperationCallback& callback, - GDataErrorCode status, + gdata::GDataErrorCode status, scoped_ptr<base::Value> data); // Callback for handling account metadata fetch. void OnGetAvailableSpace(const GetAvailableSpaceCallback& callback, - GDataErrorCode status, + gdata::GDataErrorCode status, scoped_ptr<base::Value> data); // Callback for handling Drive V2 about resource fetch. void OnGetAboutResource(const GetAvailableSpaceCallback& callback, - GDataErrorCode status, + gdata::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, - GDataErrorCode status, + gdata::GDataErrorCode status, scoped_ptr<base::Value> created_entry); // Callback for DriveResourceMetadata::AddEntryToDirectory. Continues the @@ -466,7 +469,7 @@ class DriveFileSystem : public DriveFileSystemInterface, // Callback for handling file downloading requests. void OnFileDownloaded(const GetFileFromCacheParams& params, - GDataErrorCode status, + gdata::GDataErrorCode status, const GURL& content_url, const FilePath& downloaded_file_path); @@ -479,7 +482,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, - GDataErrorCode status, + gdata::GDataErrorCode status, const GURL& content_url, const FilePath& downloaded_file_path, bool* has_enough_space); @@ -496,7 +499,7 @@ class DriveFileSystem : public DriveFileSystemInterface, void MoveEntryToDirectory(const FilePath& file_path, const FilePath& directory_path, const FileMoveCallback& callback, - GDataErrorCode status, + gdata::GDataErrorCode status, const GURL& document_url); // Callback when an entry is moved to another directory on the client side. @@ -560,7 +563,7 @@ class DriveFileSystem : public DriveFileSystemInterface, DriveFileError error, const FilePath& drive_path, const FilePath& file_path, - scoped_ptr<DocumentEntry> document_entry); + scoped_ptr<gdata::DocumentEntry> document_entry); // Kicks off file upload once it receives |file_size| and |content_type|. void StartFileUploadOnUIThread(const StartFileUploadParams& params, @@ -592,7 +595,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, - GDataErrorCode status, + gdata::GDataErrorCode status, scoped_ptr<base::Value> data); // Check available space using file size from the fetched metadata. Called @@ -657,7 +660,7 @@ class DriveFileSystem : public DriveFileSystemInterface, void GetResolvedFileByPath( const FilePath& file_path, const GetFileCallback& get_file_callback, - const GetContentCallback& get_content_callback, + const gdata::GetContentCallback& get_content_callback, scoped_ptr<DriveEntryProto> entry_proto); // Part of UpdateFileByResourceId(). Called when @@ -698,7 +701,7 @@ class DriveFileSystem : public DriveFileSystemInterface, DriveFileError error, const FilePath& gdata_path, const FilePath& file_path, - scoped_ptr<DocumentEntry> document_entry); + scoped_ptr<gdata::DocumentEntry> document_entry); // The following functions are used to forward calls to asynchronous public // member functions to UI thread. @@ -728,11 +731,11 @@ class DriveFileSystem : public DriveFileSystemInterface, void GetFileByPathOnUIThread( const FilePath& file_path, const GetFileCallback& get_file_callback, - const GetContentCallback& get_content_callback); + const gdata::GetContentCallback& get_content_callback); void GetFileByResourceIdOnUIThread( const std::string& resource_id, const GetFileCallback& get_file_callback, - const GetContentCallback& get_content_callback); + const gdata::GetContentCallback& get_content_callback); void UpdateFileByResourceIdOnUIThread(const std::string& resource_id, const FileOperationCallback& callback); void GetEntryInfoByPathOnUIThread(const FilePath& file_path, @@ -748,14 +751,14 @@ class DriveFileSystem : public DriveFileSystemInterface, scoped_ptr<LoadFeedParams> params, DriveFileError error); void GetAvailableSpaceOnUIThread(const GetAvailableSpaceCallback& callback); - void AddUploadedFileOnUIThread(UploadMode upload_mode, + void AddUploadedFileOnUIThread(gdata::UploadMode upload_mode, const FilePath& directory_path, - scoped_ptr<DocumentEntry> doc_entry, + scoped_ptr<gdata::DocumentEntry> doc_entry, const FilePath& file_content_path, DriveCache::FileOperationType cache_operation, const base::Closure& callback); void UpdateEntryDataOnUIThread(const UpdateEntryParams& params, - scoped_ptr<DocumentEntry> entry); + scoped_ptr<gdata::DocumentEntry> entry); // Part of CreateDirectory(). Called after // FindFirstMissingParentDirectory() is complete. @@ -782,7 +785,7 @@ class DriveFileSystem : public DriveFileSystemInterface, // |get_content_callback| may be null. void GetFileByResourceIdAfterGetEntry( const GetFileCallback& get_file_callback, - const GetContentCallback& get_content_callback, + const gdata::GetContentCallback& get_content_callback, DriveFileError error, const FilePath& file_path, scoped_ptr<DriveEntryProto> entry_proto); @@ -881,6 +884,6 @@ class DriveFileSystem : public DriveFileSystemInterface, base::WeakPtr<DriveFileSystem> ui_weak_ptr_; }; -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FILE_SYSTEM_H_ diff --git a/chrome/browser/chromeos/drive/drive_file_system_interface.h b/chrome/browser/chromeos/drive/drive_file_system_interface.h index bb6b4ba..1f26b37 100644 --- a/chrome/browser/chromeos/drive/drive_file_system_interface.h +++ b/chrome/browser/chromeos/drive/drive_file_system_interface.h @@ -14,8 +14,11 @@ #include "chrome/browser/google_apis/gdata_operations.h" namespace gdata { - class DocumentEntry; +} + +namespace drive { + class DriveEntryProto; class DriveFileSystemObserver; @@ -242,7 +245,7 @@ class DriveFileSystemInterface { virtual void GetFileByPath( const FilePath& file_path, const GetFileCallback& get_file_callback, - const GetContentCallback& get_content_callback) = 0; + const gdata::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. @@ -254,7 +257,7 @@ class DriveFileSystemInterface { virtual void GetFileByResourceId( const std::string& resource_id, const GetFileCallback& get_file_callback, - const GetContentCallback& get_content_callback) = 0; + const gdata::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 @@ -327,9 +330,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(UploadMode upload_mode, + virtual void AddUploadedFile(gdata::UploadMode upload_mode, const FilePath& directory_path, - scoped_ptr<DocumentEntry> doc_entry, + scoped_ptr<gdata::DocumentEntry> doc_entry, const FilePath& file_content_path, DriveCache::FileOperationType cache_operation, const base::Closure& callback) = 0; @@ -340,11 +343,11 @@ 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<DocumentEntry> entry, + scoped_ptr<gdata::DocumentEntry> entry, const FilePath& file_content_path, const base::Closure& callback) = 0; }; -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FILE_SYSTEM_INTERFACE_H_ diff --git a/chrome/browser/chromeos/drive/drive_file_system_observer.h b/chrome/browser/chromeos/drive/drive_file_system_observer.h index 6f75643..a97f3383 100644 --- a/chrome/browser/chromeos/drive/drive_file_system_observer.h +++ b/chrome/browser/chromeos/drive/drive_file_system_observer.h @@ -9,7 +9,7 @@ class FilePath; -namespace gdata { +namespace drive { // Interface for classes that need to observe events from classes implementing // DriveFileSystemInterface. @@ -47,6 +47,6 @@ class DriveFileSystemObserver { virtual ~DriveFileSystemObserver() {} }; -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FILE_SYSTEM_OBSERVER_H_ diff --git a/chrome/browser/chromeos/drive/drive_file_system_proxy.cc b/chrome/browser/chromeos/drive/drive_file_system_proxy.cc index 7d8a123..da8fce6 100644 --- a/chrome/browser/chromeos/drive/drive_file_system_proxy.cc +++ b/chrome/browser/chromeos/drive/drive_file_system_proxy.cc @@ -29,7 +29,7 @@ using fileapi::FileSystemURL; using fileapi::FileSystemOperation; using webkit_blob::ShareableFileReference; -namespace gdata { +namespace drive { namespace { @@ -521,7 +521,7 @@ void DriveFileSystemProxy::OpenFile( callback, file_flags, peer_handle), - GetContentCallback()); + gdata::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), - GetContentCallback()); + gdata::GetContentCallback()); } void DriveFileSystemProxy::CreateWritableSnapshotFile( @@ -751,4 +751,4 @@ void DriveFileSystemProxy::CloseWritableSnapshotFile( base::Bind(&EmitDebugLogForCloseFile, virtual_path)); } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/drive_file_system_proxy.h b/chrome/browser/chromeos/drive/drive_file_system_proxy.h index acb309c..6961bdb 100644 --- a/chrome/browser/chromeos/drive/drive_file_system_proxy.h +++ b/chrome/browser/chromeos/drive/drive_file_system_proxy.h @@ -12,7 +12,7 @@ namespace fileapi { class FileSystemURL; } -namespace gdata { +namespace drive { class DriveEntryProto; class DriveFileSystemInterface; diff --git a/chrome/browser/chromeos/drive/drive_file_system_unittest.cc b/chrome/browser/chromeos/drive/drive_file_system_unittest.cc index b9a5e01..8c2cc24 100644 --- a/chrome/browser/chromeos/drive/drive_file_system_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_file_system_unittest.cc @@ -46,7 +46,7 @@ using ::testing::Return; using ::testing::StrictMock; using ::testing::_; -namespace gdata { +namespace drive { namespace { const char kSymLinkToDevNull[] = "/dev/null"; @@ -91,7 +91,7 @@ ACTION_P2(MockGetDocumentEntry, status, value) { // DriveUploaderInterface::UploadExistingFile(). ACTION_P4(MockUploadExistingFile, error, drive_path, local_file_path, document_entry) { - scoped_ptr<DocumentEntry> scoped_document_entry(document_entry); + scoped_ptr<gdata::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 = - test_util::LoadJSONFile("gdata/uploaded_file.json"); - scoped_ptr<DocumentEntry> document_entry( - DocumentEntry::ExtractAndParse(*value)); + gdata::test_util::LoadJSONFile("gdata/uploaded_file.json"); + scoped_ptr<gdata::DocumentEntry> document_entry( + gdata::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(); - test_util::RunBlockingPoolTask(); + gdata::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. - test_util::RunBlockingPoolTask(); + gdata::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 = test_util::LoadJSONFile(filename); + scoped_ptr<Value> atom = gdata::test_util::LoadJSONFile(filename); ASSERT_TRUE(atom.get()); ASSERT_TRUE(atom->GetType() == Value::TYPE_DICTIONARY); @@ -262,8 +262,8 @@ class DriveFileSystemTest : public testing::Test { false, // is_exclusive false, // is_recursive base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error)); - file_system_->AddNewDirectory(params, HTTP_SUCCESS, atom.Pass()); - test_util::RunBlockingPoolTask(); + file_system_->AddNewDirectory(params, gdata::HTTP_SUCCESS, atom.Pass()); + gdata::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); } @@ -274,7 +274,7 @@ class DriveFileSystemTest : public testing::Test { file_path, false, base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error)); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); return error == DRIVE_FILE_OK; } @@ -293,7 +293,7 @@ class DriveFileSystemTest : public testing::Test { file_path, base::Bind(&CallbackHelper::GetEntryInfoCallback, callback_helper_.get())); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); return callback_helper_->entry_proto_.Pass(); } @@ -305,7 +305,7 @@ class DriveFileSystemTest : public testing::Test { file_path, base::Bind(&CallbackHelper::ReadDirectoryCallback, callback_helper_.get())); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); return callback_helper_->directory_entries_.Pass(); } @@ -339,7 +339,7 @@ class DriveFileSystemTest : public testing::Test { md5, cache_entry, &result)); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); return result; } @@ -387,7 +387,7 @@ class DriveFileSystemTest : public testing::Test { base::Bind(&DriveFileSystemTest::VerifyCacheFileState, base::Unretained(this))); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); } void TestPin( @@ -405,7 +405,7 @@ class DriveFileSystemTest : public testing::Test { base::Bind(&DriveFileSystemTest::VerifyCacheFileState, base::Unretained(this))); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); } void TestMarkDirty( @@ -427,7 +427,7 @@ class DriveFileSystemTest : public testing::Test { resource_id, md5)); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); } void VerifyMarkDirty(const std::string& resource_id, @@ -464,7 +464,7 @@ class DriveFileSystemTest : public testing::Test { base::Bind(&DriveFileSystemTest::VerifyCacheFileState, base::Unretained(this))); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); } // Verify the file identified by |resource_id| and |md5| is in the expected @@ -589,7 +589,7 @@ class DriveFileSystemTest : public testing::Test { // filesystem has a root at 'drive' void TestLoadMetadataFromCache() { file_system_->LoadRootFeedFromCacheForTesting(); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); } // Creates a proto file representing a filesystem with directories: @@ -1175,7 +1175,7 @@ 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( - test_util::LoadJSONFile("gdata/account_metadata.json").release()); + gdata::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 +1187,12 @@ 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( - test_util::LoadJSONFile("gdata/account_metadata.json").release()); + gdata::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(); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); } TEST_F(DriveFileSystemTest, TransferFileFromLocalToRemote_RegularFile) { @@ -1221,9 +1221,9 @@ TEST_F(DriveFileSystemTest, TransferFileFromLocalToRemote_RegularFile) { EXPECT_FALSE(EntryExists(remote_dest_file_path)); scoped_ptr<base::Value> value = - test_util::LoadJSONFile("gdata/document_to_download.json"); - scoped_ptr<DocumentEntry> document_entry( - DocumentEntry::ExtractAndParse(*value)); + gdata::test_util::LoadJSONFile("gdata/document_to_download.json"); + scoped_ptr<gdata::DocumentEntry> document_entry( + gdata::DocumentEntry::ExtractAndParse(*value)); EXPECT_CALL(*mock_uploader_, UploadNewFile(_, _, _, _, _, _, _, _, _)) .WillOnce(MockUploadNewFile()); @@ -1231,7 +1231,7 @@ TEST_F(DriveFileSystemTest, TransferFileFromLocalToRemote_RegularFile) { // Transfer the local file to Drive. file_system_->TransferFileFromLocalToRemote( local_src_file_path, remote_dest_file_path, callback); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); @@ -1267,7 +1267,7 @@ 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 = - test_util::LoadJSONFile("gdata/uploaded_document.json"); + gdata::test_util::LoadJSONFile("gdata/uploaded_document.json"); EXPECT_CALL(*mock_drive_service_, CopyDocument(kResourceId, FILE_PATH_LITERAL("Document 1"), @@ -1284,7 +1284,7 @@ TEST_F(DriveFileSystemTest, TransferFileFromLocalToRemote_HostedDocument) { // Transfer the local file to Drive. file_system_->TransferFileFromLocalToRemote( local_src_file_path, remote_dest_file_path, callback); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); @@ -1321,7 +1321,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 = - test_util::LoadJSONFile("gdata/document_to_download.json"); + gdata::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 +1334,7 @@ TEST_F(DriveFileSystemTest, TransferFileFromRemoteToLocal_RegularFile) { file_system_->TransferFileFromRemoteToLocal( remote_src_file_path, local_dest_file_path, callback); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); @@ -1361,7 +1361,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); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); @@ -1384,7 +1384,7 @@ TEST_F(DriveFileSystemTest, CopyNotExistingFile) { callback_helper_.get()); file_system_->Copy(src_file_path, dest_file_path, callback); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_); EXPECT_FALSE(EntryExists(src_file_path)); @@ -1413,7 +1413,7 @@ TEST_F(DriveFileSystemTest, CopyFileToNonExistingDirectory) { callback_helper_.get()); file_system_->Move(src_file_path, dest_file_path, callback); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_); EXPECT_TRUE(EntryExists(src_file_path)); @@ -1449,7 +1449,7 @@ TEST_F(DriveFileSystemTest, CopyFileToInvalidPath) { callback_helper_.get()); file_system_->Copy(src_file_path, dest_file_path, callback); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_A_DIRECTORY, callback_helper_->last_error_); @@ -1488,7 +1488,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); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); EXPECT_FALSE(EntryExists(src_file_path)); @@ -1537,7 +1537,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); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); EXPECT_FALSE(EntryExists(src_file_path)); @@ -1588,7 +1588,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); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); EXPECT_FALSE(EntryExists(src_file_path)); @@ -1663,7 +1663,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); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); EXPECT_FALSE(EntryExists(src_file_path)); @@ -1687,7 +1687,7 @@ TEST_F(DriveFileSystemTest, MoveNotExistingFile) { callback_helper_.get()); file_system_->Move(src_file_path, dest_file_path, callback); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_); EXPECT_FALSE(EntryExists(src_file_path)); @@ -1716,7 +1716,7 @@ TEST_F(DriveFileSystemTest, MoveFileToNonExistingDirectory) { callback_helper_.get()); file_system_->Move(src_file_path, dest_file_path, callback); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_); @@ -1752,7 +1752,7 @@ TEST_F(DriveFileSystemTest, MoveFileToInvalidPath) { callback_helper_.get()); file_system_->Move(src_file_path, dest_file_path, callback); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_A_DIRECTORY, callback_helper_->last_error_); @@ -1812,7 +1812,7 @@ TEST_F(DriveFileSystemTest, RemoveEntries) { EXPECT_FALSE(RemoveEntry(FilePath(FILE_PATH_LITERAL("drive")))); // Need this to ensure OnDirectoryChanged() is run. - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); } TEST_F(DriveFileSystemTest, CreateDirectory) { @@ -1848,7 +1848,7 @@ TEST_F(DriveFileSystemTest, FindFirstMissingParentDirectory) { dir_path, base::Bind(&CopyResultFromFindFirstMissingParentDirectory, &result)); - test_util::RunBlockingPoolTask(); + gdata::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 +1860,7 @@ TEST_F(DriveFileSystemTest, FindFirstMissingParentDirectory) { dir_path2, base::Bind(&CopyResultFromFindFirstMissingParentDirectory, &result)); - test_util::RunBlockingPoolTask(); + gdata::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 +1872,7 @@ TEST_F(DriveFileSystemTest, FindFirstMissingParentDirectory) { dir_path3, base::Bind(&CopyResultFromFindFirstMissingParentDirectory, &result)); - test_util::RunBlockingPoolTask(); + gdata::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 +1883,7 @@ TEST_F(DriveFileSystemTest, FindFirstMissingParentDirectory) { FilePath(FILE_PATH_LITERAL("drive/File 1.txt/BadDir")), base::Bind(&CopyResultFromFindFirstMissingParentDirectory, &result)); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); EXPECT_EQ(DriveFileSystem::FIND_FIRST_FOUND_INVALID, result.error); // Existing folder. @@ -1891,7 +1891,7 @@ TEST_F(DriveFileSystemTest, FindFirstMissingParentDirectory) { FilePath(FILE_PATH_LITERAL("drive/Directory 1")), base::Bind(&CopyResultFromFindFirstMissingParentDirectory, &result)); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); EXPECT_EQ(DriveFileSystem::FIND_FIRST_DIRECTORY_ALREADY_PRESENT, result.error); } @@ -1912,7 +1912,7 @@ TEST_F(DriveFileSystemTest, CreateDirectoryWithService) { true, // is_recursive base::Bind(&CallbackHelper::FileOperationCallback, callback_helper_.get())); - test_util::RunBlockingPoolTask(); + gdata::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 +1939,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 = - test_util::LoadJSONFile("gdata/document_to_download.json"); + gdata::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 +1951,8 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_EnoughSpace) { .Times(1); file_system_->GetFileByPath(file_in_root, callback, - GetContentCallback()); - test_util::RunBlockingPoolTask(); + gdata::GetContentCallback()); + gdata::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); EXPECT_EQ(REGULAR_FILE, callback_helper_->file_type_); @@ -1980,7 +1980,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 = - test_util::LoadJSONFile("gdata/document_to_download.json"); + gdata::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 +1992,8 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_NoSpaceAtAll) { .Times(0); file_system_->GetFileByPath(file_in_root, callback, - GetContentCallback()); - test_util::RunBlockingPoolTask(); + gdata::GetContentCallback()); + gdata::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NO_SPACE, callback_helper_->last_error_); @@ -2025,7 +2025,7 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_NoEnoughSpaceButCanFreeUp) { // Store something in the temporary cache directory. TestStoreToCache("<resource_id>", "<md5>", - test_util::GetTestFilePath("gdata/root_feed.json"), + gdata::test_util::GetTestFilePath("gdata/root_feed.json"), DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); @@ -2035,7 +2035,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 = - test_util::LoadJSONFile("gdata/document_to_download.json"); + gdata::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 +2048,8 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_NoEnoughSpaceButCanFreeUp) { .Times(1); file_system_->GetFileByPath(file_in_root, callback, - GetContentCallback()); - test_util::RunBlockingPoolTask(); + gdata::GetContentCallback()); + gdata::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); EXPECT_EQ(REGULAR_FILE, callback_helper_->file_type_); @@ -2088,7 +2088,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 = - test_util::LoadJSONFile("gdata/document_to_download.json"); + gdata::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 +2100,8 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_EnoughSpaceButBecomeFull) { .Times(1); file_system_->GetFileByPath(file_in_root, callback, - GetContentCallback()); - test_util::RunBlockingPoolTask(); + gdata::GetContentCallback()); + gdata::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NO_SPACE, callback_helper_->last_error_); @@ -2126,7 +2126,7 @@ 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(), - test_util::GetTestFilePath("gdata/root_feed.json"), + gdata::test_util::GetTestFilePath("gdata/root_feed.json"), DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); @@ -2143,8 +2143,8 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromCache) { .Times(0); file_system_->GetFileByPath(file_in_root, callback, - GetContentCallback()); - test_util::RunBlockingPoolTask(); + gdata::GetContentCallback()); + gdata::test_util::RunBlockingPoolTask(); EXPECT_EQ(REGULAR_FILE, callback_helper_->file_type_); EXPECT_EQ(downloaded_file.value(), @@ -2164,8 +2164,8 @@ TEST_F(DriveFileSystemTest, GetFileByPath_HostedDocument) { ASSERT_TRUE(src_entry_proto.get()); file_system_->GetFileByPath(file_in_root, callback, - GetContentCallback()); - test_util::RunBlockingPoolTask(); + gdata::GetContentCallback()); + gdata::test_util::RunBlockingPoolTask(); EXPECT_EQ(HOSTED_DOCUMENT, callback_helper_->file_type_); EXPECT_FALSE(callback_helper_->download_path_.empty()); @@ -2194,7 +2194,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 = - test_util::LoadJSONFile("gdata/document_to_download.json"); + gdata::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 +2208,8 @@ TEST_F(DriveFileSystemTest, GetFileByResourceId) { file_system_->GetFileByResourceId(entry_proto->resource_id(), callback, - GetContentCallback()); - test_util::RunBlockingPoolTask(); + gdata::GetContentCallback()); + gdata::test_util::RunBlockingPoolTask(); EXPECT_EQ(REGULAR_FILE, callback_helper_->file_type_); EXPECT_EQ(downloaded_file.value(), @@ -2235,7 +2235,7 @@ 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(), - test_util::GetTestFilePath("gdata/root_feed.json"), + gdata::test_util::GetTestFilePath("gdata/root_feed.json"), DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); @@ -2247,8 +2247,8 @@ TEST_F(DriveFileSystemTest, GetFileByResourceId_FromCache) { file_system_->GetFileByResourceId(entry_proto->resource_id(), callback, - GetContentCallback()); - test_util::RunBlockingPoolTask(); + gdata::GetContentCallback()); + gdata::test_util::RunBlockingPoolTask(); EXPECT_EQ(REGULAR_FILE, callback_helper_->file_type_); EXPECT_EQ(downloaded_file.value(), @@ -2283,7 +2283,7 @@ TEST_F(DriveFileSystemTest, UpdateFileByResourceId_PersistentFile) { TestStoreToCache(kResourceId, kMd5, // Anything works. - test_util::GetTestFilePath("gdata/root_feed.json"), + gdata::test_util::GetTestFilePath("gdata/root_feed.json"), DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_PINNED | @@ -2333,12 +2333,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 DocumentEntry, which is needed to mock + // Create a gdata::DocumentEntry, which is needed to mock // DriveUploaderInterface::UploadExistingFile(). // TODO(satorux): This should be cleaned up. crbug.com/134240. - DocumentEntry* document_entry = NULL; + gdata::DocumentEntry* document_entry = NULL; scoped_ptr<base::Value> value = - test_util::LoadJSONFile("gdata/root_feed.json"); + gdata::test_util::LoadJSONFile("gdata/root_feed.json"); ASSERT_TRUE(value.get()); base::DictionaryValue* as_dict = NULL; base::ListValue* entry_list = NULL; @@ -2351,7 +2351,7 @@ TEST_F(DriveFileSystemTest, UpdateFileByResourceId_PersistentFile) { entry->GetString("gd$resourceId.$t", &resource_id) && resource_id == kResourceId) { // This will be deleted by UploadExistingFile(). - document_entry = DocumentEntry::CreateFrom(*entry); + document_entry = gdata::DocumentEntry::CreateFrom(*entry); } } } @@ -2390,7 +2390,7 @@ TEST_F(DriveFileSystemTest, UpdateFileByResourceId_PersistentFile) { const int num_files_in_root = CountFiles(*root_directory_entries); file_system_->UpdateFileByResourceId(kResourceId, callback); - test_util::RunBlockingPoolTask(); + gdata::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 +2417,7 @@ TEST_F(DriveFileSystemTest, UpdateFileByResourceId_NonexistentFile) { callback_helper_.get()); file_system_->UpdateFileByResourceId(kResourceId, callback); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_); } @@ -2499,7 +2499,7 @@ TEST_F(DriveFileSystemTest, GetAvailableSpace) { EXPECT_CALL(*mock_drive_service_, GetAccountMetadata(_)); file_system_->GetAvailableSpace(callback); - test_util::RunBlockingPoolTask(); + gdata::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 +2516,7 @@ TEST_F(DriveFileSystemTest, RequestDirectoryRefresh) { OnDirectoryChanged(Eq(FilePath(kDriveRootDirectory)))).Times(1); file_system_->RequestDirectoryRefresh(FilePath(kDriveRootDirectory)); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); } TEST_F(DriveFileSystemTest, OpenAndCloseFile) { @@ -2553,7 +2553,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 = - test_util::LoadJSONFile("gdata/document_to_download.json"); + gdata::test_util::LoadJSONFile("gdata/document_to_download.json"); SetExpectationsForGetDocumentEntry(&document, "file:2_file_resource_id"); // The file is obtained with the mock DriveService. @@ -2610,4 +2610,4 @@ TEST_F(DriveFileSystemTest, OpenAndCloseFile) { EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_); } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/drive_file_system_util.cc b/chrome/browser/chromeos/drive/drive_file_system_util.cc index 9672358..909ce6e 100644 --- a/chrome/browser/chromeos/drive/drive_file_system_util.cc +++ b/chrome/browser/chromeos/drive/drive_file_system_util.cc @@ -34,7 +34,7 @@ using content::BrowserThread; -namespace gdata { +namespace drive { namespace util { namespace { @@ -418,23 +418,23 @@ void EnsureDirectoryExists(Profile* profile, } } -DriveFileError GDataToDriveFileError(GDataErrorCode status) { +DriveFileError GDataToDriveFileError(gdata::GDataErrorCode status) { switch (status) { - case HTTP_SUCCESS: - case HTTP_CREATED: + case gdata::HTTP_SUCCESS: + case gdata::HTTP_CREATED: return DRIVE_FILE_OK; - case HTTP_UNAUTHORIZED: - case HTTP_FORBIDDEN: + case gdata::HTTP_UNAUTHORIZED: + case gdata::HTTP_FORBIDDEN: return DRIVE_FILE_ERROR_ACCESS_DENIED; - case HTTP_NOT_FOUND: + case gdata::HTTP_NOT_FOUND: return DRIVE_FILE_ERROR_NOT_FOUND; - case GDATA_PARSE_ERROR: - case GDATA_FILE_ERROR: + case gdata::GDATA_PARSE_ERROR: + case gdata::GDATA_FILE_ERROR: return DRIVE_FILE_ERROR_ABORT; - case GDATA_NO_CONNECTION: + case gdata::GDATA_NO_CONNECTION: return DRIVE_FILE_ERROR_NO_CONNECTION; - case HTTP_SERVICE_UNAVAILABLE: - case HTTP_INTERNAL_SERVER_ERROR: + case gdata::HTTP_SERVICE_UNAVAILABLE: + case gdata::HTTP_INTERNAL_SERVER_ERROR: return DRIVE_FILE_ERROR_THROTTLED; default: return DRIVE_FILE_ERROR_FAILED; @@ -462,4 +462,4 @@ bool IsConnectionTypeCellular() { } } // namespace util -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/drive_file_system_util.h b/chrome/browser/chromeos/drive/drive_file_system_util.h index 9c59727..a334499 100644 --- a/chrome/browser/chromeos/drive/drive_file_system_util.h +++ b/chrome/browser/chromeos/drive/drive_file_system_util.h @@ -18,7 +18,7 @@ class FilePath; class Profile; -namespace gdata { +namespace drive { namespace util { // Path constants. @@ -131,12 +131,12 @@ void EnsureDirectoryExists(Profile* profile, const FileOperationCallback& callback); // Converts GData error code into file platform error code. -DriveFileError GDataToDriveFileError(GDataErrorCode status); +DriveFileError GDataToDriveFileError(gdata::GDataErrorCode status); // Returns true if the curernt network connection is over cellular. bool IsConnectionTypeCellular(); } // namespace util -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FILE_SYSTEM_UTIL_H_ diff --git a/chrome/browser/chromeos/drive/drive_file_system_util_unittest.cc b/chrome/browser/chromeos/drive/drive_file_system_util_unittest.cc index 99a396a..73baf0e 100644 --- a/chrome/browser/chromeos/drive/drive_file_system_util_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_file_system_util_unittest.cc @@ -7,7 +7,7 @@ #include "base/file_path.h" #include "testing/gtest/include/gtest/gtest.h" -namespace gdata { +namespace drive { namespace util { TEST(DriveFileSystemUtilTest, IsUnderDriveMountPoint) { @@ -111,4 +111,4 @@ TEST(DriveFileSystemUtilTest, ParseCacheFilePath) { } } // namespace util -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/drive_files.cc b/chrome/browser/chromeos/drive/drive_files.cc index e1e8359..da66504 100644 --- a/chrome/browser/chromeos/drive/drive_files.cc +++ b/chrome/browser/chromeos/drive/drive_files.cc @@ -14,7 +14,7 @@ #include "chrome/browser/google_apis/gdata_wapi_parser.h" #include "net/base/escape.h" -namespace gdata { +namespace drive { // DriveEntry class. @@ -36,7 +36,7 @@ DriveDirectory* DriveEntry::AsDriveDirectory() { return NULL; } -void DriveEntry::InitFromDocumentEntry(const DocumentEntry& doc) { +void DriveEntry::InitFromDocumentEntry(const gdata::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,11 @@ void DriveEntry::InitFromDocumentEntry(const DocumentEntry& doc) { content_url_ = doc.content_url(); deleted_ = doc.deleted(); - const Link* edit_link = doc.GetLinkByType(Link::LINK_EDIT); + const gdata::Link* edit_link = doc.GetLinkByType(gdata::Link::LINK_EDIT); if (edit_link) edit_url_ = edit_link->href(); - const Link* parent_link = doc.GetLinkByType(Link::LINK_PARENT); + const gdata::Link* parent_link = doc.GetLinkByType(gdata::Link::LINK_PARENT); if (parent_link) parent_resource_id_ = util::ExtractResourceIdFromUrl(parent_link->href()); } @@ -96,7 +96,7 @@ void DriveEntry::SetBaseNameFromTitle() { DriveFile::DriveFile(DriveResourceMetadata* resource_metadata) : DriveEntry(resource_metadata), - kind_(ENTRY_KIND_UNKNOWN), + kind_(gdata::ENTRY_KIND_UNKNOWN), is_hosted_document_(false) { file_info_.is_directory = false; } @@ -116,7 +116,7 @@ void DriveFile::SetBaseNameFromTitle() { } } -void DriveFile::InitFromDocumentEntry(const DocumentEntry& doc) { +void DriveFile::InitFromDocumentEntry(const gdata::DocumentEntry& doc) { DriveEntry::InitFromDocumentEntry(doc); // Check if this entry is a true file, or... @@ -126,8 +126,8 @@ void DriveFile::InitFromDocumentEntry(const DocumentEntry& doc) { // The resumable-edit-media link should only be present for regular // files as hosted documents are not uploadable. - const Link* upload_link = - doc.GetLinkByType(Link::LINK_RESUMABLE_EDIT_MEDIA); + const gdata::Link* upload_link = + doc.GetLinkByType(gdata::Link::LINK_RESUMABLE_EDIT_MEDIA); if (upload_link) upload_url_ = upload_link->href(); } else { @@ -148,11 +148,13 @@ void DriveFile::InitFromDocumentEntry(const DocumentEntry& doc) { // |is_hosted_document_| and |document_extension_| are set. SetBaseNameFromTitle(); - const Link* thumbnail_link = doc.GetLinkByType(Link::LINK_THUMBNAIL); + const gdata::Link* thumbnail_link = doc.GetLinkByType( + gdata::Link::LINK_THUMBNAIL); if (thumbnail_link) thumbnail_url_ = thumbnail_link->href(); - const Link* alternate_link = doc.GetLinkByType(Link::LINK_ALTERNATE); + const gdata::Link* alternate_link = doc.GetLinkByType( + gdata::Link::LINK_ALTERNATE); if (alternate_link) alternate_url_ = alternate_link->href(); } @@ -172,11 +174,11 @@ DriveDirectory* DriveDirectory::AsDriveDirectory() { return this; } -void DriveDirectory::InitFromDocumentEntry(const DocumentEntry& doc) { +void DriveDirectory::InitFromDocumentEntry(const gdata::DocumentEntry& doc) { DriveEntry::InitFromDocumentEntry(doc); - const Link* upload_link = - doc.GetLinkByType(Link::LINK_RESUMABLE_CREATE_MEDIA); + const gdata::Link* upload_link = + doc.GetLinkByType(gdata::Link::LINK_RESUMABLE_CREATE_MEDIA); if (upload_link) upload_url_ = upload_link->href(); } @@ -503,4 +505,4 @@ void DriveEntry::SerializeToString(std::string* serialized_proto) const { } } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/drive_files.h b/chrome/browser/chromeos/drive/drive_files.h index fe3bdb6..c14ba15 100644 --- a/chrome/browser/chromeos/drive/drive_files.h +++ b/chrome/browser/chromeos/drive/drive_files.h @@ -17,7 +17,7 @@ #include "chrome/browser/chromeos/drive/drive.pb.h" #include "chrome/browser/google_apis/gdata_wapi_parser.h" -namespace gdata { +namespace drive { class DriveDirectory; class DriveDirectoryProto; @@ -40,8 +40,8 @@ class DriveEntry { virtual DriveFile* AsDriveFile(); virtual DriveDirectory* AsDriveDirectory(); - // Initializes from DocumentEntry. - virtual void InitFromDocumentEntry(const DocumentEntry& doc); + // Initializes from gdata::DocumentEntry. + virtual void InitFromDocumentEntry(const gdata::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; - DriveEntryKind kind() const { return kind_; } + gdata::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,12 @@ class DriveFile : public DriveEntry { friend class DriveResourceMetadata; // For access to ctor. explicit DriveFile(DriveResourceMetadata* resource_metadata); - // Initializes from DocumentEntry. - virtual void InitFromDocumentEntry(const DocumentEntry& doc) OVERRIDE; + // Initializes from gdata::DocumentEntry. + virtual void InitFromDocumentEntry(const gdata::DocumentEntry& doc) OVERRIDE; virtual DriveFile* AsDriveFile() OVERRIDE; - DriveEntryKind kind_; // Not saved in proto. + gdata::DriveEntryKind kind_; // Not saved in proto. GURL thumbnail_url_; GURL alternate_url_; std::string content_mime_type_; @@ -227,8 +227,8 @@ class DriveDirectory : public DriveEntry { explicit DriveDirectory(DriveResourceMetadata* resource_metadata); - // Initializes from DocumentEntry. - virtual void InitFromDocumentEntry(const DocumentEntry& doc) OVERRIDE; + // Initializes from gdata::DocumentEntry. + virtual void InitFromDocumentEntry(const gdata::DocumentEntry& doc) OVERRIDE; virtual DriveDirectory* AsDriveDirectory() OVERRIDE; @@ -276,6 +276,6 @@ class DriveDirectory : public DriveEntry { DISALLOW_COPY_AND_ASSIGN(DriveDirectory); }; -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FILES_H_ diff --git a/chrome/browser/chromeos/drive/drive_protocol_handler.cc b/chrome/browser/chromeos/drive/drive_protocol_handler.cc index 5e36459..3582c2d 100644 --- a/chrome/browser/chromeos/drive/drive_protocol_handler.cc +++ b/chrome/browser/chromeos/drive/drive_protocol_handler.cc @@ -38,7 +38,7 @@ using content::BrowserThread; -namespace gdata { +namespace drive { namespace { @@ -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(GDataErrorCode error, + void OnUrlFetchDownloadData(gdata::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,7 +261,7 @@ 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 - // GetContentCallback - this would either get it from cache or + // gdata::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 @@ -271,9 +271,9 @@ void DriveURLRequestJob::Start() { // 7.2) gdata::DownloadFileOperation overrides the default implementations // of the following methods of net::URLFetcherDelegate: // - ShouldSendDownloadData(): returns true for non-null - // GetContentCallback. + // gdata::GetContentCallback. // - OnURLFetchDownloadData(): invokes non-null - // GetContentCallback + // gdata::GetContentCallback // 7.3) DriveProtolHandler::OnURLFetchDownloadData (i.e. this class) // is at the end of the invocation chain and actually implements the // method. @@ -537,7 +537,7 @@ void DriveURLRequestJob::OnGetEntryInfoByResourceId( } void DriveURLRequestJob::OnUrlFetchDownloadData( - GDataErrorCode error, + gdata::GDataErrorCode error, scoped_ptr<std::string> download_data) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); @@ -940,4 +940,4 @@ net::URLRequestJob* DriveProtocolHandler::MaybeCreateJob( return new DriveURLRequestJob(request, network_delegate); } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/drive_protocol_handler.h b/chrome/browser/chromeos/drive/drive_protocol_handler.h index 31d71d7..4fed474 100644 --- a/chrome/browser/chromeos/drive/drive_protocol_handler.h +++ b/chrome/browser/chromeos/drive/drive_protocol_handler.h @@ -7,7 +7,7 @@ #include "net/url_request/url_request_job_factory.h" -namespace gdata { +namespace drive { class DriveProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler { public: @@ -19,6 +19,6 @@ class DriveProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler { net::NetworkDelegate* network_delegate) const OVERRIDE; }; -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_PROTOCOL_HANDLER_H_ diff --git a/chrome/browser/chromeos/drive/drive_resource_metadata.cc b/chrome/browser/chromeos/drive/drive_resource_metadata.cc index fed813c..fa144cc 100644 --- a/chrome/browser/chromeos/drive/drive_resource_metadata.cc +++ b/chrome/browser/chromeos/drive/drive_resource_metadata.cc @@ -19,7 +19,7 @@ using content::BrowserThread; -namespace gdata { +namespace drive { namespace { // m: prefix for filesystem metadata db keys, version and largest_changestamp. @@ -186,7 +186,7 @@ DriveResourceMetadata::DriveResourceMetadata() origin_(UNINITIALIZED), ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { root_ = CreateDriveDirectory().Pass(); - if (!util::IsDriveV2ApiEnabled()) + if (!gdata::util::IsDriveV2ApiEnabled()) InitializeRootEntry(kDriveRootDirectoryResourceId); } @@ -200,7 +200,7 @@ DriveResourceMetadata::~DriveResourceMetadata() { } scoped_ptr<DriveEntry> DriveResourceMetadata::FromDocumentEntry( - const DocumentEntry& doc) { + const gdata::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<DocumentEntry> doc_entry, + scoped_ptr<gdata::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<DocumentEntry> doc_entry, + scoped_ptr<gdata::DocumentEntry> doc_entry, const GetEntryInfoWithFilePathCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -871,4 +871,4 @@ void DriveResourceMetadata::GetEntryInfoPairByPathsAfterGetSecond( callback.Run(result.Pass()); } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/drive_resource_metadata.h b/chrome/browser/chromeos/drive/drive_resource_metadata.h index c8a013e..6c34395 100644 --- a/chrome/browser/chromeos/drive/drive_resource_metadata.h +++ b/chrome/browser/chromeos/drive/drive_resource_metadata.h @@ -21,9 +21,12 @@ class SequencedTaskRunner; } namespace gdata { +class DocumentEntry; +} + +namespace drive { struct CreateDBParams; -class DocumentEntry; class DriveDirectory; class DriveEntry; class DriveEntryProto; @@ -148,8 +151,8 @@ class DriveResourceMetadata { ContentOrigin origin() const { return origin_; } void set_origin(ContentOrigin value) { origin_ = value; } - // Creates a DriveEntry from a DocumentEntry. - scoped_ptr<DriveEntry> FromDocumentEntry(const DocumentEntry& doc); + // Creates a DriveEntry from a gdata::DocumentEntry. + scoped_ptr<DriveEntry> FromDocumentEntry(const gdata::DocumentEntry& doc); // Creates a DriveFile instance. scoped_ptr<DriveFile> CreateDriveFile(); @@ -164,7 +167,7 @@ class DriveResourceMetadata { // callback asynchronously. // |callback| must not be null. void AddEntryToDirectory(const FilePath& directory_path, - scoped_ptr<DocumentEntry> doc_entry, + scoped_ptr<gdata::DocumentEntry> doc_entry, const FileMoveCallback& callback); // Moves entry specified by |file_path| to the directory specified by @@ -238,7 +241,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<DocumentEntry> doc_entry, + void RefreshFile(scoped_ptr<gdata::DocumentEntry> doc_entry, const GetEntryInfoWithFilePathCallback& callback); // Removes all child files of |directory| and replace with file_map. @@ -315,6 +318,6 @@ class DriveResourceMetadata { DISALLOW_COPY_AND_ASSIGN(DriveResourceMetadata); }; -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_RESOURCE_METADATA_H_ diff --git a/chrome/browser/chromeos/drive/drive_resource_metadata_unittest.cc b/chrome/browser/chromeos/drive/drive_resource_metadata_unittest.cc index a5c77f3..45300dd 100644 --- a/chrome/browser/chromeos/drive/drive_resource_metadata_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_resource_metadata_unittest.cc @@ -21,7 +21,7 @@ #include "content/public/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" -namespace gdata { +namespace drive { namespace { // See drive.proto for the difference between the two URLs. @@ -181,7 +181,7 @@ TEST_F(DriveResourceMetadataTest, GetEntryInfoByResourceId) { "file_resource_id:file4", base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback, &error, &drive_file_path, &entry_proto)); - test_util::RunBlockingPoolTask(); + gdata::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)); - test_util::RunBlockingPoolTask(); + gdata::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)); - test_util::RunBlockingPoolTask(); + gdata::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)); - test_util::RunBlockingPoolTask(); + gdata::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)); - test_util::RunBlockingPoolTask(); + gdata::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)); - test_util::RunBlockingPoolTask(); + gdata::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)); - test_util::RunBlockingPoolTask(); + gdata::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)); - test_util::RunBlockingPoolTask(); + gdata::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)); - test_util::RunBlockingPoolTask(); + gdata::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)); - test_util::RunBlockingPoolTask(); + gdata::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)); - test_util::RunBlockingPoolTask(); + gdata::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(); - test_util::RunBlockingPoolTask(); + gdata::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)); - test_util::RunBlockingPoolTask(); + gdata::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)); - test_util::RunBlockingPoolTask(); + gdata::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)); - test_util::RunBlockingPoolTask(); + gdata::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)); - test_util::RunBlockingPoolTask(); + gdata::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)); - test_util::RunBlockingPoolTask(); + gdata::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)); - test_util::RunBlockingPoolTask(); + gdata::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)); - test_util::RunBlockingPoolTask(); + gdata::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)); - test_util::RunBlockingPoolTask(); + gdata::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)); - test_util::RunBlockingPoolTask(); + gdata::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)); - test_util::RunBlockingPoolTask(); + gdata::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)); - test_util::RunBlockingPoolTask(); + gdata::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)); - test_util::RunBlockingPoolTask(); + gdata::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)); - test_util::RunBlockingPoolTask(); + gdata::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)); - test_util::RunBlockingPoolTask(); + gdata::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)); - test_util::RunBlockingPoolTask(); + gdata::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)); - test_util::RunBlockingPoolTask(); + gdata::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)); - test_util::RunBlockingPoolTask(); + gdata::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)); - test_util::RunBlockingPoolTask(); + gdata::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)); - test_util::RunBlockingPoolTask(); + gdata::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)); - test_util::RunBlockingPoolTask(); + gdata::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)); - test_util::RunBlockingPoolTask(); + gdata::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)); - test_util::RunBlockingPoolTask(); + gdata::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)); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_EXISTS, error); EXPECT_EQ(FilePath(), drive_file_path); @@ -592,9 +592,9 @@ TEST_F(DriveResourceMetadataTest, RenameEntry) { "file11", base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); EXPECT_EQ(FilePath(), drive_file_path); } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/drive_scheduler.cc b/chrome/browser/chromeos/drive/drive_scheduler.cc index 0116ef6..1ab83e7 100644 --- a/chrome/browser/chromeos/drive/drive_scheduler.cc +++ b/chrome/browser/chromeos/drive/drive_scheduler.cc @@ -17,7 +17,7 @@ using content::BrowserThread; -namespace gdata { +namespace drive { namespace { const int kMaxThrottleCount = 5; @@ -233,4 +233,4 @@ void DriveScheduler::OnConnectionTypeChanged( StartJobLoop(); } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/drive_scheduler.h b/chrome/browser/chromeos/drive/drive_scheduler.h index f97abaf..03a7745 100644 --- a/chrome/browser/chromeos/drive/drive_scheduler.h +++ b/chrome/browser/chromeos/drive/drive_scheduler.h @@ -14,7 +14,7 @@ class Profile; -namespace gdata { +namespace drive { namespace file_system { class RemoveOperation; @@ -173,6 +173,6 @@ class DriveScheduler DISALLOW_COPY_AND_ASSIGN(DriveScheduler); }; -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_SCHEDULER_H_ diff --git a/chrome/browser/chromeos/drive/drive_scheduler_unittest.cc b/chrome/browser/chromeos/drive/drive_scheduler_unittest.cc index 108bf48..014c775 100644 --- a/chrome/browser/chromeos/drive/drive_scheduler_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_scheduler_unittest.cc @@ -21,7 +21,7 @@ using ::testing::Return; using ::testing::StrictMock; using ::testing::_; -namespace gdata { +namespace drive { namespace { @@ -70,7 +70,7 @@ class DriveSchedulerTest : public testing::Test { // The scheduler should be deleted before NetworkLibrary, as it // registers itself as observer of NetworkLibrary. scheduler_.reset(); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); mock_network_change_notifier_.reset(); } @@ -126,7 +126,7 @@ TEST_F(DriveSchedulerTest, RemoveFile) { scheduler_->Remove( file_in_root, false, base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error)); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); ASSERT_EQ(DRIVE_FILE_OK, error); } @@ -143,7 +143,7 @@ TEST_F(DriveSchedulerTest, RemoveFileRetry) { scheduler_->Remove( file_in_root, false, base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error)); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); ASSERT_EQ(DRIVE_FILE_OK, error); } @@ -159,7 +159,7 @@ TEST_F(DriveSchedulerTest, QueueOperation_Offline) { scheduler_->Remove( file_in_root, false, base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error)); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); } TEST_F(DriveSchedulerTest, QueueOperation_CelluarDisabled) { @@ -174,7 +174,7 @@ TEST_F(DriveSchedulerTest, QueueOperation_CelluarDisabled) { scheduler_->Remove( file_in_root, false, base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error)); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); } TEST_F(DriveSchedulerTest, QueueOperation_CelluarEnabled) { @@ -192,7 +192,7 @@ TEST_F(DriveSchedulerTest, QueueOperation_CelluarEnabled) { scheduler_->Remove( file_in_root, false, base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error)); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); } TEST_F(DriveSchedulerTest, QueueOperation_WimaxDisabled) { @@ -208,7 +208,7 @@ TEST_F(DriveSchedulerTest, QueueOperation_WimaxDisabled) { scheduler_->Remove( file_in_root, false, base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error)); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); } TEST_F(DriveSchedulerTest, QueueOperation_CelluarEnabledWithWimax) { @@ -226,7 +226,7 @@ TEST_F(DriveSchedulerTest, QueueOperation_CelluarEnabledWithWimax) { scheduler_->Remove( file_in_root, false, base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error)); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); } TEST_F(DriveSchedulerTest, QueueOperation_DriveDisabled) { @@ -241,7 +241,7 @@ TEST_F(DriveSchedulerTest, QueueOperation_DriveDisabled) { scheduler_->Remove( file_in_root, false, base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error)); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/drive_service_interface.h b/chrome/browser/chromeos/drive/drive_service_interface.h index c82b273..7b9aa3b 100644 --- a/chrome/browser/chromeos/drive/drive_service_interface.h +++ b/chrome/browser/chromeos/drive/drive_service_interface.h @@ -15,7 +15,7 @@ class Profile; -namespace gdata { +namespace drive { class OperationRegistry; @@ -48,10 +48,11 @@ class DriveServiceObserver { virtual void OnReadyToPerformOperations() {} // Called when an operation started, made some progress, or finished. - virtual void OnProgressUpdate(const OperationProgressStatusList& list) {} + virtual void OnProgressUpdate( + const gdata::OperationProgressStatusList& list) {} // Called when GData authentication failed. - virtual void OnAuthenticationFailed(GDataErrorCode error) {} + virtual void OnAuthenticationFailed(gdata::GDataErrorCode error) {} protected: virtual ~DriveServiceObserver() {} @@ -91,14 +92,14 @@ class DriveServiceInterface { virtual bool CancelForFilePath(const FilePath& file_path) = 0; // Obtains the list of currently active operations. - virtual OperationProgressStatusList GetProgressStatusList() const = 0; + virtual gdata::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 AuthStatusCallback& callback) = 0; + virtual void Authenticate(const gdata::AuthStatusCallback& callback) = 0; // True if OAuth2 access token is retrieved and believed to be fresh. virtual bool HasAccessToken() const = 0; @@ -127,35 +128,36 @@ class DriveServiceInterface { int64 start_changestamp, const std::string& search_query, const std::string& directory_resource_id, - const GetDataCallback& callback) = 0; + const gdata::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 GetDataCallback& callback) = 0; + const gdata::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 GetDataCallback& callback) = 0; + virtual void GetAccountMetadata(const gdata::GetDataCallback& callback) = 0; // Gets the application information from the server. // Upon completion, invokes |callback| with results on the calling thread. - virtual void GetApplicationInfo(const GetDataCallback& callback) = 0; + virtual void GetApplicationInfo(const gdata::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 EntryActionCallback& callback) = 0; + const gdata::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. - virtual void DownloadDocument(const FilePath& virtual_path, - const FilePath& local_cache_path, - const GURL& content_url, - DocumentExportFormat format, - const DownloadActionCallback& callback) = 0; + virtual void DownloadDocument( + const FilePath& virtual_path, + const FilePath& local_cache_path, + const GURL& content_url, + DocumentExportFormat format, + const gdata::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 @@ -164,22 +166,23 @@ class DriveServiceInterface { // calling thread. virtual void CopyDocument(const std::string& resource_id, const FilePath::StringType& new_name, - const GetDataCallback& callback) = 0; + const gdata::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 EntryActionCallback& callback) = 0; + const gdata::EntryActionCallback& callback) = 0; // Adds a resource (document, file, or collection) identified by its // 'self' link |resource_url| to a collection with a content link // |parent_content_url|. Upon completion, invokes |callback| with // results on the calling thread. - virtual void AddResourceToDirectory(const GURL& parent_content_url, - const GURL& resource_url, - const EntryActionCallback& callback) = 0; + virtual void AddResourceToDirectory( + const GURL& parent_content_url, + const GURL& resource_url, + const gdata::EntryActionCallback& callback) = 0; // Removes a resource (document, file, collection) identified by its // 'self' link |resource_url| from a collection with a content link @@ -189,7 +192,7 @@ class DriveServiceInterface { const GURL& parent_content_url, const GURL& resource_url, const std::string& resource_id, - const EntryActionCallback& callback) = 0; + const gdata::EntryActionCallback& callback) = 0; // Creates new collection with |directory_name| under parent directory // identified with |parent_content_url|. If |parent_content_url| is empty, @@ -197,7 +200,7 @@ class DriveServiceInterface { // 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 GetDataCallback& callback) = 0; + const gdata::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 @@ -209,24 +212,25 @@ class DriveServiceInterface { const FilePath& virtual_path, const FilePath& local_cache_path, const GURL& content_url, - const DownloadActionCallback& download_action_callback, - const GetContentCallback& get_content_callback) = 0; + const gdata::DownloadActionCallback& download_action_callback, + const gdata::GetContentCallback& get_content_callback) = 0; // Initiates uploading of a document/file. - virtual void InitiateUpload(const InitiateUploadParams& params, - const InitiateUploadCallback& callback) = 0; + virtual void InitiateUpload( + const gdata::InitiateUploadParams& params, + const gdata::InitiateUploadCallback& callback) = 0; // Resumes uploading of a document/file on the calling thread. - virtual void ResumeUpload(const ResumeUploadParams& params, - const ResumeUploadCallback& callback) = 0; + virtual void ResumeUpload(const gdata::ResumeUploadParams& params, + const gdata::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 GetDataCallback& callback) = 0; + const gdata::GetDataCallback& callback) = 0; }; -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_SERVICE_INTERFACE_H_ diff --git a/chrome/browser/chromeos/drive/drive_sync_client.cc b/chrome/browser/chromeos/drive/drive_sync_client.cc index c7bf191..4d1f862 100644 --- a/chrome/browser/chromeos/drive/drive_sync_client.cc +++ b/chrome/browser/chromeos/drive/drive_sync_client.cc @@ -20,7 +20,7 @@ using content::BrowserThread; -namespace gdata { +namespace drive { namespace { @@ -169,7 +169,7 @@ void DriveSyncClient::DoSyncLoop() { base::Bind(&DriveSyncClient::OnFetchFileComplete, weak_ptr_factory_.GetWeakPtr(), sync_task), - GetContentCallback()); + gdata::GetContentCallback()); } else if (sync_task.sync_type == UPLOAD) { DVLOG(1) << "Uploading " << sync_task.resource_id; file_system_->UpdateFileByResourceId( @@ -435,4 +435,4 @@ void DriveSyncClient::OnConnectionTypeChanged( StartSyncLoop(); } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/drive_sync_client.h b/chrome/browser/chromeos/drive/drive_sync_client.h index ff8aa82..25477f1 100644 --- a/chrome/browser/chromeos/drive/drive_sync_client.h +++ b/chrome/browser/chromeos/drive/drive_sync_client.h @@ -22,7 +22,7 @@ class Profile; class PrefChangeRegistrar; -namespace gdata { +namespace drive { class DriveEntryProto; class DriveFileSystemInterface; @@ -208,6 +208,6 @@ class DriveSyncClient DISALLOW_COPY_AND_ASSIGN(DriveSyncClient); }; -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_SYNC_CLIENT_H_ diff --git a/chrome/browser/chromeos/drive/drive_sync_client_unittest.cc b/chrome/browser/chromeos/drive/drive_sync_client_unittest.cc index 13a0d158..c3e1bd0 100644 --- a/chrome/browser/chromeos/drive/drive_sync_client_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_sync_client_unittest.cc @@ -34,7 +34,7 @@ using ::testing::Return; using ::testing::StrictMock; using ::testing::_; -namespace gdata { +namespace drive { namespace { @@ -102,7 +102,7 @@ class DriveSyncClientTest : public testing::Test { // client registers itself as observer of NetworkLibrary. sync_client_.reset(); cache_->DestroyOnUIThread(); - test_util::RunBlockingPoolTask(); + gdata::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(); - test_util::RunBlockingPoolTask(); + gdata::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(); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); ASSERT_TRUE(initialization_success); // Check the contents of the queue for fetching. @@ -560,4 +560,4 @@ TEST_F(DriveSyncClientTest, ExistingPinnedFiles) { ASSERT_TRUE(resource_ids.empty()); } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/drive_system_service.cc b/chrome/browser/chromeos/drive/drive_system_service.cc index 7fbc656..6ad4922 100644 --- a/chrome/browser/chromeos/drive/drive_system_service.cc +++ b/chrome/browser/chromeos/drive/drive_system_service.cc @@ -34,7 +34,7 @@ using content::BrowserContext; using content::BrowserThread; -namespace gdata { +namespace drive { namespace { // Used in test to setup system service. @@ -126,7 +126,7 @@ void DriveSystemService::Shutdown() { bool DriveSystemService::IsDriveEnabled(Profile* profile) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (!AuthService::CanAuthenticate(profile)) + if (!gdata::AuthService::CanAuthenticate(profile)) return false; // Disable gdata if preference is set. This can happen with commandline flag @@ -170,7 +170,7 @@ void DriveSystemService::AddDriveMountPoint() { if (!IsDriveEnabled(profile_)) return; - const FilePath mount_point = gdata::util::GetDriveMountPointPath(); + const FilePath mount_point = util::GetDriveMountPointPath(); fileapi::ExternalFileSystemMountPointProvider* provider = BrowserContext::GetDefaultStoragePartition(profile_)-> GetFileSystemContext()->external_provider(); @@ -187,7 +187,7 @@ void DriveSystemService::RemoveDriveMountPoint() { file_system_->NotifyFileSystemToBeUnmounted(); file_system_->StopUpdates(); - const FilePath mount_point = gdata::util::GetDriveMountPointPath(); + const FilePath mount_point = util::GetDriveMountPointPath(); fileapi::ExternalFileSystemMountPointProvider* provider = BrowserContext::GetDefaultStoragePartition(profile_)-> GetFileSystemContext()->external_provider(); @@ -208,7 +208,7 @@ void DriveSystemService::OnCacheInitialized(bool success) { // dependency problem. We should move this code to DisableDrive() once // the dependency problem is solved. crbug.com/153962 PrefService* pref_service = profile_->GetPrefs(); - if (gdata::util::IsUnderDriveMountPoint( + if (util::IsUnderDriveMountPoint( pref_service->GetFilePath(prefs::kDownloadDefaultDirectory))) { pref_service->SetFilePath(prefs::kDownloadDefaultDirectory, download_util::GetDefaultDownloadDirectory()); @@ -280,7 +280,7 @@ ProfileKeyedService* DriveSystemServiceFactory::BuildServiceInstanceFor( DriveServiceInterface* drive_service = g_test_drive_service; g_test_drive_service = NULL; if (!drive_service) { - if (util::IsDriveV2ApiEnabled()) + if (gdata::util::IsDriveV2ApiEnabled()) drive_service = new DriveAPIService(); else drive_service = new GDataWapiService(); @@ -296,4 +296,4 @@ ProfileKeyedService* DriveSystemServiceFactory::BuildServiceInstanceFor( return service; } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/drive_system_service.h b/chrome/browser/chromeos/drive/drive_system_service.h index 2c05a2c..25aed28 100644 --- a/chrome/browser/chromeos/drive/drive_system_service.h +++ b/chrome/browser/chromeos/drive/drive_system_service.h @@ -17,7 +17,7 @@ class FilePath; -namespace gdata { +namespace drive { class DriveCache; class DriveDownloadObserver; @@ -135,6 +135,6 @@ class DriveSystemServiceFactory : public ProfileKeyedServiceFactory { Profile* profile) const OVERRIDE; }; -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_SYSTEM_SERVICE_H_ diff --git a/chrome/browser/chromeos/drive/drive_task_executor.cc b/chrome/browser/chromeos/drive/drive_task_executor.cc index 42dd856..5d6b5bc 100644 --- a/chrome/browser/chromeos/drive/drive_task_executor.cc +++ b/chrome/browser/chromeos/drive/drive_task_executor.cc @@ -25,7 +25,7 @@ #include "webkit/fileapi/file_system_url.h" #include "webkit/fileapi/file_system_util.h" -namespace gdata { +namespace drive { using file_handler_util::FileTaskExecutor; @@ -107,7 +107,7 @@ void DriveTaskExecutor::OnFileEntryFetched( void DriveTaskExecutor::OnAppAuthorized( const std::string& resource_id, - GDataErrorCode error, + gdata::GDataErrorCode error, scoped_ptr<base::Value> feed_data) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); @@ -118,7 +118,7 @@ void DriveTaskExecutor::OnAppAuthorized( DriveSystemService* system_service = DriveSystemServiceFactory::GetForProfile(profile()); - if (!system_service || error != HTTP_SUCCESS) { + if (!system_service || error != gdata::HTTP_SUCCESS) { Done(false); return; } @@ -167,4 +167,4 @@ void DriveTaskExecutor::Done(bool success) { done_.Reset(); } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/drive_task_executor.h b/chrome/browser/chromeos/drive/drive_task_executor.h index 05ff462..a09d899 100644 --- a/chrome/browser/chromeos/drive/drive_task_executor.h +++ b/chrome/browser/chromeos/drive/drive_task_executor.h @@ -12,7 +12,7 @@ #include "chrome/browser/chromeos/extensions/file_handler_util.h" #include "chrome/browser/google_apis/gdata_errorcode.h" -namespace gdata { +namespace drive { class DriveEntryProto; @@ -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, - GDataErrorCode error, + gdata::GDataErrorCode error, scoped_ptr<base::Value> feed_data); // Calls |done_| with |success| status. @@ -52,6 +52,6 @@ class DriveTaskExecutor : public file_handler_util::FileTaskExecutor { file_handler_util::FileTaskFinishedCallback done_; }; -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_TASK_EXECUTOR_H_ diff --git a/chrome/browser/chromeos/drive/drive_test_util.cc b/chrome/browser/chromeos/drive/drive_test_util.cc index 27336fc..e031cb8 100644 --- a/chrome/browser/chromeos/drive/drive_test_util.cc +++ b/chrome/browser/chromeos/drive/drive_test_util.cc @@ -10,7 +10,7 @@ #include "chrome/browser/google_apis/drive_api_parser.h" #include "testing/gtest/include/gtest/gtest.h" -namespace gdata { +namespace drive { namespace test_util { DriveCacheEntry ToCacheEntry(int cache_state) { @@ -108,13 +108,13 @@ void LoadChangeFeed(const std::string& relative_path, int64 start_changestamp, int64 root_feed_changestamp) { std::string error; - scoped_ptr<Value> document = test_util::LoadJSONFile(relative_path); + scoped_ptr<Value> document = gdata::test_util::LoadJSONFile(relative_path); ASSERT_TRUE(document.get()); ASSERT_TRUE(document->GetType() == Value::TYPE_DICTIONARY); - scoped_ptr<DocumentFeed> document_feed( - DocumentFeed::ExtractAndParse(*document)); + scoped_ptr<gdata::DocumentFeed> document_feed( + gdata::DocumentFeed::ExtractAndParse(*document)); ASSERT_TRUE(document_feed.get()); - ScopedVector<DocumentFeed> feed_list; + ScopedVector<gdata::DocumentFeed> feed_list; feed_list.push_back(document_feed.release()); GURL unused; @@ -126,4 +126,4 @@ void LoadChangeFeed(const std::string& relative_path, } } // namespace test_util -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/drive_test_util.h b/chrome/browser/chromeos/drive/drive_test_util.h index c1cd18a..716e4ae 100644 --- a/chrome/browser/chromeos/drive/drive_test_util.h +++ b/chrome/browser/chromeos/drive/drive_test_util.h @@ -17,7 +17,7 @@ namespace base { class Value; } -namespace gdata { +namespace drive { class DriveCacheEntry; class DriveEntryProto; @@ -105,6 +105,6 @@ void LoadChangeFeed(const std::string& relative_path, int64 root_feed_changestamp); } // namespace test_util -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_TEST_UTIL_H_ diff --git a/chrome/browser/chromeos/drive/drive_uploader.cc b/chrome/browser/chromeos/drive/drive_uploader.cc index aa0101c..a180800 100644 --- a/chrome/browser/chromeos/drive/drive_uploader.cc +++ b/chrome/browser/chromeos/drive/drive_uploader.cc @@ -29,7 +29,7 @@ const int kMaxFileOpenTries = 5; } // namespace -namespace gdata { +namespace drive { DriveUploader::DriveUploader(DriveServiceInterface* drive_service) : drive_service_(drive_service), @@ -60,7 +60,7 @@ int DriveUploader::UploadNewFile( DCHECK(!content_type.empty()); scoped_ptr<UploadFileInfo> upload_file_info(new UploadFileInfo); - upload_file_info->upload_mode = UPLOAD_NEW_FILE; + upload_file_info->upload_mode = gdata::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 = UPLOAD_EXISTING_FILE; + upload_file_info->upload_mode = gdata::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(UPLOAD_INVALID, upload_file_info->upload_mode); + DCHECK_NE(gdata::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 = UPLOAD_EXISTING_FILE; + upload_file_info->upload_mode = gdata::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( - InitiateUploadParams(upload_file_info->upload_mode, + gdata::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, - GDataErrorCode code, + gdata::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 != HTTP_SUCCESS) { + if (code != gdata::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( - 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), + 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), base::Bind(&DriveUploader::OnResumeUploadResponseReceived, weak_ptr_factory_.GetWeakPtr(), upload_file_info->upload_id)); @@ -456,17 +456,19 @@ void DriveUploader::ResumeUpload(int upload_id) { void DriveUploader::OnResumeUploadResponseReceived( int upload_id, - const ResumeUploadResponse& response, - scoped_ptr<DocumentEntry> entry) { + const gdata::ResumeUploadResponse& response, + scoped_ptr<gdata::DocumentEntry> entry) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); UploadFileInfo* upload_file_info = GetUploadFileInfo(upload_id); if (!upload_file_info) return; - const UploadMode upload_mode = upload_file_info->upload_mode; - if ((upload_mode == UPLOAD_NEW_FILE && response.code == HTTP_CREATED) || - (upload_mode == UPLOAD_EXISTING_FILE && response.code == HTTP_SUCCESS)) { + 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)) { DVLOG(1) << "Successfully created uploaded file=[" << upload_file_info->title; @@ -488,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 != HTTP_RESUME_INCOMPLETE || + if (response.code != gdata::HTTP_RESUME_INCOMPLETE || response.start_range_received != 0 || response.end_range_received != upload_file_info->end_range) { // TODO(achuith): Handle error cases, e.g. @@ -500,7 +502,7 @@ void DriveUploader::OnResumeUploadResponseReceived( << ", expected end range=" << upload_file_info->end_range; UploadFailed( upload_file_info, - response.code == HTTP_FORBIDDEN ? + response.code == gdata::HTTP_FORBIDDEN ? DRIVE_FILE_ERROR_NO_SPACE : DRIVE_FILE_ERROR_ABORT); return; } @@ -539,7 +541,7 @@ DriveUploader::UploadFileInfo::UploadFileInfo() : upload_id(-1), file_size(0), content_length(0), - upload_mode(UPLOAD_INVALID), + upload_mode(gdata::UPLOAD_INVALID), file_stream(NULL), buf_len(0), start_range(0), @@ -568,4 +570,4 @@ std::string DriveUploader::UploadFileInfo::DebugString() const { "]"; } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/drive_uploader.h b/chrome/browser/chromeos/drive/drive_uploader.h index f3bd957..406e308 100644 --- a/chrome/browser/chromeos/drive/drive_uploader.h +++ b/chrome/browser/chromeos/drive/drive_uploader.h @@ -25,16 +25,19 @@ class DownloadItem; } namespace gdata { +struct ResumeUploadResponse; +} + +namespace drive { class MockDriveUploader; class DriveServiceInterface; -struct ResumeUploadResponse; // Callback to be invoked once the upload has completed. typedef base::Callback<void(DriveFileError error, const FilePath& drive_path, const FilePath& file_path, - scoped_ptr<DocumentEntry> document_entry)> UploadCompletionCallback; + scoped_ptr<gdata::DocumentEntry> document_entry)> UploadCompletionCallback; // Callback to be invoked once the upoader is ready to upload. typedef base::Callback<void(int32 upload_id)> UploaderReadyCallback; @@ -147,7 +150,7 @@ class DriveUploader : public DriveUploaderInterface { std::string content_type; // Content-Type of file. int64 content_length; // Header content-Length. - UploadMode upload_mode; + gdata::UploadMode upload_mode; // Location URL used to get |upload_location| with InitiateUpload. GURL initial_upload_location; @@ -184,7 +187,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<DocumentEntry> entry; + scoped_ptr<gdata::DocumentEntry> entry; // Callback to be invoked once the uploader is ready to upload. UploaderReadyCallback ready_callback; @@ -214,7 +217,7 @@ class DriveUploader : public DriveUploaderInterface { // DriveService callback for InitiateUpload. void OnUploadLocationReceived(int upload_id, - GDataErrorCode code, + gdata::GDataErrorCode code, const GURL& upload_location); // Uploads the next chunk of data from the file. @@ -229,9 +232,10 @@ class DriveUploader : public DriveUploaderInterface { void ResumeUpload(int upload_id); // DriveService callback for ResumeUpload. - void OnResumeUploadResponseReceived(int upload_id, - const ResumeUploadResponse& response, - scoped_ptr<DocumentEntry> entry); + void OnResumeUploadResponseReceived( + int upload_id, + const gdata::ResumeUploadResponse& response, + scoped_ptr<gdata::DocumentEntry> entry); // Initiate the upload. void InitiateUpload(UploadFileInfo* uploader_file_info); @@ -268,6 +272,6 @@ class DriveUploader : public DriveUploaderInterface { DISALLOW_COPY_AND_ASSIGN(DriveUploader); }; -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_UPLOADER_H_ diff --git a/chrome/browser/chromeos/drive/drive_webapps_registry.cc b/chrome/browser/chromeos/drive/drive_webapps_registry.cc index 5436d31..2ba81ad 100644 --- a/chrome/browser/chromeos/drive/drive_webapps_registry.cc +++ b/chrome/browser/chromeos/drive/drive_webapps_registry.cc @@ -16,7 +16,7 @@ using content::BrowserThread; -namespace gdata { +namespace drive { namespace { @@ -40,8 +40,8 @@ std::string GetWebStoreIdFromUrl(const GURL& url) { } // TODO(kochi): This is duplicate from gdata_wapi_parser.cc. -bool SortBySize(const InstalledApp::IconList::value_type& a, - const InstalledApp::IconList::value_type& b) { +bool SortBySize(const gdata::InstalledApp::IconList::value_type& a, + const gdata::InstalledApp::IconList::value_type& b) { return a.first < b.first; } @@ -49,13 +49,14 @@ bool SortBySize(const InstalledApp::IconList::value_type& a, // DriveWebAppInfo struct implementation. -DriveWebAppInfo::DriveWebAppInfo(const std::string& app_id, - const InstalledApp::IconList& app_icons, - const InstalledApp::IconList& document_icons, - const std::string& web_store_id, - const string16& app_name, - const string16& object_type, - bool is_primary_selector) +DriveWebAppInfo::DriveWebAppInfo( + const std::string& app_id, + const gdata::InstalledApp::IconList& app_icons, + const gdata::InstalledApp::IconList& document_icons, + const std::string& web_store_id, + const string16& app_name, + const string16& object_type, + bool is_primary_selector) : app_id(app_id), app_icons(app_icons), document_icons(document_icons), @@ -72,8 +73,8 @@ DriveWebAppInfo::~DriveWebAppInfo() { DriveWebAppsRegistry::WebAppFileSelector::WebAppFileSelector( const GURL& product_link, - const InstalledApp::IconList& app_icons, - const InstalledApp::IconList& document_icons, + 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) @@ -144,24 +145,24 @@ std::set<std::string> DriveWebAppsRegistry::GetExtensionsForWebStoreApp( } void DriveWebAppsRegistry::UpdateFromFeed( - const AccountMetadataFeed& metadata) { + const gdata::AccountMetadataFeed& metadata) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); url_to_name_map_.clear(); STLDeleteValues(&webapp_extension_map_); STLDeleteValues(&webapp_mimetypes_map_); - for (ScopedVector<InstalledApp>::const_iterator it = + for (ScopedVector<gdata::InstalledApp>::const_iterator it = metadata.installed_apps().begin(); it != metadata.installed_apps().end(); ++it) { - const InstalledApp& app = **it; + const gdata::InstalledApp& app = **it; GURL product_url = app.GetProductUrl(); if (product_url.is_empty()) continue; - InstalledApp::IconList app_icons = - app.GetIconsForCategory(AppIcon::ICON_APPLICATION); - InstalledApp::IconList document_icons = - app.GetIconsForCategory(AppIcon::ICON_DOCUMENT); + gdata::InstalledApp::IconList app_icons = + app.GetIconsForCategory(gdata::AppIcon::ICON_APPLICATION); + gdata::InstalledApp::IconList document_icons = + app.GetIconsForCategory(gdata::AppIcon::ICON_DOCUMENT); if (VLOG_IS_ON(1)) { std::vector<std::string> mime_types; @@ -219,27 +220,28 @@ void DriveWebAppsRegistry::UpdateFromFeed( } } -void DriveWebAppsRegistry::UpdateFromApplicationList(const AppList& applist) { +void DriveWebAppsRegistry::UpdateFromApplicationList( + const gdata::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 AppResource& app = *applist.items()[i]; + const gdata::AppResource& app = *applist.items()[i]; if (app.product_url().is_empty()) continue; - InstalledApp::IconList app_icons; - InstalledApp::IconList document_icons; + gdata::InstalledApp::IconList app_icons; + gdata::InstalledApp::IconList document_icons; for (size_t j = 0; j < app.icons().size(); ++j) { - const DriveAppIcon& icon = *app.icons()[j]; + const gdata::DriveAppIcon& icon = *app.icons()[j]; if (icon.icon_url().is_empty()) continue; - if (icon.category() == DriveAppIcon::APPLICATION) + if (icon.category() == gdata::DriveAppIcon::APPLICATION) app_icons.push_back(std::make_pair(icon.icon_side_length(), icon.icon_url())); - if (icon.category() == DriveAppIcon::DOCUMENT) + if (icon.category() == gdata::DriveAppIcon::DOCUMENT) document_icons.push_back(std::make_pair(icon.icon_side_length(), icon.icon_url())); } @@ -286,8 +288,8 @@ void DriveWebAppsRegistry::UpdateFromApplicationList(const AppList& applist) { // static. void DriveWebAppsRegistry::AddAppSelectorList( const GURL& product_link, - const InstalledApp::IconList& app_icons, - const InstalledApp::IconList& document_icons, + 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, @@ -339,4 +341,4 @@ void DriveWebAppsRegistry::FindWebAppsForSelector( } } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/drive_webapps_registry.h b/chrome/browser/chromeos/drive/drive_webapps_registry.h index 027236a..bcdce83 100644 --- a/chrome/browser/chromeos/drive/drive_webapps_registry.h +++ b/chrome/browser/chromeos/drive/drive_webapps_registry.h @@ -16,14 +16,16 @@ class FilePath; namespace gdata { - class AppList; +} + +namespace drive { // Data structure that defines WebApp struct DriveWebAppInfo { DriveWebAppInfo(const std::string& app_id, - const InstalledApp::IconList& app_icons, - const InstalledApp::IconList& document_icons, + const gdata::InstalledApp::IconList& app_icons, + const gdata::InstalledApp::IconList& document_icons, const std::string& web_store_id, const string16& app_name, const string16& object_type, @@ -34,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). - InstalledApp::IconList app_icons; + gdata::InstalledApp::IconList app_icons; // Drive document icon URLs for this app, paired with their size (length of // a side in pixels). - InstalledApp::IconList document_icons; + gdata::InstalledApp::IconList document_icons; // Web store id/extension id; std::string web_store_id; // WebApp name. @@ -66,11 +68,11 @@ class DriveWebAppsRegistryInterface { // Updates the list of drive-enabled WebApps with freshly fetched account // metadata feed. - virtual void UpdateFromFeed(const AccountMetadataFeed& metadata) = 0; + virtual void UpdateFromFeed(const gdata::AccountMetadataFeed& metadata) = 0; // Updates the list of drive-enabled WebApps with freshly fetched account // metadata feed. - virtual void UpdateFromApplicationList(const AppList& applist) = 0; + virtual void UpdateFromApplicationList(const gdata::AppList& applist) = 0; }; // The production implementation of DriveWebAppsRegistryInterface. @@ -86,16 +88,18 @@ class DriveWebAppsRegistry : public DriveWebAppsRegistryInterface { ScopedVector<DriveWebAppInfo>* apps) OVERRIDE; virtual std::set<std::string> GetExtensionsForWebStoreApp( const std::string& web_store_id) OVERRIDE; - virtual void UpdateFromFeed(const AccountMetadataFeed& metadata) OVERRIDE; - virtual void UpdateFromApplicationList(const AppList& applist) OVERRIDE; + virtual void UpdateFromFeed( + const gdata::AccountMetadataFeed& metadata) OVERRIDE; + virtual void UpdateFromApplicationList( + const gdata::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 InstalledApp::IconList& app_icons, - const InstalledApp::IconList& document_icons, + 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); @@ -104,10 +108,10 @@ class DriveWebAppsRegistry : public DriveWebAppsRegistryInterface { GURL product_link; // Drive application icon URLs for this app, paired with their size (length // of a side in pixels). - InstalledApp::IconList app_icons; + gdata::InstalledApp::IconList app_icons; // Drive document icon URLs for this app, paired with their size (length of // a side in pixels). - InstalledApp::IconList document_icons; + gdata::InstalledApp::IconList document_icons; // Object (file) type description. string16 object_type; // Drive app id @@ -128,14 +132,15 @@ class DriveWebAppsRegistry : public DriveWebAppsRegistryInterface { // Helper function for loading web application file |selectors| into // corresponding |map|. - static void AddAppSelectorList(const GURL& product_link, - const InstalledApp::IconList& app_icons, - const InstalledApp::IconList& document_icons, - const string16& object_type, - const std::string& app_id, - bool is_primary_selector, - const ScopedVector<std::string>& selectors, - WebAppFileSelectorMap* map); + static void AddAppSelectorList( + 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, + const ScopedVector<std::string>& selectors, + WebAppFileSelectorMap* map); // Finds matching |apps| from |map| based on provided file |selector|. void FindWebAppsForSelector(const std::string& selector, @@ -154,6 +159,6 @@ class DriveWebAppsRegistry : public DriveWebAppsRegistryInterface { DISALLOW_COPY_AND_ASSIGN(DriveWebAppsRegistry); }; -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_WEBAPPS_REGISTRY_H_ diff --git a/chrome/browser/chromeos/drive/drive_webapps_registry_unittest.cc b/chrome/browser/chromeos/drive/drive_webapps_registry_unittest.cc index 539db59..0ac19c2 100644 --- a/chrome/browser/chromeos/drive/drive_webapps_registry_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_webapps_registry_unittest.cc @@ -23,7 +23,7 @@ using base::Value; using base::DictionaryValue; using base::ListValue; -namespace gdata { +namespace drive { class DriveWebAppsRegistryTest : public testing::Test { protected: @@ -76,7 +76,7 @@ class DriveWebAppsRegistryTest : public testing::Test { TEST_F(DriveWebAppsRegistryTest, LoadAndFindWebApps) { scoped_ptr<Value> document = - test_util::LoadJSONFile("gdata/account_metadata.json"); + gdata::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<AccountMetadataFeed> feed( - AccountMetadataFeed::CreateFrom(*document)); + scoped_ptr<gdata::AccountMetadataFeed> feed( + gdata::AccountMetadataFeed::CreateFrom(*document)); ASSERT_TRUE(feed.get()); scoped_ptr<DriveWebAppsRegistry> web_apps(new DriveWebAppsRegistry); web_apps->UpdateFromFeed(*feed.get()); @@ -124,12 +124,13 @@ TEST_F(DriveWebAppsRegistryTest, LoadAndFindWebApps) { } TEST_F(DriveWebAppsRegistryTest, LoadAndFindDriveWebApps) { - scoped_ptr<Value> document = test_util::LoadJSONFile("drive/applist.json"); + scoped_ptr<Value> document = + gdata::test_util::LoadJSONFile("drive/applist.json"); ASSERT_TRUE(document.get()); ASSERT_TRUE(document->GetType() == Value::TYPE_DICTIONARY); // Load feed. - scoped_ptr<AppList> app_list(AppList::CreateFrom(*document)); + scoped_ptr<gdata::AppList> app_list(gdata::AppList::CreateFrom(*document)); ASSERT_TRUE(app_list.get()); scoped_ptr<DriveWebAppsRegistry> web_apps(new DriveWebAppsRegistry); web_apps->UpdateFromApplicationList(*app_list.get()); @@ -158,4 +159,4 @@ TEST_F(DriveWebAppsRegistryTest, LoadAndFindDriveWebApps) { "Drive app 1", "", false); } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/file_system/move_operation.cc b/chrome/browser/chromeos/drive/file_system/move_operation.cc index d17f829..3ec9b8f 100644 --- a/chrome/browser/chromeos/drive/file_system/move_operation.cc +++ b/chrome/browser/chromeos/drive/file_system/move_operation.cc @@ -14,7 +14,7 @@ using content::BrowserThread; -namespace gdata { +namespace drive { namespace file_system { MoveOperation::MoveOperation(DriveServiceInterface* drive_service, @@ -178,7 +178,7 @@ void MoveOperation::RenameEntryLocally( const FilePath& file_path, const FilePath::StringType& new_name, const FileMoveCallback& callback, - GDataErrorCode status, + gdata::GDataErrorCode status, const GURL& /* document_url */) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -330,7 +330,7 @@ void MoveOperation::MoveEntryToDirectory( const FilePath& file_path, const FilePath& directory_path, const FileMoveCallback& callback, - GDataErrorCode status, + gdata::GDataErrorCode status, const GURL& /* document_url */) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -374,4 +374,4 @@ void MoveOperation::NotifyAndRunFileMoveCallback( } } // namespace file_system -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/file_system/move_operation.h b/chrome/browser/chromeos/drive/file_system/move_operation.h index 7285ecf..594d2dd 100644 --- a/chrome/browser/chromeos/drive/file_system/move_operation.h +++ b/chrome/browser/chromeos/drive/file_system/move_operation.h @@ -14,7 +14,7 @@ class FilePath; class GURL; -namespace gdata { +namespace drive { class DriveCache; class DriveEntryProto; @@ -79,7 +79,7 @@ class MoveOperation { void RenameEntryLocally(const FilePath& file_path, const FilePath::StringType& new_name, const FileMoveCallback& callback, - GDataErrorCode status, + gdata::GDataErrorCode status, const GURL& document_url); // Removes a file or directory at |file_path| from the current directory if @@ -121,7 +121,7 @@ class MoveOperation { void MoveEntryToDirectory(const FilePath& file_path, const FilePath& directory_path, const FileMoveCallback& callback, - GDataErrorCode status, + gdata::GDataErrorCode status, const GURL& document_url); // Callback when an entry is moved to another directory on the client side. @@ -153,6 +153,6 @@ class MoveOperation { }; } // namespace file_system -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_MOVE_OPERATION_H_ diff --git a/chrome/browser/chromeos/drive/file_system/remove_operation.cc b/chrome/browser/chromeos/drive/file_system/remove_operation.cc index 2d4a62c..e871e84b 100644 --- a/chrome/browser/chromeos/drive/file_system/remove_operation.cc +++ b/chrome/browser/chromeos/drive/file_system/remove_operation.cc @@ -13,7 +13,7 @@ using content::BrowserThread; -namespace gdata { +namespace drive { namespace file_system { RemoveOperation::RemoveOperation(DriveServiceInterface* drive_service, @@ -74,7 +74,7 @@ void RemoveOperation::RemoveAfterGetEntryInfo( void RemoveOperation::RemoveResourceLocally( const FileOperationCallback& callback, const std::string& resource_id, - GDataErrorCode status, + gdata::GDataErrorCode status, const GURL& /* document_url */) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -106,4 +106,4 @@ void RemoveOperation::NotifyDirectoryChanged( } } // namespace file_system -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/file_system/remove_operation.h b/chrome/browser/chromeos/drive/file_system/remove_operation.h index 3aa474f..8f4e11d 100644 --- a/chrome/browser/chromeos/drive/file_system/remove_operation.h +++ b/chrome/browser/chromeos/drive/file_system/remove_operation.h @@ -14,7 +14,7 @@ class FilePath; class GURL; -namespace gdata { +namespace drive { class DriveCache; class DriveEntryProto; @@ -53,7 +53,7 @@ class RemoveOperation { void RemoveResourceLocally( const FileOperationCallback& callback, const std::string& resource_id, - GDataErrorCode status, + gdata::GDataErrorCode status, const GURL& /* document_url */); // Sends notification for directory changes. Notifies of directory changes, @@ -76,6 +76,6 @@ class RemoveOperation { }; } // namespace file_system -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_REMOVE_OPERATION_H_ diff --git a/chrome/browser/chromeos/drive/file_write_helper.cc b/chrome/browser/chromeos/drive/file_write_helper.cc index 3a21a65..a1a4080 100644 --- a/chrome/browser/chromeos/drive/file_write_helper.cc +++ b/chrome/browser/chromeos/drive/file_write_helper.cc @@ -9,7 +9,7 @@ using content::BrowserThread; -namespace gdata { +namespace drive { namespace { @@ -56,7 +56,7 @@ void FileWriteHelper::PrepareWritableFileAndRunAfterCreateFile( DriveFileError error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (error != gdata::DRIVE_FILE_OK) { + if (error != DRIVE_FILE_OK) { if (!callback.is_null()) { content::BrowserThread::GetBlockingPool()->PostTask( FROM_HERE, @@ -79,7 +79,7 @@ void FileWriteHelper::PrepareWritableFileAndRunAfterOpenFile( const FilePath& local_cache_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (error != gdata::DRIVE_FILE_OK) { + if (error != DRIVE_FILE_OK) { if (!callback.is_null()) { content::BrowserThread::GetBlockingPool()->PostTask( FROM_HERE, @@ -107,4 +107,4 @@ void FileWriteHelper::PrepareWritableFileAndRunAfterCallback( base::Bind(&EmitDebugLogForCloseFile, file_path)); } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/file_write_helper.h b/chrome/browser/chromeos/drive/file_write_helper.h index 969f617..e1bf8f7 100644 --- a/chrome/browser/chromeos/drive/file_write_helper.h +++ b/chrome/browser/chromeos/drive/file_write_helper.h @@ -11,7 +11,7 @@ class FilePath; -namespace gdata { +namespace drive { // This class provides higher level operations for writing to Drive files over // DriveFileSystemInterface. @@ -55,6 +55,6 @@ class FileWriteHelper { DISALLOW_COPY_AND_ASSIGN(FileWriteHelper); }; -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_WRITE_HELPER_H_ diff --git a/chrome/browser/chromeos/drive/file_write_helper_unittest.cc b/chrome/browser/chromeos/drive/file_write_helper_unittest.cc index e676da8..e359e6a 100644 --- a/chrome/browser/chromeos/drive/file_write_helper_unittest.cc +++ b/chrome/browser/chromeos/drive/file_write_helper_unittest.cc @@ -17,7 +17,7 @@ using ::testing::StrictMock; using ::testing::_; -namespace gdata { +namespace drive { namespace { @@ -76,7 +76,7 @@ TEST_F(FileWriteHelperTest, PrepareFileForWritingSuccess) { FilePath path; file_write_helper.PrepareWritableFileAndRun( kDrivePath, base::Bind(&RecordOpenFileCallbackArguments, &error, &path)); - test_util::RunBlockingPoolTask(); + gdata::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)); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_ACCESS_DENIED, error); EXPECT_EQ(FilePath(), path); @@ -115,10 +115,10 @@ TEST_F(FileWriteHelperTest, PrepareFileForWritingOpenFail) { FilePath path; file_write_helper.PrepareWritableFileAndRun( kDrivePath, base::Bind(&RecordOpenFileCallbackArguments, &error, &path)); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_IN_USE, error); EXPECT_EQ(FilePath(), path); } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/gdata_wapi_feed_loader.cc b/chrome/browser/chromeos/drive/gdata_wapi_feed_loader.cc index ad2bc93..da80cb5 100644 --- a/chrome/browser/chromeos/drive/gdata_wapi_feed_loader.cc +++ b/chrome/browser/chromeos/drive/gdata_wapi_feed_loader.cc @@ -28,7 +28,7 @@ using content::BrowserThread; -namespace gdata { +namespace drive { namespace { @@ -148,12 +148,13 @@ void RunFeedLoadCallback(scoped_ptr<LoadFeedParams> params, feed_load_callback.Run(params.Pass(), error); } -// Parses a DocumentFeed from |data|. +// Parses a gdata::DocumentFeed from |data|. void ParseFeedOnBlockingPool( scoped_ptr<base::Value> data, - scoped_ptr<DocumentFeed>* out_current_feed) { + scoped_ptr<gdata::DocumentFeed>* out_current_feed) { DCHECK(out_current_feed); - out_current_feed->reset(DocumentFeed::ExtractAndParse(*data).release()); + out_current_feed->reset( + gdata::DocumentFeed::ExtractAndParse(*data).release()); } } // namespace @@ -280,7 +281,7 @@ void GDataWapiFeedLoader::OnGetAccountMetadata( ContentOrigin initial_origin, int64 local_changestamp, const FileOperationCallback& callback, - GDataErrorCode status, + gdata::GDataErrorCode status, scoped_ptr<base::Value> feed_data) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -298,15 +299,15 @@ void GDataWapiFeedLoader::OnGetAccountMetadata( return; } - scoped_ptr<AccountMetadataFeed> account_metadata; + scoped_ptr<gdata::AccountMetadataFeed> account_metadata; if (feed_data.get()) { - account_metadata = AccountMetadataFeed::CreateFrom(*feed_data); + account_metadata = gdata::AccountMetadataFeed::CreateFrom(*feed_data); #ifndef NDEBUG // Save account metadata feed for analysis. const FilePath path = cache_->GetCacheDirectoryPath(DriveCache::CACHE_TYPE_META).Append( kAccountMetadataFile); - util::PostBlockingPoolSequencedTask( + gdata::util::PostBlockingPoolSequencedTask( FROM_HERE, blocking_task_runner_, base::Bind(&SaveFeedOnBlockingPoolForDebugging, @@ -353,7 +354,7 @@ void GDataWapiFeedLoader::OnGetAboutResource( ContentOrigin initial_origin, int64 local_changestamp, const FileOperationCallback& callback, - GDataErrorCode status, + gdata::GDataErrorCode status, scoped_ptr<base::Value> feed_data) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -370,9 +371,9 @@ void GDataWapiFeedLoader::OnGetAboutResource( return; } - scoped_ptr<AboutResource> about_resource; + scoped_ptr<gdata::AboutResource> about_resource; if (feed_data.get()) - about_resource = AboutResource::CreateFrom(*feed_data); + about_resource = gdata::AboutResource::CreateFrom(*feed_data); if (!about_resource.get()) { LoadFromServer(params.Pass()); @@ -411,7 +412,7 @@ void GDataWapiFeedLoader::OnGetAboutResource( } void GDataWapiFeedLoader::OnGetApplicationList( - GDataErrorCode status, + gdata::GDataErrorCode status, scoped_ptr<base::Value> json) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -420,7 +421,7 @@ void GDataWapiFeedLoader::OnGetApplicationList( return; if (json.get()) { - scoped_ptr<AppList> applist(AppList::CreateFrom(*json)); + scoped_ptr<gdata::AppList> applist(gdata::AppList::CreateFrom(*json)); if (applist.get()) { VLOG(1) << "applist get success"; webapps_registry_->UpdateFromApplicationList(*applist.get()); @@ -518,7 +519,7 @@ void GDataWapiFeedLoader::OnFeedFromServerLoaded( void GDataWapiFeedLoader::OnGetDocuments( scoped_ptr<LoadFeedParams> params, base::TimeTicks start_time, - GDataErrorCode status, + gdata::GDataErrorCode status, scoped_ptr<base::Value> data) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -539,8 +540,9 @@ void GDataWapiFeedLoader::OnGetDocuments( return; } - scoped_ptr<DocumentFeed>* current_feed = new scoped_ptr<DocumentFeed>; - util::PostBlockingPoolSequencedTaskAndReply( + scoped_ptr<gdata::DocumentFeed>* current_feed = + new scoped_ptr<gdata::DocumentFeed>; + gdata::util::PostBlockingPoolSequencedTaskAndReply( FROM_HERE, blocking_task_runner_, base::Bind(&ParseFeedOnBlockingPool, @@ -553,9 +555,10 @@ void GDataWapiFeedLoader::OnGetDocuments( base::Owned(current_feed))); } -void GDataWapiFeedLoader::OnParseFeed(scoped_ptr<LoadFeedParams> params, - base::TimeTicks start_time, - scoped_ptr<DocumentFeed>* current_feed) { +void GDataWapiFeedLoader::OnParseFeed( + scoped_ptr<LoadFeedParams> params, + base::TimeTicks start_time, + scoped_ptr<gdata::DocumentFeed>* current_feed) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(current_feed); @@ -628,7 +631,7 @@ void GDataWapiFeedLoader::OnParseFeed(scoped_ptr<LoadFeedParams> params, void GDataWapiFeedLoader::OnGetChangelist( scoped_ptr<LoadFeedParams> params, base::TimeTicks start_time, - GDataErrorCode status, + gdata::GDataErrorCode status, scoped_ptr<base::Value> data) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -650,7 +653,8 @@ void GDataWapiFeedLoader::OnGetChangelist( } GURL next_feed_url; - scoped_ptr<ChangeList> current_feed(ChangeList::CreateFrom(*data)); + scoped_ptr<gdata::ChangeList> current_feed( + gdata::ChangeList::CreateFrom(*data)); if (!current_feed.get()) { RunFeedLoadCallback(params.Pass(), DRIVE_FILE_ERROR_FAILED); return; @@ -662,7 +666,7 @@ void GDataWapiFeedLoader::OnGetChangelist( std::string file_name = base::StringPrintf("DEBUG_changelist_%" PRId64 ".json", params->start_changestamp); - util::PostBlockingPoolSequencedTask( + gdata::util::PostBlockingPoolSequencedTask( FROM_HERE, blocking_task_runner_, base::Bind(&SaveFeedOnBlockingPoolForDebugging, @@ -672,8 +676,8 @@ void GDataWapiFeedLoader::OnGetChangelist( #endif // Add the current feed to the list of collected feeds for this directory. - scoped_ptr<DocumentFeed> feed = - DocumentFeed::CreateFromChangeList(*current_feed); + scoped_ptr<gdata::DocumentFeed> feed = + gdata::DocumentFeed::CreateFromChangeList(*current_feed); params->feed_list.push_back(feed.release()); // Compute and notify the number of entries fetched so far. @@ -876,7 +880,7 @@ void GDataWapiFeedLoader::SaveFileSystem() { resource_metadata_->SerializeToString(serialized_proto.get()); resource_metadata_->set_last_serialized(base::Time::Now()); resource_metadata_->set_serialized_size(serialized_proto->size()); - util::PostBlockingPoolSequencedTask( + gdata::util::PostBlockingPoolSequencedTask( FROM_HERE, blocking_task_runner_, base::Bind(&SaveProtoOnBlockingPool, path, @@ -885,7 +889,7 @@ void GDataWapiFeedLoader::SaveFileSystem() { } DriveFileError GDataWapiFeedLoader::UpdateFromFeed( - const ScopedVector<DocumentFeed>& feed_list, + const ScopedVector<gdata::DocumentFeed>& feed_list, int64 start_changestamp, int64 root_feed_changestamp) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -914,4 +918,4 @@ DriveFileError GDataWapiFeedLoader::UpdateFromFeed( return error; } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/gdata_wapi_feed_loader.h b/chrome/browser/chromeos/drive/gdata_wapi_feed_loader.h index 8e54f5d..cade316 100644 --- a/chrome/browser/chromeos/drive/gdata_wapi_feed_loader.h +++ b/chrome/browser/chromeos/drive/gdata_wapi_feed_loader.h @@ -22,8 +22,11 @@ class Value; } namespace gdata { - class DocumentFeed; +} + +namespace drive { + class DriveCache; class DriveServiceInterface; class DriveWebAppsRegistryInterface; @@ -68,7 +71,7 @@ struct LoadFeedParams { GURL feed_to_load; const LoadDocumentFeedCallback feed_load_callback; FileOperationCallback load_finished_callback; - ScopedVector<DocumentFeed> feed_list; + ScopedVector<gdata::DocumentFeed> feed_list; scoped_ptr<GetDocumentsUiState> ui_state; }; @@ -149,7 +152,7 @@ class GDataWapiFeedLoader { // See comments at GDataWapiFeedProcessor::ApplyFeeds() for // |start_changestamp| and |root_feed_changestamp|. DriveFileError UpdateFromFeed( - const ScopedVector<DocumentFeed>& feed_list, + const ScopedVector<gdata::DocumentFeed>& feed_list, int64 start_changestamp, int64 root_feed_changestamp); @@ -172,7 +175,7 @@ class GDataWapiFeedLoader { ContentOrigin initial_origin, int64 local_changestamp, const FileOperationCallback& callback, - GDataErrorCode status, + gdata::GDataErrorCode status, scoped_ptr<base::Value> feed_data); // Helper callback for handling results of account data retrieval initiated @@ -183,13 +186,13 @@ class GDataWapiFeedLoader { ContentOrigin initial_origin, int64 local_changestamp, const FileOperationCallback& callback, - GDataErrorCode status, + gdata::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(GDataErrorCode status, + void OnGetApplicationList(gdata::GDataErrorCode status, scoped_ptr<base::Value> json); // Callback for handling feed content fetching while searching for file info. @@ -206,20 +209,20 @@ class GDataWapiFeedLoader { void OnGetDocuments( scoped_ptr<LoadFeedParams> params, base::TimeTicks start_time, - GDataErrorCode status, + gdata::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<DocumentFeed>* current_feed); + scoped_ptr<gdata::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, - GDataErrorCode status, + gdata::GDataErrorCode status, scoped_ptr<base::Value> data); // Save filesystem to disk. @@ -242,6 +245,6 @@ class GDataWapiFeedLoader { DISALLOW_COPY_AND_ASSIGN(GDataWapiFeedLoader); }; -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_GDATA_WAPI_FEED_LOADER_H_ diff --git a/chrome/browser/chromeos/drive/gdata_wapi_feed_loader_observer.h b/chrome/browser/chromeos/drive/gdata_wapi_feed_loader_observer.h index da0297d..f462297 100644 --- a/chrome/browser/chromeos/drive/gdata_wapi_feed_loader_observer.h +++ b/chrome/browser/chromeos/drive/gdata_wapi_feed_loader_observer.h @@ -9,7 +9,7 @@ class FilePath; -namespace gdata { +namespace drive { // Interface for classes that need to observe events from GdataWapiFeedLoader. // All events are notified on UI thread. @@ -34,6 +34,6 @@ class GDataWapiFeedLoaderObserver { virtual ~GDataWapiFeedLoaderObserver() {} }; -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_GDATA_WAPI_FEED_LOADER_OBSERVER_H_ diff --git a/chrome/browser/chromeos/drive/gdata_wapi_feed_processor.cc b/chrome/browser/chromeos/drive/gdata_wapi_feed_processor.cc index 780ec70..f21ba419 100644 --- a/chrome/browser/chromeos/drive/gdata_wapi_feed_processor.cc +++ b/chrome/browser/chromeos/drive/gdata_wapi_feed_processor.cc @@ -12,7 +12,7 @@ using content::BrowserThread; -namespace gdata { +namespace drive { FeedToFileResourceMapUmaStats::FeedToFileResourceMapUmaStats() : num_regular_files(0), @@ -31,7 +31,7 @@ GDataWapiFeedProcessor::~GDataWapiFeedProcessor() { } DriveFileError GDataWapiFeedProcessor::ApplyFeeds( - const ScopedVector<DocumentFeed>& feed_list, + const ScopedVector<gdata::DocumentFeed>& feed_list, int64 start_changestamp, int64 root_feed_changestamp, std::set<FilePath>* changed_dirs) { @@ -228,7 +228,7 @@ DriveDirectory* GDataWapiFeedProcessor::FindDirectoryForNewEntry( } DriveFileError GDataWapiFeedProcessor::FeedToFileResourceMap( - const ScopedVector<DocumentFeed>& feed_list, + const ScopedVector<gdata::DocumentFeed>& feed_list, FileResourceIdMap* file_map, int64* feed_changestamp, FeedToFileResourceMapUmaStats* uma_stats) { @@ -239,13 +239,13 @@ DriveFileError GDataWapiFeedProcessor::FeedToFileResourceMap( uma_stats->num_regular_files = 0; uma_stats->num_hosted_documents = 0; for (size_t i = 0; i < feed_list.size(); ++i) { - const DocumentFeed* feed = feed_list[i]; + const gdata::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 Link* root_feed_upload_link = - feed->GetLinkByType(Link::LINK_RESUMABLE_CREATE_MEDIA); + const gdata::Link* root_feed_upload_link = + feed->GetLinkByType(gdata::Link::LINK_RESUMABLE_CREATE_MEDIA); if (root_feed_upload_link) resource_metadata_->root()->set_upload_url( root_feed_upload_link->href()); @@ -253,10 +253,10 @@ DriveFileError GDataWapiFeedProcessor::FeedToFileResourceMap( DCHECK_GE(*feed_changestamp, 0); } - for (ScopedVector<DocumentEntry>::const_iterator iter = + for (ScopedVector<gdata::DocumentEntry>::const_iterator iter = feed->entries().begin(); iter != feed->entries().end(); ++iter) { - DocumentEntry* doc = *iter; + gdata::DocumentEntry* doc = *iter; scoped_ptr<DriveEntry> entry = resource_metadata_->FromDocumentEntry(*doc); // Some document entries don't map into files (i.e. sites). @@ -301,4 +301,4 @@ DriveFileError GDataWapiFeedProcessor::FeedToFileResourceMap( return error; } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/gdata_wapi_feed_processor.h b/chrome/browser/chromeos/drive/gdata_wapi_feed_processor.h index 2218cbc..c5cee22 100644 --- a/chrome/browser/chromeos/drive/gdata_wapi_feed_processor.h +++ b/chrome/browser/chromeos/drive/gdata_wapi_feed_processor.h @@ -14,7 +14,7 @@ #include "chrome/browser/google_apis/gdata_errorcode.h" #include "chrome/browser/google_apis/gdata_wapi_parser.h" -namespace gdata { +namespace drive { class DriveDirectory; class DriveEntry; @@ -46,8 +46,8 @@ class GDataWapiFeedProcessor { // // In the case of processing the root feeds |root_feed_changestamp| is used // as its initial changestamp value. The value comes from - // AccountMetadataFeed. - DriveFileError ApplyFeeds(const ScopedVector<DocumentFeed>& feed_list, + // gdata::AccountMetadataFeed. + DriveFileError ApplyFeeds(const ScopedVector<gdata::DocumentFeed>& feed_list, int64 start_changestamp, int64 root_feed_changestamp, std::set<FilePath>* changed_dirs); @@ -55,7 +55,7 @@ class GDataWapiFeedProcessor { // Converts list of document feeds from collected feeds into // FileResourceIdMap. DriveFileError FeedToFileResourceMap( - const ScopedVector<DocumentFeed>& feed_list, + const ScopedVector<gdata::DocumentFeed>& feed_list, FileResourceIdMap* file_map, int64* feed_changestamp, FeedToFileResourceMapUmaStats* uma_stats); @@ -104,6 +104,6 @@ class GDataWapiFeedProcessor { DISALLOW_COPY_AND_ASSIGN(GDataWapiFeedProcessor); }; -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_GDATA_WAPI_FEED_PROCESSOR_H_ diff --git a/chrome/browser/chromeos/drive/gdata_wapi_service.cc b/chrome/browser/chromeos/drive/gdata_wapi_service.cc index a73f1a7..e02a8e4 100644 --- a/chrome/browser/chromeos/drive/gdata_wapi_service.cc +++ b/chrome/browser/chromeos/drive/gdata_wapi_service.cc @@ -19,7 +19,7 @@ using content::BrowserThread; -namespace gdata { +namespace drive { namespace { @@ -79,7 +79,7 @@ GDataWapiService::~GDataWapiService() { } } -AuthService* GDataWapiService::auth_service_for_testing() { +gdata::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 OperationRunner(profile, scopes)); + runner_.reset(new gdata::OperationRunner(profile, scopes)); runner_->Initialize(); runner_->auth_service()->AddObserver(this); @@ -123,12 +123,13 @@ bool GDataWapiService::CancelForFilePath(const FilePath& file_path) { return operation_registry()->CancelForFilePath(file_path); } -OperationProgressStatusList GDataWapiService::GetProgressStatusList() const { +gdata::OperationProgressStatusList GDataWapiService::GetProgressStatusList() + const { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); return operation_registry()->GetProgressStatusList(); } -void GDataWapiService::Authenticate(const AuthStatusCallback& callback) { +void GDataWapiService::Authenticate(const gdata::AuthStatusCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); runner_->Authenticate(callback); } @@ -137,41 +138,44 @@ void GDataWapiService::GetDocuments(const GURL& url, int64 start_changestamp, const std::string& search_query, const std::string& directory_resource_id, - const GetDataCallback& callback) { + const gdata::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. - GetDocumentsOperation* operation = - new GetDocumentsOperation(operation_registry(), - url, - static_cast<int>(start_changestamp), - search_query, - directory_resource_id, - callback); + gdata::GetDocumentsOperation* operation = + new gdata::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 GetDataCallback& callback) { +void GDataWapiService::GetDocumentEntry( + const std::string& resource_id, + const gdata::GetDataCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - GetDocumentEntryOperation* operation = - new GetDocumentEntryOperation(operation_registry(), - resource_id, - callback); + gdata::GetDocumentEntryOperation* operation = + new gdata::GetDocumentEntryOperation(operation_registry(), + resource_id, + callback); runner_->StartOperationWithRetry(operation); } -void GDataWapiService::GetAccountMetadata(const GetDataCallback& callback) { +void GDataWapiService::GetAccountMetadata( + const gdata::GetDataCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - GetAccountMetadataOperation* operation = - new GetAccountMetadataOperation(operation_registry(), callback); + gdata::GetAccountMetadataOperation* operation = + new gdata::GetAccountMetadataOperation(operation_registry(), callback); runner_->StartOperationWithRetry(operation); } -void GDataWapiService::GetApplicationInfo(const GetDataCallback& callback) { +void GDataWapiService::GetApplicationInfo( + const gdata::GetDataCallback& callback) { // For WAPI, AccountMetadata includes Drive application information. GetAccountMetadata(callback); } @@ -181,132 +185,138 @@ void GDataWapiService::DownloadDocument( const FilePath& local_cache_path, const GURL& document_url, DocumentExportFormat format, - const DownloadActionCallback& callback) { + const gdata::DownloadActionCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DownloadFile( virtual_path, local_cache_path, chrome_common_net::AppendQueryParameter(document_url, - "exportFormat", - GetExportFormatParam(format)), + "exportFormat", + GetExportFormatParam(format)), callback, - GetContentCallback()); + gdata::GetContentCallback()); } void GDataWapiService::DownloadFile( - const FilePath& virtual_path, - const FilePath& local_cache_path, - const GURL& document_url, - const DownloadActionCallback& download_action_callback, - const GetContentCallback& get_content_callback) { + 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) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); runner_->StartOperationWithRetry( - new DownloadFileOperation(operation_registry(), - download_action_callback, - get_content_callback, document_url, - virtual_path, local_cache_path)); + new gdata::DownloadFileOperation(operation_registry(), + download_action_callback, + get_content_callback, document_url, + virtual_path, local_cache_path)); } -void GDataWapiService::DeleteDocument(const GURL& document_url, - const EntryActionCallback& callback) { +void GDataWapiService::DeleteDocument( + const GURL& document_url, + const gdata::EntryActionCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); runner_->StartOperationWithRetry( - new DeleteDocumentOperation(operation_registry(), callback, - document_url)); + new gdata::DeleteDocumentOperation(operation_registry(), callback, + document_url)); } void GDataWapiService::CreateDirectory( const GURL& parent_content_url, const FilePath::StringType& directory_name, - const GetDataCallback& callback) { + const gdata::GetDataCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); runner_->StartOperationWithRetry( - new CreateDirectoryOperation(operation_registry(), callback, - parent_content_url, directory_name)); + new gdata::CreateDirectoryOperation(operation_registry(), callback, + parent_content_url, directory_name)); } void GDataWapiService::CopyDocument(const std::string& resource_id, const FilePath::StringType& new_name, - const GetDataCallback& callback) { + const gdata::GetDataCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); runner_->StartOperationWithRetry( - new CopyDocumentOperation(operation_registry(), callback, - resource_id, new_name)); + new gdata::CopyDocumentOperation(operation_registry(), callback, + resource_id, new_name)); } -void GDataWapiService::RenameResource(const GURL& resource_url, - const FilePath::StringType& new_name, - const EntryActionCallback& callback) { +void GDataWapiService::RenameResource( + const GURL& resource_url, + const FilePath::StringType& new_name, + const gdata::EntryActionCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); runner_->StartOperationWithRetry( - new RenameResourceOperation(operation_registry(), callback, - resource_url, new_name)); + new gdata::RenameResourceOperation(operation_registry(), callback, + resource_url, new_name)); } void GDataWapiService::AddResourceToDirectory( const GURL& parent_content_url, const GURL& resource_url, - const EntryActionCallback& callback) { + const gdata::EntryActionCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); runner_->StartOperationWithRetry( - new AddResourceToDirectoryOperation(operation_registry(), - callback, - parent_content_url, - resource_url)); + new gdata::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 EntryActionCallback& callback) { + const gdata::EntryActionCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); runner_->StartOperationWithRetry( - new RemoveResourceFromDirectoryOperation(operation_registry(), - callback, - parent_content_url, - resource_url, - resource_id)); + new gdata::RemoveResourceFromDirectoryOperation(operation_registry(), + callback, + parent_content_url, + resource_url, + resource_id)); } -void GDataWapiService::InitiateUpload(const InitiateUploadParams& params, - const InitiateUploadCallback& callback) { +void GDataWapiService::InitiateUpload( + const gdata::InitiateUploadParams& params, + const gdata::InitiateUploadCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (params.upload_location.is_empty()) { if (!callback.is_null()) - callback.Run(HTTP_BAD_REQUEST, GURL()); + callback.Run(gdata::HTTP_BAD_REQUEST, GURL()); return; } runner_->StartOperationWithRetry( - new InitiateUploadOperation(operation_registry(), callback, params)); + new gdata::InitiateUploadOperation( + operation_registry(), callback, params)); } -void GDataWapiService::ResumeUpload(const ResumeUploadParams& params, - const ResumeUploadCallback& callback) { +void GDataWapiService::ResumeUpload( + const gdata::ResumeUploadParams& params, + const gdata::ResumeUploadCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); runner_->StartOperationWithRetry( - new ResumeUploadOperation(operation_registry(), callback, params)); + new gdata::ResumeUploadOperation( + operation_registry(), callback, params)); } void GDataWapiService::AuthorizeApp(const GURL& resource_url, const std::string& app_ids, - const GetDataCallback& callback) { + const gdata::GetDataCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); runner_->StartOperationWithRetry( - new AuthorizeAppsOperation(operation_registry(), callback, - resource_url, app_ids)); + new gdata::AuthorizeAppsOperation(operation_registry(), callback, + resource_url, app_ids)); } bool GDataWapiService::HasAccessToken() const { @@ -321,7 +331,7 @@ bool GDataWapiService::HasRefreshToken() const { return runner_->auth_service()->HasRefreshToken(); } -OperationRegistry* GDataWapiService::operation_registry() const { +gdata::OperationRegistry* GDataWapiService::operation_registry() const { return runner_->operation_registry(); } @@ -334,16 +344,16 @@ void GDataWapiService::OnOAuth2RefreshTokenChanged() { } void GDataWapiService::OnProgressUpdate( - const OperationProgressStatusList& list) { + const gdata::OperationProgressStatusList& list) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); FOR_EACH_OBSERVER( DriveServiceObserver, observers_, OnProgressUpdate(list)); } -void GDataWapiService::OnAuthenticationFailed(GDataErrorCode error) { +void GDataWapiService::OnAuthenticationFailed(gdata::GDataErrorCode error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); FOR_EACH_OBSERVER( DriveServiceObserver, observers_, OnAuthenticationFailed(error)); } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/gdata_wapi_service.h b/chrome/browser/chromeos/drive/gdata_wapi_service.h index 7a51d28..9db6be3 100644 --- a/chrome/browser/chromeos/drive/gdata_wapi_service.h +++ b/chrome/browser/chromeos/drive/gdata_wapi_service.h @@ -19,24 +19,26 @@ class GURL; class Profile; namespace gdata { - class AuthService; class OperationRunner; +} + +namespace drive { // This class provides documents feed service calls for WAPI (codename for // DocumentsList API). // 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 AuthServiceObserver, - public OperationRegistryObserver { + public gdata::AuthServiceObserver, + public gdata::OperationRegistryObserver { public: // Instance is usually created by DriveSystemServiceFactory and owned by // DriveFileSystem. GDataWapiService(); virtual ~GDataWapiService(); - AuthService* auth_service_for_testing(); + gdata::AuthService* auth_service_for_testing(); // DriveServiceInterface Overrides virtual void Initialize(Profile* profile) OVERRIDE; @@ -45,77 +47,87 @@ class GDataWapiService : public DriveServiceInterface, virtual bool CanStartOperation() const OVERRIDE; virtual void CancelAll() OVERRIDE; virtual bool CancelForFilePath(const FilePath& file_path) OVERRIDE; - virtual OperationProgressStatusList GetProgressStatusList() const OVERRIDE; - virtual void Authenticate(const AuthStatusCallback& callback) OVERRIDE; + virtual gdata::OperationProgressStatusList GetProgressStatusList() + const OVERRIDE; + virtual void Authenticate( + const gdata::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 GetDataCallback& callback) OVERRIDE; - virtual void GetDocumentEntry(const std::string& resource_id, - const GetDataCallback& callback) OVERRIDE; - - virtual void GetAccountMetadata(const GetDataCallback& callback) OVERRIDE; - virtual void GetApplicationInfo(const GetDataCallback& callback) OVERRIDE; - virtual void DeleteDocument(const GURL& document_url, - const EntryActionCallback& callback) OVERRIDE; + const gdata::GetDataCallback& callback) OVERRIDE; + virtual void GetDocumentEntry + (const std::string& resource_id, + const gdata::GetDataCallback& callback) OVERRIDE; + + virtual void GetAccountMetadata( + const gdata::GetDataCallback& callback) OVERRIDE; + virtual void GetApplicationInfo( + const gdata::GetDataCallback& callback) OVERRIDE; + virtual void DeleteDocument( + const GURL& document_url, + const gdata::EntryActionCallback& callback) OVERRIDE; virtual void DownloadDocument( const FilePath& virtual_path, const FilePath& local_cache_path, const GURL& content_url, DocumentExportFormat format, - const DownloadActionCallback& callback) OVERRIDE; + const gdata::DownloadActionCallback& callback) OVERRIDE; virtual void DownloadFile( const FilePath& virtual_path, const FilePath& local_cache_path, const GURL& content_url, - const DownloadActionCallback& download_action_callback, - const GetContentCallback& get_content_callback) OVERRIDE; + 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 GetDataCallback& callback) OVERRIDE; - virtual void RenameResource(const GURL& document_url, - const FilePath::StringType& new_name, - const EntryActionCallback& callback) OVERRIDE; + const gdata::GetDataCallback& callback) OVERRIDE; + virtual void RenameResource( + const GURL& document_url, + const FilePath::StringType& new_name, + const gdata::EntryActionCallback& callback) OVERRIDE; virtual void AddResourceToDirectory( const GURL& parent_content_url, const GURL& resource_url, - const EntryActionCallback& callback) OVERRIDE; + const gdata::EntryActionCallback& callback) OVERRIDE; virtual void RemoveResourceFromDirectory( const GURL& parent_content_url, const GURL& resource_url, const std::string& resource_id, - const EntryActionCallback& callback) OVERRIDE; - virtual void CreateDirectory(const GURL& parent_content_url, - const FilePath::StringType& directory_name, - const GetDataCallback& callback) OVERRIDE; - virtual void InitiateUpload(const InitiateUploadParams& params, - const InitiateUploadCallback& callback) OVERRIDE; - virtual void ResumeUpload(const ResumeUploadParams& params, - const ResumeUploadCallback& callback) OVERRIDE; + const gdata::EntryActionCallback& callback) OVERRIDE; + virtual void CreateDirectory( + const GURL& parent_content_url, + const FilePath::StringType& directory_name, + const gdata::GetDataCallback& callback) OVERRIDE; + virtual void InitiateUpload( + const gdata::InitiateUploadParams& params, + const gdata::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 GetDataCallback& callback) OVERRIDE; + const gdata::GetDataCallback& callback) OVERRIDE; private: - OperationRegistry* operation_registry() const; + gdata::OperationRegistry* operation_registry() const; // AuthService::Observer override. virtual void OnOAuth2RefreshTokenChanged() OVERRIDE; // DriveServiceObserver Overrides virtual void OnProgressUpdate( - const OperationProgressStatusList& list) OVERRIDE; - virtual void OnAuthenticationFailed(GDataErrorCode error) OVERRIDE; + const gdata::OperationProgressStatusList& list) OVERRIDE; + virtual void OnAuthenticationFailed(gdata::GDataErrorCode error) OVERRIDE; - scoped_ptr<OperationRunner> runner_; + scoped_ptr<gdata::OperationRunner> runner_; ObserverList<DriveServiceObserver> observers_; DISALLOW_COPY_AND_ASSIGN(GDataWapiService); }; -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_GDATA_WAPI_SERVICE_H_ diff --git a/chrome/browser/chromeos/drive/gdata_wapi_service_browsertest.cc b/chrome/browser/chromeos/drive/gdata_wapi_service_browsertest.cc index 9b81341..01675cc 100644 --- a/chrome/browser/chromeos/drive/gdata_wapi_service_browsertest.cc +++ b/chrome/browser/chromeos/drive/gdata_wapi_service_browsertest.cc @@ -16,7 +16,7 @@ #include "net/test/test_server.h" #include "testing/gtest/include/gtest/gtest.h" -namespace gdata { +namespace drive { namespace { @@ -31,7 +31,7 @@ class GDataTest : public InProcessBrowserTest { virtual void SetUpOnMainThread() OVERRIDE { ASSERT_TRUE(gdata_test_server_.Start()); - service_.reset(new gdata::GDataWapiService); + service_.reset(new GDataWapiService); service_->Initialize(browser()->profile()); service_->auth_service_for_testing()->set_access_token_for_testing( net::TestServer::kGDataAuthToken); @@ -47,7 +47,7 @@ class GDataTest : public InProcessBrowserTest { } net::TestServer gdata_test_server_; - scoped_ptr<gdata::GDataWapiService> service_; + scoped_ptr<GDataWapiService> service_; }; // The test callback for GDataWapiService::DownloadFile(). @@ -148,4 +148,4 @@ IN_PROC_BROWSER_TEST_F(GDataTest, GetDocumentsFailure) { EXPECT_FALSE(result_data); } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/mock_directory_change_observer.cc b/chrome/browser/chromeos/drive/mock_directory_change_observer.cc index 21d96b6..1331ab5 100644 --- a/chrome/browser/chromeos/drive/mock_directory_change_observer.cc +++ b/chrome/browser/chromeos/drive/mock_directory_change_observer.cc @@ -4,7 +4,7 @@ #include "chrome/browser/chromeos/drive/mock_directory_change_observer.h" -namespace gdata { +namespace drive { MockDirectoryChangeObserver::MockDirectoryChangeObserver() { } @@ -12,4 +12,4 @@ MockDirectoryChangeObserver::MockDirectoryChangeObserver() { MockDirectoryChangeObserver::~MockDirectoryChangeObserver() { } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/mock_directory_change_observer.h b/chrome/browser/chromeos/drive/mock_directory_change_observer.h index 38e361c..ba71384 100644 --- a/chrome/browser/chromeos/drive/mock_directory_change_observer.h +++ b/chrome/browser/chromeos/drive/mock_directory_change_observer.h @@ -9,7 +9,7 @@ #include "chrome/browser/chromeos/drive/drive_file_system_observer.h" #include "testing/gmock/include/gmock/gmock.h" -namespace gdata { +namespace drive { // Mock for DriveFileSystemInterface::Observer::OnDirectoryChanged(). class MockDirectoryChangeObserver : public DriveFileSystemObserver { @@ -21,6 +21,6 @@ class MockDirectoryChangeObserver : public DriveFileSystemObserver { MOCK_METHOD1(OnDirectoryChanged, void(const FilePath& directory_path)); }; -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_MOCK_DIRECTORY_CHANGE_OBSERVER_H_ diff --git a/chrome/browser/chromeos/drive/mock_drive_cache_observer.cc b/chrome/browser/chromeos/drive/mock_drive_cache_observer.cc index 5c31339..afab995 100644 --- a/chrome/browser/chromeos/drive/mock_drive_cache_observer.cc +++ b/chrome/browser/chromeos/drive/mock_drive_cache_observer.cc @@ -4,7 +4,7 @@ #include "chrome/browser/chromeos/drive/mock_drive_cache_observer.h" -namespace gdata { +namespace drive { MockDriveCacheObserver::MockDriveCacheObserver() { } @@ -12,4 +12,4 @@ MockDriveCacheObserver::MockDriveCacheObserver() { MockDriveCacheObserver::~MockDriveCacheObserver() { } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/mock_drive_cache_observer.h b/chrome/browser/chromeos/drive/mock_drive_cache_observer.h index 67eca6b..094d394 100644 --- a/chrome/browser/chromeos/drive/mock_drive_cache_observer.h +++ b/chrome/browser/chromeos/drive/mock_drive_cache_observer.h @@ -10,7 +10,7 @@ #include "chrome/browser/chromeos/drive/drive_cache_observer.h" #include "testing/gmock/include/gmock/gmock.h" -namespace gdata { +namespace drive { // Mock for DriveCache::Observer. class MockDriveCacheObserver : public DriveCacheObserver { @@ -25,6 +25,6 @@ class MockDriveCacheObserver : public DriveCacheObserver { MOCK_METHOD1(OnCacheCommitted, void(const std::string& resource_id)); }; -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_MOCK_DRIVE_CACHE_OBSERVER_H_ diff --git a/chrome/browser/chromeos/drive/mock_drive_file_system.cc b/chrome/browser/chromeos/drive/mock_drive_file_system.cc index 9c0070b..17ea163 100644 --- a/chrome/browser/chromeos/drive/mock_drive_file_system.cc +++ b/chrome/browser/chromeos/drive/mock_drive_file_system.cc @@ -4,7 +4,7 @@ #include "chrome/browser/chromeos/drive/mock_drive_file_system.h" -namespace gdata { +namespace drive { MockDriveFileSystem::MockDriveFileSystem() { } @@ -12,4 +12,4 @@ MockDriveFileSystem::MockDriveFileSystem() { MockDriveFileSystem::~MockDriveFileSystem() { } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/mock_drive_file_system.h b/chrome/browser/chromeos/drive/mock_drive_file_system.h index d89ba60..8498060 100644 --- a/chrome/browser/chromeos/drive/mock_drive_file_system.h +++ b/chrome/browser/chromeos/drive/mock_drive_file_system.h @@ -10,7 +10,7 @@ #include "chrome/browser/chromeos/drive/drive_file_system_interface.h" #include "testing/gmock/include/gmock/gmock.h" -namespace gdata { +namespace drive { class DriveFileSystemObserver; @@ -70,11 +70,11 @@ class MockDriveFileSystem : public DriveFileSystemInterface { MOCK_METHOD3(GetFileByPath, void(const FilePath& file_path, const GetFileCallback& get_file_callback, - const GetContentCallback& get_content_callback)); + const gdata::GetContentCallback& get_content_callback)); MOCK_METHOD3(GetFileByResourceId, void(const std::string& resource_id, const GetFileCallback& get_file_callback, - const GetContentCallback& get_content_callback)); + const gdata::GetContentCallback& get_content_callback)); MOCK_METHOD2(UpdateFileByResourceId, void(const std::string& resource_id, const FileOperationCallback& callback)); @@ -88,20 +88,20 @@ 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(UploadMode upload_mode, + virtual void AddUploadedFile(gdata::UploadMode upload_mode, const FilePath& file, - scoped_ptr<DocumentEntry> entry, + scoped_ptr<gdata::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<DocumentEntry> entry, + scoped_ptr<gdata::DocumentEntry> entry, const FilePath& file_content_path, const base::Closure& callback) OVERRIDE {} }; -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_MOCK_DRIVE_FILE_SYSTEM_H_ diff --git a/chrome/browser/chromeos/drive/mock_drive_service.cc b/chrome/browser/chromeos/drive/mock_drive_service.cc index 164d11f..dc42a75 100644 --- a/chrome/browser/chromeos/drive/mock_drive_service.cc +++ b/chrome/browser/chromeos/drive/mock_drive_service.cc @@ -20,11 +20,11 @@ using ::testing::_; using ::testing::Invoke; using ::testing::Return; -namespace gdata { +namespace drive { MockDriveService::MockDriveService() { ON_CALL(*this, GetProgressStatusList()) - .WillByDefault(Return(OperationProgressStatusList())); + .WillByDefault(Return(gdata::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_ = - test_util::LoadJSONFile("gdata/account_metadata.json"); - feed_data_ = test_util::LoadJSONFile("gdata/basic_feed.json"); + gdata::test_util::LoadJSONFile("gdata/account_metadata.json"); + feed_data_ = gdata::test_util::LoadJSONFile("gdata/basic_feed.json"); directory_data_ = - test_util::LoadJSONFile("gdata/new_folder_entry.json"); + gdata::test_util::LoadJSONFile("gdata/new_folder_entry.json"); } MockDriveService::~MockDriveService() {} void MockDriveService::set_search_result( const std::string& search_result_feed) { - search_result_ = test_util::LoadJSONFile(search_result_feed); + search_result_ = gdata::test_util::LoadJSONFile(search_result_feed); } void MockDriveService::AuthenticateStub( - const AuthStatusCallback& callback) { + const gdata::AuthStatusCallback& callback) { base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(callback, HTTP_SUCCESS, "my_auth_token")); + base::Bind(callback, gdata::HTTP_SUCCESS, "my_auth_token")); } void MockDriveService::GetDocumentsStub( @@ -78,31 +78,34 @@ void MockDriveService::GetDocumentsStub( int64 start_changestamp, const std::string& search_string, const std::string& directory_resource_id, - const GetDataCallback& callback) { + const gdata::GetDataCallback& callback) { if (search_string.empty()) { base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(callback, HTTP_SUCCESS, base::Passed(&feed_data_))); + base::Bind(callback, gdata::HTTP_SUCCESS, + base::Passed(&feed_data_))); } else { base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(callback, HTTP_SUCCESS, base::Passed(&search_result_))); + base::Bind(callback, gdata::HTTP_SUCCESS, + base::Passed(&search_result_))); } } void MockDriveService::GetAccountMetadataStub( - const GetDataCallback& callback) { + const gdata::GetDataCallback& callback) { base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(callback, HTTP_SUCCESS, base::Passed(&account_metadata_))); + base::Bind(callback, gdata::HTTP_SUCCESS, + base::Passed(&account_metadata_))); } void MockDriveService::DeleteDocumentStub( const GURL& document_url, - const EntryActionCallback& callback) { + const gdata::EntryActionCallback& callback) { base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(callback, HTTP_SUCCESS, document_url)); + base::Bind(callback, gdata::HTTP_SUCCESS, document_url)); } void MockDriveService::DownloadDocumentStub( @@ -110,65 +113,66 @@ void MockDriveService::DownloadDocumentStub( const FilePath& local_tmp_path, const GURL& content_url, DocumentExportFormat format, - const DownloadActionCallback& callback) { + const gdata::DownloadActionCallback& callback) { base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(callback, HTTP_SUCCESS, content_url, local_tmp_path)); + base::Bind(callback, gdata::HTTP_SUCCESS, content_url, local_tmp_path)); } void MockDriveService::CopyDocumentStub( const std::string& resource_id, const FilePath::StringType& new_name, - const GetDataCallback& callback) { + const gdata::GetDataCallback& callback) { base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(callback, HTTP_SUCCESS, base::Passed(&document_data_))); + base::Bind(callback, gdata::HTTP_SUCCESS, base::Passed(&document_data_))); } void MockDriveService::RenameResourceStub( const GURL& resource_url, const FilePath::StringType& new_name, - const EntryActionCallback& callback) { + const gdata::EntryActionCallback& callback) { base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(callback, HTTP_SUCCESS, resource_url)); + base::Bind(callback, gdata::HTTP_SUCCESS, resource_url)); } void MockDriveService::AddResourceToDirectoryStub( const GURL& parent_content_url, const GURL& resource_url, - const EntryActionCallback& callback) { + const gdata::EntryActionCallback& callback) { base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(callback, HTTP_SUCCESS, resource_url)); + base::Bind(callback, gdata::HTTP_SUCCESS, resource_url)); } void MockDriveService::RemoveResourceFromDirectoryStub( const GURL& parent_content_url, const GURL& resource_url, const std::string& resource_id, - const EntryActionCallback& callback) { + const gdata::EntryActionCallback& callback) { base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(callback, HTTP_SUCCESS, resource_url)); + base::Bind(callback, gdata::HTTP_SUCCESS, resource_url)); } void MockDriveService::CreateDirectoryStub( const GURL& parent_content_url, const FilePath::StringType& directory_name, - const GetDataCallback& callback) { + const gdata::GetDataCallback& callback) { base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(callback, HTTP_SUCCESS, base::Passed(&directory_data_))); + base::Bind(callback, gdata::HTTP_SUCCESS, + base::Passed(&directory_data_))); } void MockDriveService::DownloadFileStub( const FilePath& virtual_path, const FilePath& local_tmp_path, const GURL& content_url, - const DownloadActionCallback& download_action_callback, - const GetContentCallback& get_content_callback) { - GDataErrorCode error = HTTP_SUCCESS; + const gdata::DownloadActionCallback& download_action_callback, + const gdata::GetContentCallback& get_content_callback) { + gdata::GDataErrorCode error = gdata::HTTP_SUCCESS; if (file_data_.get()) { int file_data_size = static_cast<int>(file_data_->size()); ASSERT_EQ(file_data_size, @@ -180,4 +184,4 @@ void MockDriveService::DownloadFileStub( base::Bind(download_action_callback, error, content_url, local_tmp_path)); } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/mock_drive_service.h b/chrome/browser/chromeos/drive/mock_drive_service.h index 5265c21..9b0a756 100644 --- a/chrome/browser/chromeos/drive/mock_drive_service.h +++ b/chrome/browser/chromeos/drive/mock_drive_service.h @@ -15,7 +15,7 @@ class FilePath; -namespace gdata { +namespace drive { class MockDriveService : public DriveServiceInterface { public: @@ -30,57 +30,65 @@ class MockDriveService : public DriveServiceInterface { MOCK_CONST_METHOD0(CanStartOperation, bool()); MOCK_METHOD0(CancelAll, void(void)); MOCK_METHOD1(CancelForFilePath, bool(const FilePath& file_path)); - MOCK_CONST_METHOD0(GetProgressStatusList, OperationProgressStatusList()); - MOCK_METHOD1(Authenticate, void(const AuthStatusCallback& callback)); + 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 GetDataCallback& callback)); + const gdata::GetDataCallback& callback)); MOCK_METHOD2(GetDocumentEntry, void(const std::string& resource_id, - const GetDataCallback& callback)); - MOCK_METHOD1(GetAccountMetadata, void(const GetDataCallback& callback)); - MOCK_METHOD1(GetApplicationInfo, void(const GetDataCallback& callback)); - MOCK_METHOD2(DeleteDocument, void(const GURL& document_url, - const EntryActionCallback& callback)); - MOCK_METHOD5(DownloadDocument, void(const FilePath& virtual_path, - const FilePath& local_cache_path, - const GURL& content_url, - DocumentExportFormat format, - const DownloadActionCallback& callback)); + const gdata::GetDataCallback& callback)); + MOCK_METHOD1(GetAccountMetadata, + void(const gdata::GetDataCallback& callback)); + MOCK_METHOD1(GetApplicationInfo, + void(const gdata::GetDataCallback& callback)); + MOCK_METHOD2(DeleteDocument, + void(const GURL& document_url, + const gdata::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 GetDataCallback& callback)); - MOCK_METHOD3(RenameResource, void(const GURL& resource_url, - const FilePath::StringType& new_name, - const EntryActionCallback& callback)); + const gdata::GetDataCallback& callback)); + MOCK_METHOD3(RenameResource, + void(const GURL& resource_url, + const FilePath::StringType& new_name, + const gdata::EntryActionCallback& callback)); MOCK_METHOD3(AddResourceToDirectory, void(const GURL& parent_content_url, const GURL& resource_url, - const EntryActionCallback& callback)); + const gdata::EntryActionCallback& callback)); MOCK_METHOD4(RemoveResourceFromDirectory, void(const GURL& parent_content_url, const GURL& resource_url, const std::string& resource_id, - const EntryActionCallback& callback)); + const gdata::EntryActionCallback& callback)); MOCK_METHOD3(CreateDirectory, void(const GURL& parent_content_url, const FilePath::StringType& directory_name, - const GetDataCallback& callback)); + const gdata::GetDataCallback& callback)); MOCK_METHOD5(DownloadFile, void(const FilePath& virtual_path, const FilePath& local_cache_path, const GURL& content_url, - const DownloadActionCallback& donwload_action_callback, - const GetContentCallback& get_content_callback)); + const gdata::DownloadActionCallback& + donwload_action_callback, + const gdata::GetContentCallback& get_content_callback)); MOCK_METHOD2(InitiateUpload, - void(const InitiateUploadParams& upload_file_info, - const InitiateUploadCallback& callback)); - MOCK_METHOD2(ResumeUpload, void(const ResumeUploadParams& upload_file_info, - const ResumeUploadCallback& callback)); + void(const gdata::InitiateUploadParams& upload_file_info, + const gdata::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 GetDataCallback& callback)); + const gdata::GetDataCallback& callback)); MOCK_CONST_METHOD0(HasAccessToken, bool()); MOCK_CONST_METHOD0(HasRefreshToken, bool()); @@ -108,7 +116,7 @@ class MockDriveService : public DriveServiceInterface { // Will call |callback| with HTTP_SUCCESS and the token "test_auth_token" // as the token. - void AuthenticateStub(const AuthStatusCallback& callback); + void AuthenticateStub(const gdata::AuthStatusCallback& callback); // Will call |callback| with HTTP_SUCCESS and a StringValue with the current // value of |feed_data_|. @@ -116,15 +124,15 @@ class MockDriveService : public DriveServiceInterface { int64 start_changestamp, const std::string& search_string, const std::string& directory_resource_id, - const GetDataCallback& callback); + const gdata::GetDataCallback& callback); // Will call |callback| with HTTP_SUCCESS and a StringValue with the current // value of |account_metadata_|. - void GetAccountMetadataStub(const GetDataCallback& callback); + void GetAccountMetadataStub(const gdata::GetDataCallback& callback); // Will call |callback| with HTTP_SUCCESS and the |document_url|. void DeleteDocumentStub(const GURL& document_url, - const EntryActionCallback& callback); + const gdata::EntryActionCallback& callback); // Will call |callback| with HTTP_SUCCESS, the given URL, and the host+path // portion of the URL as the temporary file path. @@ -132,35 +140,36 @@ class MockDriveService : public DriveServiceInterface { const FilePath& local_tmp_path, const GURL& content_url, DocumentExportFormat format, - const DownloadActionCallback& callback); + const gdata::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 GetDataCallback& callback); + const gdata::GetDataCallback& callback); // Will call |callback| with HTTP_SUCCESS and the |document_url|. void RenameResourceStub(const GURL& document_url, const FilePath::StringType& new_name, - const EntryActionCallback& callback); + const gdata::EntryActionCallback& callback); // Will call |callback| with HTTP_SUCCESS and the |resource_url|. void AddResourceToDirectoryStub(const GURL& parent_content_url, const GURL& resource_url, - const EntryActionCallback& callback); + const gdata::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 EntryActionCallback& callback); + void RemoveResourceFromDirectoryStub( + const GURL& parent_content_url, + const GURL& resource_url, + const std::string& resource_id, + const gdata::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 GetDataCallback& callback); + const gdata::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, @@ -169,8 +178,8 @@ class MockDriveService : public DriveServiceInterface { const FilePath& virtual_path, const FilePath& local_tmp_path, const GURL& content_url, - const DownloadActionCallback& download_action_callback, - const GetContentCallback& get_content_callback); + const gdata::DownloadActionCallback& download_action_callback, + const gdata::GetContentCallback& get_content_callback); // Account meta data to be returned from GetAccountMetadata. scoped_ptr<base::Value> account_metadata_; @@ -193,6 +202,6 @@ class MockDriveService : public DriveServiceInterface { scoped_ptr<std::string> file_data_; }; -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_MOCK_DRIVE_SERVICE_H_ diff --git a/chrome/browser/chromeos/drive/mock_drive_uploader.cc b/chrome/browser/chromeos/drive/mock_drive_uploader.cc index c4e523b..4cdd7d5 100644 --- a/chrome/browser/chromeos/drive/mock_drive_uploader.cc +++ b/chrome/browser/chromeos/drive/mock_drive_uploader.cc @@ -4,7 +4,7 @@ #include "chrome/browser/chromeos/drive/mock_drive_uploader.h" -namespace gdata { +namespace drive { MockDriveUploader::MockDriveUploader() { } @@ -12,4 +12,4 @@ MockDriveUploader::MockDriveUploader() { MockDriveUploader::~MockDriveUploader() { } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/mock_drive_uploader.h b/chrome/browser/chromeos/drive/mock_drive_uploader.h index 4ffe9f4..4e4d424 100644 --- a/chrome/browser/chromeos/drive/mock_drive_uploader.h +++ b/chrome/browser/chromeos/drive/mock_drive_uploader.h @@ -9,7 +9,7 @@ #include "chrome/browser/chromeos/drive/drive_uploader.h" #include "testing/gmock/include/gmock/gmock.h" -namespace gdata { +namespace drive { class MockDriveUploader : public DriveUploaderInterface { public: @@ -48,6 +48,6 @@ class MockDriveUploader : public DriveUploaderInterface { MOCK_CONST_METHOD1(GetUploadedBytes, int64(int upload_id)); }; -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_MOCK_DRIVE_UPLOADER_H_ diff --git a/chrome/browser/chromeos/drive/mock_drive_web_apps_registry.cc b/chrome/browser/chromeos/drive/mock_drive_web_apps_registry.cc index a121bb8..765c925 100644 --- a/chrome/browser/chromeos/drive/mock_drive_web_apps_registry.cc +++ b/chrome/browser/chromeos/drive/mock_drive_web_apps_registry.cc @@ -4,7 +4,7 @@ #include "chrome/browser/chromeos/drive/mock_drive_web_apps_registry.h" -namespace gdata { +namespace drive { MockDriveWebAppsRegistry::MockDriveWebAppsRegistry() { } @@ -12,4 +12,4 @@ MockDriveWebAppsRegistry::MockDriveWebAppsRegistry() { MockDriveWebAppsRegistry::~MockDriveWebAppsRegistry() { } -} // namespace gdata +} // namespace drive 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 6797924..532e4e9 100644 --- a/chrome/browser/chromeos/drive/mock_drive_web_apps_registry.h +++ b/chrome/browser/chromeos/drive/mock_drive_web_apps_registry.h @@ -10,7 +10,7 @@ #include "chrome/browser/google_apis/drive_api_parser.h" #include "testing/gmock/include/gmock/gmock.h" -namespace gdata { +namespace drive { class MockDriveWebAppsRegistry : public DriveWebAppsRegistryInterface { public: @@ -22,10 +22,11 @@ class MockDriveWebAppsRegistry : public DriveWebAppsRegistryInterface { ScopedVector<DriveWebAppInfo>* apps)); MOCK_METHOD1(GetExtensionsForWebStoreApp, std::set<std::string>(const std::string& web_store_id)); - MOCK_METHOD1(UpdateFromFeed, void(const AccountMetadataFeed& metadata)); - MOCK_METHOD1(UpdateFromApplicationList, void(const AppList& applist)); + MOCK_METHOD1(UpdateFromFeed, + void(const gdata::AccountMetadataFeed& metadata)); + MOCK_METHOD1(UpdateFromApplicationList, void(const gdata::AppList& applist)); }; -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_MOCK_DRIVE_WEB_APPS_REGISTRY_H_ diff --git a/chrome/browser/chromeos/drive/mock_free_disk_space_getter.cc b/chrome/browser/chromeos/drive/mock_free_disk_space_getter.cc index 83f171e..60676b0 100644 --- a/chrome/browser/chromeos/drive/mock_free_disk_space_getter.cc +++ b/chrome/browser/chromeos/drive/mock_free_disk_space_getter.cc @@ -4,7 +4,7 @@ #include "chrome/browser/chromeos/drive/mock_free_disk_space_getter.h" -namespace gdata { +namespace drive { MockFreeDiskSpaceGetter::MockFreeDiskSpaceGetter() { } @@ -12,4 +12,4 @@ MockFreeDiskSpaceGetter::MockFreeDiskSpaceGetter() { MockFreeDiskSpaceGetter::~MockFreeDiskSpaceGetter() { } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/mock_free_disk_space_getter.h b/chrome/browser/chromeos/drive/mock_free_disk_space_getter.h index 016c90f..99f91b8 100644 --- a/chrome/browser/chromeos/drive/mock_free_disk_space_getter.h +++ b/chrome/browser/chromeos/drive/mock_free_disk_space_getter.h @@ -8,7 +8,7 @@ #include "chrome/browser/chromeos/drive/drive_cache.h" #include "testing/gmock/include/gmock/gmock.h" -namespace gdata { +namespace drive { class MockFreeDiskSpaceGetter : public FreeDiskSpaceGetterInterface { public: @@ -17,6 +17,6 @@ class MockFreeDiskSpaceGetter : public FreeDiskSpaceGetterInterface { MOCK_CONST_METHOD0(AmountOfFreeDiskSpace, int64()); }; -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_MOCK_FREE_DISK_SPACE_GETTER_H_ diff --git a/chrome/browser/chromeos/drive/stale_cache_files_remover.cc b/chrome/browser/chromeos/drive/stale_cache_files_remover.cc index aedf7b6..1451746 100644 --- a/chrome/browser/chromeos/drive/stale_cache_files_remover.cc +++ b/chrome/browser/chromeos/drive/stale_cache_files_remover.cc @@ -13,7 +13,7 @@ using content::BrowserThread; -namespace gdata { +namespace drive { namespace { @@ -21,7 +21,7 @@ namespace { void EmitErrorLog(DriveFileError error, const std::string& resource_id, const std::string& md5) { - if (error != gdata::DRIVE_FILE_OK) { + if (error != DRIVE_FILE_OK) { LOG(WARNING) << "Failed to remove a stale cache file. resource_id:" << resource_id; } @@ -45,7 +45,7 @@ StaleCacheFilesRemover::~StaleCacheFilesRemover() { void StaleCacheFilesRemover::OnInitialLoadFinished(DriveFileError error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - const FilePath root_path = FilePath(gdata::kDriveRootDirectory); + const FilePath root_path = FilePath(kDriveRootDirectory); cache_->GetResourceIdsOfAllFilesOnUIThread( base::Bind(&StaleCacheFilesRemover::OnGetResourceIdsOfAllFiles, weak_ptr_factory_.GetWeakPtr())); @@ -70,7 +70,7 @@ void StaleCacheFilesRemover::OnGetResourceIdsOfAllFiles( void StaleCacheFilesRemover::GetEntryInfoAndRemoveCacheIfNecessary( const std::string& resource_id, bool success, - const gdata::DriveCacheEntry& cache_entry) { + const DriveCacheEntry& cache_entry) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // Removes the cache if GetCacheEntryOnUIThread() failed. @@ -92,11 +92,11 @@ void StaleCacheFilesRemover::RemoveCacheIfNecessary( const std::string& cache_md5, DriveFileError error, const FilePath& drive_file_path, - scoped_ptr<gdata::DriveEntryProto> entry_proto) { + scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // The entry is not found in the file system. - if (error != gdata::DRIVE_FILE_OK) { + if (error != DRIVE_FILE_OK) { cache_->RemoveOnUIThread(resource_id, base::Bind(&EmitErrorLog)); return; } @@ -110,4 +110,4 @@ void StaleCacheFilesRemover::RemoveCacheIfNecessary( } } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/drive/stale_cache_files_remover.h b/chrome/browser/chromeos/drive/stale_cache_files_remover.h index a91ef0b..813c261 100644 --- a/chrome/browser/chromeos/drive/stale_cache_files_remover.h +++ b/chrome/browser/chromeos/drive/stale_cache_files_remover.h @@ -14,7 +14,7 @@ #include "chrome/browser/chromeos/drive/drive_file_system_observer.h" #include "chrome/browser/google_apis/gdata_errorcode.h" -namespace gdata{ +namespace drive{ class DriveCache; class DriveCacheEntry; @@ -44,7 +44,7 @@ class StaleCacheFilesRemover : public DriveFileSystemObserver { void GetEntryInfoAndRemoveCacheIfNecessary( const std::string& resource_id, bool success, - const gdata::DriveCacheEntry& cache_entry); + const DriveCacheEntry& cache_entry); // Check the cache file and removes if it is unavailable or invalid (eg. md5 // mismatch). This is called from GetCacheEntryAndRemoveCacheIfNecessary(); @@ -53,7 +53,7 @@ class StaleCacheFilesRemover : public DriveFileSystemObserver { const std::string& cache_md5, DriveFileError error, const FilePath& drive_file_path, - scoped_ptr<gdata::DriveEntryProto> entry_proto); + scoped_ptr<DriveEntryProto> entry_proto); DriveCache* cache_; // Not owned. DriveFileSystemInterface* file_system_; // Not owned. @@ -64,6 +64,6 @@ class StaleCacheFilesRemover : public DriveFileSystemObserver { DISALLOW_COPY_AND_ASSIGN(StaleCacheFilesRemover); }; -} // namespace gdata +} // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_STALE_CACHE_FILES_REMOVER_H_ 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 2c712da..d32282f 100644 --- a/chrome/browser/chromeos/drive/stale_cache_files_remover_unittest.cc +++ b/chrome/browser/chromeos/drive/stale_cache_files_remover_unittest.cc @@ -40,7 +40,7 @@ using ::testing::Return; using ::testing::StrictMock; using ::testing::_; -namespace gdata { +namespace drive { namespace { const int64 kLotsOfSpace = kMinFreeSpace * 10; @@ -113,7 +113,7 @@ class StaleCacheFilesRemoverTest : public testing::Test { stale_cache_files_remover_.reset(new StaleCacheFilesRemover(file_system_, cache_)); - test_util::RunBlockingPoolTask(); + gdata::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. - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); profile_.reset(NULL); } @@ -161,7 +161,8 @@ class StaleCacheFilesRemoverTest : public testing::Test { }; TEST_F(StaleCacheFilesRemoverTest, RemoveStaleCacheFiles) { - FilePath dummy_file = test_util::GetTestFilePath("gdata/root_feed.json"); + FilePath dummy_file = + gdata::test_util::GetTestFilePath("gdata/root_feed.json"); std::string resource_id("pdf:1a2b3c"); std::string md5("abcdef0123456789"); @@ -171,8 +172,8 @@ TEST_F(StaleCacheFilesRemoverTest, RemoveStaleCacheFiles) { // Create a stale cache file. cache_->StoreOnUIThread(resource_id, md5, dummy_file, DriveCache::FILE_OPERATION_COPY, - base::Bind(&gdata::VerifyCacheFileState)); - test_util::RunBlockingPoolTask(); + base::Bind(&VerifyCacheFileState)); + gdata::test_util::RunBlockingPoolTask(); // Verify that the cache file exists. FilePath path = cache_->GetCacheFilePath(resource_id, @@ -196,7 +197,7 @@ TEST_F(StaleCacheFilesRemoverTest, RemoveStaleCacheFiles) { &error, &unused, &entry_proto)); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); file_system_->GetEntryInfoByPath( @@ -204,7 +205,7 @@ TEST_F(StaleCacheFilesRemoverTest, RemoveStaleCacheFiles) { base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback, &error, &entry_proto)); - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); EXPECT_FALSE(entry_proto.get()); @@ -212,7 +213,7 @@ TEST_F(StaleCacheFilesRemoverTest, RemoveStaleCacheFiles) { LoadRootFeedDocument("gdata/root_feed.json"); // Wait for StaleCacheFilesRemover to finish cleaning up the stale file. - test_util::RunBlockingPoolTask(); + gdata::test_util::RunBlockingPoolTask(); // Verify that the cache file is deleted. path = cache_->GetCacheFilePath(resource_id, @@ -222,4 +223,4 @@ TEST_F(StaleCacheFilesRemoverTest, RemoveStaleCacheFiles) { EXPECT_FALSE(file_util::PathExists(path)); } -} // namespace gdata +} // namespace drive diff --git a/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc b/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc index 640fc1b..0d6df25 100644 --- a/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc +++ b/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc @@ -253,13 +253,13 @@ class RemoteFileSystemExtensionApiTest : public ExtensionApiTest { FilePath tmp_dir_path; PathService::Get(base::DIR_TEMP, &tmp_dir_path); ASSERT_TRUE(test_cache_root_.CreateUniqueTempDirUnderPath(tmp_dir_path)); - gdata::DriveSystemServiceFactory::set_cache_root_for_test( + drive::DriveSystemServiceFactory::set_cache_root_for_test( test_cache_root_.path().value()); - mock_drive_service_ = new gdata::MockDriveService(); + mock_drive_service_ = new drive::MockDriveService(); // |mock_drive_service_| will eventually get owned by a system service. - gdata::DriveSystemServiceFactory::set_drive_service_for_test( + drive::DriveSystemServiceFactory::set_drive_service_for_test( mock_drive_service_); ExtensionApiTest::SetUp(); @@ -267,14 +267,14 @@ class RemoteFileSystemExtensionApiTest : public ExtensionApiTest { virtual void TearDown() OVERRIDE { // Let's make sure we don't leak documents service. - gdata::DriveSystemServiceFactory::set_drive_service_for_test(NULL); - gdata::DriveSystemServiceFactory::set_cache_root_for_test(std::string()); + drive::DriveSystemServiceFactory::set_drive_service_for_test(NULL); + drive::DriveSystemServiceFactory::set_cache_root_for_test(std::string()); ExtensionApiTest::TearDown(); } protected: ScopedTempDir test_cache_root_; - gdata::MockDriveService* mock_drive_service_; + drive::MockDriveService* mock_drive_service_; }; IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, LocalFileSystem) { diff --git a/chrome/browser/chromeos/extensions/file_browser_event_router.cc b/chrome/browser/chromeos/extensions/file_browser_event_router.cc index 4e7bd4f..3745126 100644 --- a/chrome/browser/chromeos/extensions/file_browser_event_router.cc +++ b/chrome/browser/chromeos/extensions/file_browser_event_router.cc @@ -37,8 +37,8 @@ using chromeos::disks::DiskMountManager; using chromeos::disks::DiskMountManagerEventType; using content::BrowserThread; -using gdata::DriveSystemService; -using gdata::DriveSystemServiceFactory; +using drive::DriveSystemService; +using drive::DriveSystemServiceFactory; namespace { const char kDiskAddedEventType[] = "added"; @@ -172,8 +172,8 @@ bool FileBrowserEventRouter::AddFileWatch( // Tweak watch path for remote sources - we need to drop leading /special // directory from there in order to be able to pair these events with // their change notifications. - if (gdata::util::GetSpecialRemoteRootPath().IsParent(watch_path)) { - watch_path = gdata::util::ExtractDrivePath(watch_path); + if (drive::util::GetSpecialRemoteRootPath().IsParent(watch_path)) { + watch_path = drive::util::ExtractDrivePath(watch_path); is_remote_watch = true; BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, @@ -208,8 +208,8 @@ void FileBrowserEventRouter::RemoveFileWatch( // Tweak watch path for remote sources - we need to drop leading /special // directory from there in order to be able to pair these events with // their change notifications. - if (gdata::util::GetSpecialRemoteRootPath().IsParent(watch_path)) { - watch_path = gdata::util::ExtractDrivePath(watch_path); + if (drive::util::GetSpecialRemoteRootPath().IsParent(watch_path)) { + watch_path = drive::util::ExtractDrivePath(watch_path); BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::Bind(&FileBrowserEventRouter::HandleRemoteUpdateRequestOnUIThread, @@ -254,7 +254,7 @@ void FileBrowserEventRouter::OnAuthenticated( error_code = chromeos::MOUNT_ERROR_NOT_AUTHENTICATED; // Pass back the gdata mount point path as source path. - const std::string& gdata_path = gdata::util::GetDriveMountPointPathAsString(); + const std::string& gdata_path = drive::util::GetDriveMountPointPathAsString(); DiskMountManager::MountPointInfo mount_info( gdata_path, gdata_path, @@ -271,7 +271,7 @@ void FileBrowserEventRouter::OnAuthenticated( void FileBrowserEventRouter::HandleRemoteUpdateRequestOnUIThread(bool start) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - gdata::DriveFileSystemInterface* file_system = GetRemoteFileSystem(); + drive::DriveFileSystemInterface* file_system = GetRemoteFileSystem(); DCHECK(file_system); if (start) { @@ -357,11 +357,11 @@ void FileBrowserEventRouter::MountCompleted( FilePath source_path(mount_info.source_path); DriveSystemService* system_service = DriveSystemServiceFactory::GetForProfile(profile_); - gdata::DriveCache* cache = + drive::DriveCache* cache = system_service ? system_service->cache() : NULL; if (cache) { cache->SetMountedStateOnUIThread( - source_path, false, gdata::ChangeCacheStateCallback()); + source_path, false, drive::ChangeCacheStateCallback()); } } } @@ -461,7 +461,7 @@ void FileBrowserEventRouter::OnFileSystemBeingUnmounted() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // Raise a MountCompleted event to notify the File Manager. - const std::string& gdata_path = gdata::util::GetDriveMountPointPathAsString(); + const std::string& gdata_path = drive::util::GetDriveMountPointPathAsString(); DiskMountManager::MountPointInfo mount_info( gdata_path, gdata_path, @@ -479,7 +479,7 @@ void FileBrowserEventRouter::OnAuthenticationFailed( return; // Raise a MountCompleted event to notify the File Manager. - const std::string& gdata_path = gdata::util::GetDriveMountPointPathAsString(); + const std::string& gdata_path = drive::util::GetDriveMountPointPathAsString(); DiskMountManager::MountPointInfo mount_info( gdata_path, gdata_path, @@ -825,7 +825,7 @@ FileBrowserEventRouter::FileWatcherExtensions::GetVirtualPath() const { return virtual_path_; } -gdata::DriveFileSystemInterface* +drive::DriveFileSystemInterface* FileBrowserEventRouter::GetRemoteFileSystem() const { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DriveSystemService* system_service = diff --git a/chrome/browser/chromeos/extensions/file_browser_event_router.h b/chrome/browser/chromeos/extensions/file_browser_event_router.h index 4273484..1b8c1b2 100644 --- a/chrome/browser/chromeos/extensions/file_browser_event_router.h +++ b/chrome/browser/chromeos/extensions/file_browser_event_router.h @@ -30,7 +30,7 @@ class FileBrowserNotifications; class PrefChangeRegistrar; class Profile; -namespace gdata { +namespace drive { class DriveEntryProto; class DriveFileSystemInterface; } @@ -42,8 +42,8 @@ class FileBrowserEventRouter public chromeos::disks::DiskMountManager::Observer, public chromeos::NetworkLibrary::NetworkManagerObserver, public content::NotificationObserver, - public gdata::DriveFileSystemObserver, - public gdata::DriveServiceObserver { + public drive::DriveFileSystemObserver, + public drive::DriveServiceObserver { public: // RefcountedProfileKeyedService overrides. virtual void ShutdownOnUIThread() OVERRIDE; @@ -84,12 +84,12 @@ class FileBrowserEventRouter const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE; - // gdata::DriveServiceObserver overrides. + // drive::DriveServiceObserver overrides. virtual void OnProgressUpdate( const gdata::OperationProgressStatusList& list) OVERRIDE; virtual void OnAuthenticationFailed(gdata::GDataErrorCode error) OVERRIDE; - // gdata::DriveFileSystemInterface::Observer overrides. + // drive::DriveFileSystemInterface::Observer overrides. virtual void OnDirectoryChanged(const FilePath& directory_path) OVERRIDE; virtual void OnDocumentFeedFetched(int num_accumulated_entries) OVERRIDE; virtual void OnFileSystemMounted() OVERRIDE; @@ -189,7 +189,7 @@ class FileBrowserEventRouter bool small); // Returns the DriveFileSystem for the current profile. - gdata::DriveFileSystemInterface* GetRemoteFileSystem() const; + drive::DriveFileSystemInterface* GetRemoteFileSystem() const; // Handles requests to start and stop periodic updates on remote file system. // When |start| is set to true, this function starts periodic updates only if diff --git a/chrome/browser/chromeos/extensions/file_browser_handler_api.cc b/chrome/browser/chromeos/extensions/file_browser_handler_api.cc index dd301f7..6d74190 100644 --- a/chrome/browser/chromeos/extensions/file_browser_handler_api.cc +++ b/chrome/browser/chromeos/extensions/file_browser_handler_api.cc @@ -383,7 +383,7 @@ void FileHandlerSelectFileFunction::GrantPermissions() { full_path_, file_handler_util::GetReadWritePermissions())); - if (!gdata::util::IsUnderDriveMountPoint(full_path_)) { + if (!drive::util::IsUnderDriveMountPoint(full_path_)) { // If the file is not on drive, we have to only grant permission for the // file's virtual path. OnGotPermissionsToGrant(); @@ -395,7 +395,7 @@ void FileHandlerSelectFileFunction::GrantPermissions() { scoped_ptr<std::vector<FilePath> > gdata_paths(new std::vector<FilePath>()); gdata_paths->push_back(virtual_path_); - gdata::util::InsertDriveCachePathsPermissions( + drive::util::InsertDriveCachePathsPermissions( profile(), gdata_paths.Pass(), &permissions_to_grant_, diff --git a/chrome/browser/chromeos/extensions/file_browser_private_api.cc b/chrome/browser/chromeos/extensions/file_browser_private_api.cc index c6d8898..7a51916 100644 --- a/chrome/browser/chromeos/extensions/file_browser_private_api.cc +++ b/chrome/browser/chromeos/extensions/file_browser_private_api.cc @@ -188,7 +188,7 @@ void AddDriveMountPoint( if (!provider) return; - const FilePath mount_point = gdata::util::GetDriveMountPointPath(); + const FilePath mount_point = drive::util::GetDriveMountPointPath(); if (!render_view_host || !render_view_host->GetProcess()) return; @@ -199,12 +199,12 @@ void AddDriveMountPoint( file_handler_util::GetReadWritePermissions()); // Grant R/W permission for tmp and pinned cache folder. - gdata::DriveSystemService* system_service = - gdata::DriveSystemServiceFactory::GetForProfile(profile); + drive::DriveSystemService* system_service = + drive::DriveSystemServiceFactory::GetForProfile(profile); // |system_service| is NULL if incognito window / guest login. if (!system_service || !system_service->file_system()) return; - gdata::DriveCache* cache = system_service->cache(); + drive::DriveCache* cache = system_service->cache(); // We check permissions for raw cache file paths only for read-only // operations (when fileEntry.file() is called), so read only permissions @@ -212,12 +212,12 @@ void AddDriveMountPoint( // operations the file access check is done for drive/ paths. GrantFilePermissionsToHost(render_view_host, cache->GetCacheDirectoryPath( - gdata::DriveCache::CACHE_TYPE_TMP), + drive::DriveCache::CACHE_TYPE_TMP), file_handler_util::GetReadOnlyPermissions()); GrantFilePermissionsToHost( render_view_host, cache->GetCacheDirectoryPath( - gdata::DriveCache::CACHE_TYPE_PERSISTENT), + drive::DriveCache::CACHE_TYPE_PERSISTENT), file_handler_util::GetReadOnlyPermissions()); FilePath mount_point_virtual; @@ -521,13 +521,13 @@ void RequestLocalFileSystemFunction::RespondSuccessOnUIThread( // Add drive mount point immediately when we kick of first instance of file // manager. The actual mount event will be sent to UI only when we perform // proper authentication. - if (gdata::DriveSystemService::IsDriveEnabled(profile_)) + if (drive::DriveSystemService::IsDriveEnabled(profile_)) AddDriveMountPoint(profile_, extension_id(), render_view_host()); DictionaryValue* dict = new DictionaryValue(); SetResult(dict); dict->SetString("name", name); dict->SetString("path", root_path.spec()); - dict->SetInteger("error", gdata::DRIVE_FILE_OK); + dict->SetInteger("error", drive::DRIVE_FILE_OK); SendResponse(true); } @@ -630,7 +630,7 @@ bool RemoveFileWatchBrowserFunction::PerformFileWatchOperation( // static void GetFileTasksFileBrowserFunction::IntersectAvailableDriveTasks( - gdata::DriveWebAppsRegistry* registry, + drive::DriveWebAppsRegistry* registry, const FileInfoList& file_info_list, WebAppInfoMap* app_info, std::set<std::string>* available_tasks) { @@ -638,13 +638,13 @@ void GetFileTasksFileBrowserFunction::IntersectAvailableDriveTasks( file_iter != file_info_list.end(); ++file_iter) { if (file_iter->file_path.empty()) continue; - ScopedVector<gdata::DriveWebAppInfo> info; + ScopedVector<drive::DriveWebAppInfo> info; registry->GetWebAppsForFile(file_iter->file_path, file_iter->mime_type, &info); - std::vector<gdata::DriveWebAppInfo*> info_ptrs; + std::vector<drive::DriveWebAppInfo*> info_ptrs; info.release(&info_ptrs); // so they don't go away prematurely. std::set<std::string> tasks_for_this_file; - for (std::vector<gdata::DriveWebAppInfo*>::iterator + for (std::vector<drive::DriveWebAppInfo*>::iterator apps = info_ptrs.begin(); apps != info_ptrs.end(); ++apps) { std::pair<WebAppInfoMap::iterator, bool> insert_result = app_info->insert(std::make_pair((*apps)->app_id, *apps)); @@ -702,7 +702,7 @@ void GetFileTasksFileBrowserFunction::FindDefaultDriveTasks( // static void GetFileTasksFileBrowserFunction::CreateDriveTasks( - gdata::DriveWebAppsRegistry* registry, + drive::DriveWebAppsRegistry* registry, const WebAppInfoMap& app_info, const std::set<std::string>& available_tasks, const std::set<std::string>& default_tasks, @@ -722,7 +722,7 @@ void GetFileTasksFileBrowserFunction::CreateDriveTasks( WebAppInfoMap::const_iterator info_iter = app_info.find(app_id); DCHECK(info_iter != app_info.end()); - gdata::DriveWebAppInfo* info = info_iter->second; + drive::DriveWebAppInfo* info = info_iter->second; DictionaryValue* task = new DictionaryValue; task->SetString("taskId", *app_iter); @@ -759,19 +759,19 @@ bool GetFileTasksFileBrowserFunction::FindDriveAppTasks( if (file_info_list.empty()) return true; - gdata::DriveSystemService* system_service = - gdata::DriveSystemServiceFactory::GetForProfile(profile_); + drive::DriveSystemService* system_service = + drive::DriveSystemServiceFactory::GetForProfile(profile_); // |system_service| is NULL if incognito window / guest login. We return true // in this case because there might be other extension tasks, even if we don't // have any to add. if (!system_service || !system_service->webapps_registry()) return true; - gdata::DriveWebAppsRegistry* registry = system_service->webapps_registry(); + drive::DriveWebAppsRegistry* registry = system_service->webapps_registry(); // Map of app_id to DriveWebAppInfo so we can look up the apps we've found // after taking the intersection of available apps. - std::map<std::string, gdata::DriveWebAppInfo*> app_info; + std::map<std::string, drive::DriveWebAppInfo*> app_info; // Set of application IDs. This will end up with the intersection of the // application IDs that apply to the paths in |file_paths|. std::set<std::string> available_tasks; @@ -1348,7 +1348,7 @@ bool AddMountFunction::RunImpl() { const bool success = true; // Pass back the drive mount point path as source path. const std::string& drive_path = - gdata::util::GetDriveMountPointPathAsString(); + drive::util::GetDriveMountPointPathAsString(); SetResult(Value::CreateStringValue(drive_path)); FileBrowserEventRouterFactory::GetForProfile(profile_)-> MountDrive(base::Bind(&AddMountFunction::SendResponse, @@ -1385,9 +1385,9 @@ void AddMountFunction::GetLocalPathsResponseOnUIThread( const FilePath& source_path = files[0].local_path; const FilePath::StringType& display_name = files[0].display_name; // Check if the source path is under Drive cache directory. - gdata::DriveSystemService* system_service = - gdata::DriveSystemServiceFactory::GetForProfile(profile_); - gdata::DriveCache* cache = system_service ? system_service->cache() : NULL; + drive::DriveSystemService* system_service = + drive::DriveSystemServiceFactory::GetForProfile(profile_); + drive::DriveCache* cache = system_service ? system_service->cache() : NULL; if (cache && cache->IsUnderDriveCacheDirectory(source_path)) { cache->SetMountedStateOnUIThread( source_path, @@ -1396,13 +1396,13 @@ void AddMountFunction::GetLocalPathsResponseOnUIThread( display_name)); } else { OnMountedStateSet(mount_type_str, display_name, - gdata::DRIVE_FILE_OK, source_path); + drive::DRIVE_FILE_OK, source_path); } } void AddMountFunction::OnMountedStateSet(const std::string& mount_type, const FilePath::StringType& file_name, - gdata::DriveFileError error, + drive::DriveFileError error, const FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DiskMountManager* disk_mount_manager = DiskMountManager::GetInstance(); @@ -1515,11 +1515,11 @@ void GetSizeStatsFunction::GetLocalPathsResponseOnUIThread( return; } - if (files[0].file_path == gdata::util::GetDriveMountPointPath()) { - gdata::DriveSystemService* system_service = - gdata::DriveSystemServiceFactory::GetForProfile(profile_); + if (files[0].file_path == drive::util::GetDriveMountPointPath()) { + drive::DriveSystemService* system_service = + drive::DriveSystemServiceFactory::GetForProfile(profile_); - gdata::DriveFileSystemInterface* file_system = + drive::DriveFileSystemInterface* file_system = system_service->file_system(); file_system->GetAvailableSpace( @@ -1537,12 +1537,12 @@ void GetSizeStatsFunction::GetLocalPathsResponseOnUIThread( } void GetSizeStatsFunction::GetDriveAvailableSpaceCallback( - gdata::DriveFileError error, + drive::DriveFileError error, int64 bytes_total, int64 bytes_used) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (error == gdata::DRIVE_FILE_OK) { + if (error == drive::DRIVE_FILE_OK) { int64 bytes_remaining = bytes_total - bytes_used; GetSizeStatsCallbackOnUIThread(static_cast<size_t>(bytes_total/1024), static_cast<size_t>(bytes_remaining/1024)); @@ -2025,7 +2025,7 @@ bool FileDialogStringsFunction::RunImpl() { ChromeURLDataManager::DataSource::SetFontAndTextDirection(dict); dict->SetBoolean("ENABLE_GDATA", - gdata::DriveSystemService::IsDriveEnabled(profile())); + drive::DriveSystemService::IsDriveEnabled(profile())); #if defined(USE_ASH) dict->SetBoolean("ASH", true); @@ -2053,13 +2053,13 @@ GetDriveFilePropertiesFunction::~GetDriveFilePropertiesFunction() { void GetDriveFilePropertiesFunction::DoOperation( const FilePath& file_path, base::DictionaryValue* property_dict, - scoped_ptr<gdata::DriveEntryProto> entry_proto) { + scoped_ptr<drive::DriveEntryProto> entry_proto) { DCHECK(property_dict); // Nothing to do here so simply call OnOperationComplete(). OnOperationComplete(file_path, property_dict, - gdata::DRIVE_FILE_OK, + drive::DRIVE_FILE_OK, entry_proto.Pass()); } @@ -2100,8 +2100,8 @@ void GetDriveFilePropertiesFunction::GetNextFileProperties() { file_properties_->Append(property_dict); // Start getting the file info. - gdata::DriveSystemService* system_service = - gdata::DriveSystemServiceFactory::GetForProfile(profile_); + drive::DriveSystemService* system_service = + drive::DriveSystemServiceFactory::GetForProfile(profile_); system_service->file_system()->GetEntryInfoByPath( file_path, base::Bind(&GetDriveFilePropertiesFunction::OnGetFileInfo, @@ -2121,14 +2121,14 @@ void GetDriveFilePropertiesFunction::CompleteGetFileProperties() { void GetDriveFilePropertiesFunction::OnGetFileInfo( const FilePath& file_path, base::DictionaryValue* property_dict, - gdata::DriveFileError error, - scoped_ptr<gdata::DriveEntryProto> entry_proto) { + drive::DriveFileError error, + scoped_ptr<drive::DriveEntryProto> entry_proto) { DCHECK(property_dict); if (entry_proto.get() && !entry_proto->has_file_specific_info()) - error = gdata::DRIVE_FILE_ERROR_NOT_FOUND; + error = drive::DRIVE_FILE_ERROR_NOT_FOUND; - if (error == gdata::DRIVE_FILE_OK) + if (error == drive::DRIVE_FILE_OK) DoOperation(file_path, property_dict, entry_proto.Pass()); else OnOperationComplete(file_path, property_dict, error, entry_proto.Pass()); @@ -2137,19 +2137,19 @@ void GetDriveFilePropertiesFunction::OnGetFileInfo( void GetDriveFilePropertiesFunction::OnOperationComplete( const FilePath& file_path, base::DictionaryValue* property_dict, - gdata::DriveFileError error, - scoped_ptr<gdata::DriveEntryProto> entry_proto) { + drive::DriveFileError error, + scoped_ptr<drive::DriveEntryProto> entry_proto) { if (entry_proto.get() && !entry_proto->has_file_specific_info()) - error = gdata::DRIVE_FILE_ERROR_NOT_FOUND; + error = drive::DRIVE_FILE_ERROR_NOT_FOUND; - if (error != gdata::DRIVE_FILE_OK) { + if (error != drive::DRIVE_FILE_OK) { property_dict->SetInteger("errorCode", error); CompleteGetFileProperties(); return; } DCHECK(entry_proto.get()); - const gdata::DriveFileSpecificInfo& file_specific_info = + const drive::DriveFileSpecificInfo& file_specific_info = entry_proto->file_specific_info(); property_dict->SetString("thumbnailUrl", file_specific_info.thumbnail_url()); if (!file_specific_info.alternate_url().empty()) @@ -2165,11 +2165,11 @@ void GetDriveFilePropertiesFunction::OnOperationComplete( property_dict->SetString("contentMimeType", file_specific_info.content_mime_type()); - gdata::DriveSystemService* system_service = - gdata::DriveSystemServiceFactory::GetForProfile(profile_); + drive::DriveSystemService* system_service = + drive::DriveSystemServiceFactory::GetForProfile(profile_); // Get drive WebApps that can accept this file. - ScopedVector<gdata::DriveWebAppInfo> web_apps; + ScopedVector<drive::DriveWebAppInfo> web_apps; system_service->webapps_registry()->GetWebAppsForFile( file_path, file_specific_info.content_mime_type(), &web_apps); if (!web_apps.empty()) { @@ -2183,10 +2183,10 @@ void GetDriveFilePropertiesFunction::OnOperationComplete( ListValue* apps = new ListValue(); property_dict->Set("driveApps", apps); - for (ScopedVector<gdata::DriveWebAppInfo>::const_iterator it = + for (ScopedVector<drive::DriveWebAppInfo>::const_iterator it = web_apps.begin(); it != web_apps.end(); ++it) { - const gdata::DriveWebAppInfo* webapp_info = *it; + const drive::DriveWebAppInfo* webapp_info = *it; DictionaryValue* app = new DictionaryValue(); app->SetString("appId", webapp_info->app_id); app->SetString("appName", webapp_info->app_name); @@ -2225,7 +2225,7 @@ void GetDriveFilePropertiesFunction::OnOperationComplete( void GetDriveFilePropertiesFunction::CacheStateReceived( base::DictionaryValue* property_dict, bool /* success */, - const gdata::DriveCacheEntry& cache_entry) { + const drive::DriveCacheEntry& cache_entry) { // In case of an error (i.e. success is false), cache_entry.is_*() all // returns false. property_dict->SetBoolean("isPinned", cache_entry.is_pinned()); @@ -2254,17 +2254,17 @@ bool PinDriveFileFunction::RunImpl() { void PinDriveFileFunction::DoOperation( const FilePath& file_path, base::DictionaryValue* properties, - scoped_ptr<gdata::DriveEntryProto> entry_proto) { + scoped_ptr<drive::DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - gdata::DriveSystemService* system_service = - gdata::DriveSystemServiceFactory::GetForProfile(profile_); + drive::DriveSystemService* system_service = + drive::DriveSystemServiceFactory::GetForProfile(profile_); // This is subtle but we should take references of resource_id and md5 // before |file_info| is passed to |callback| by base::Passed(). Otherwise, // file_info->whatever() crashes. const std::string& resource_id = entry_proto->resource_id(); const std::string& md5 = entry_proto->file_specific_info().file_md5(); - const gdata::CacheOperationCallback callback = + const drive::CacheOperationCallback callback = base::Bind(&PinDriveFileFunction::OnPinStateSet, this, file_path, @@ -2280,8 +2280,8 @@ void PinDriveFileFunction::DoOperation( void PinDriveFileFunction::OnPinStateSet( const FilePath& path, base::DictionaryValue* properties, - scoped_ptr<gdata::DriveEntryProto> entry_proto, - gdata::DriveFileError error, + scoped_ptr<drive::DriveEntryProto> entry_proto, + drive::DriveFileError error, const std::string& /* resource_id */, const std::string& /* md5 */) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -2322,7 +2322,7 @@ void GetFileLocationsFunction::GetLocalPathsResponseOnUIThread( ListValue* locations = new ListValue; for (size_t i = 0; i < files.size(); ++i) { - if (gdata::util::IsUnderDriveMountPoint(files[i].file_path)) { + if (drive::util::IsUnderDriveMountPoint(files[i].file_path)) { locations->Append(Value::CreateStringValue("drive")); } else { locations->Append(Value::CreateStringValue("local")); @@ -2366,8 +2366,8 @@ void GetDriveFilesFunction::GetLocalPathsResponseOnUIThread( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); for (size_t i = 0; i < files.size(); ++i) { - DCHECK(gdata::util::IsUnderDriveMountPoint(files[i].file_path)); - FilePath drive_path = gdata::util::ExtractDrivePath(files[i].file_path); + DCHECK(drive::util::IsUnderDriveMountPoint(files[i].file_path)); + FilePath drive_path = drive::util::ExtractDrivePath(files[i].file_path); remaining_drive_paths_.push(drive_path); } @@ -2383,8 +2383,8 @@ void GetDriveFilesFunction::GetFileOrSendResponse() { return; } - gdata::DriveSystemService* system_service = - gdata::DriveSystemServiceFactory::GetForProfile(profile_); + drive::DriveSystemService* system_service = + drive::DriveSystemServiceFactory::GetForProfile(profile_); DCHECK(system_service); // Get the file on the top of the queue. @@ -2397,13 +2397,13 @@ void GetDriveFilesFunction::GetFileOrSendResponse() { void GetDriveFilesFunction::OnFileReady( - gdata::DriveFileError error, + drive::DriveFileError error, const FilePath& local_path, const std::string& unused_mime_type, - gdata::DriveFileType file_type) { + drive::DriveFileType file_type) { FilePath drive_path = remaining_drive_paths_.front(); - if (error == gdata::DRIVE_FILE_OK) { + if (error == drive::DRIVE_FILE_OK) { local_paths_->Append(Value::CreateStringValue(local_path.value())); DVLOG(1) << "Got " << drive_path.value() << " as " << local_path.value(); @@ -2429,8 +2429,8 @@ GetFileTransfersFunction::GetFileTransfersFunction() {} GetFileTransfersFunction::~GetFileTransfersFunction() {} ListValue* GetFileTransfersFunction::GetFileTransfersList() { - gdata::DriveSystemService* system_service = - gdata::DriveSystemServiceFactory::GetForProfile(profile_); + drive::DriveSystemService* system_service = + drive::DriveSystemServiceFactory::GetForProfile(profile_); if (!system_service) return NULL; @@ -2483,8 +2483,8 @@ bool CancelFileTransfersFunction::RunImpl() { void CancelFileTransfersFunction::GetLocalPathsResponseOnUIThread( const SelectedFileInfoList& files) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - gdata::DriveSystemService* system_service = - gdata::DriveSystemServiceFactory::GetForProfile(profile_); + drive::DriveSystemService* system_service = + drive::DriveSystemServiceFactory::GetForProfile(profile_); if (!system_service) { SendResponse(false); return; @@ -2492,15 +2492,15 @@ void CancelFileTransfersFunction::GetLocalPathsResponseOnUIThread( scoped_ptr<ListValue> responses(new ListValue()); for (size_t i = 0; i < files.size(); ++i) { - DCHECK(gdata::util::IsUnderDriveMountPoint(files[i].file_path)); - FilePath file_path = gdata::util::ExtractDrivePath(files[i].file_path); + DCHECK(drive::util::IsUnderDriveMountPoint(files[i].file_path)); + FilePath file_path = drive::util::ExtractDrivePath(files[i].file_path); scoped_ptr<DictionaryValue> result(new DictionaryValue()); result->SetBoolean( "canceled", system_service->drive_service()->CancelForFilePath(file_path)); GURL file_url; if (file_manager_util::ConvertFileToFileSystemUrl(profile_, - gdata::util::GetSpecialRemoteRootPath().Append(file_path), + drive::util::GetSpecialRemoteRootPath().Append(file_path), source_url_.GetOrigin(), &file_url)) { result->SetString("fileUrl", file_url.spec()); @@ -2543,8 +2543,8 @@ void TransferFileFunction::GetLocalPathsResponseOnUIThread( return; } - gdata::DriveSystemService* system_service = - gdata::DriveSystemServiceFactory::GetForProfile(profile_); + drive::DriveSystemService* system_service = + drive::DriveSystemServiceFactory::GetForProfile(profile_); if (!system_service) { SendResponse(false); return; @@ -2554,20 +2554,20 @@ void TransferFileFunction::GetLocalPathsResponseOnUIThread( FilePath destination_file = files[1].file_path; bool source_file_under_drive = - gdata::util::IsUnderDriveMountPoint(source_file); + drive::util::IsUnderDriveMountPoint(source_file); bool destination_file_under_drive = - gdata::util::IsUnderDriveMountPoint(destination_file); + drive::util::IsUnderDriveMountPoint(destination_file); if (source_file_under_drive && !destination_file_under_drive) { // Transfer a file from gdata to local file system. - source_file = gdata::util::ExtractDrivePath(source_file); + source_file = drive::util::ExtractDrivePath(source_file); system_service->file_system()->TransferFileFromRemoteToLocal( source_file, destination_file, base::Bind(&TransferFileFunction::OnTransferCompleted, this)); } else if (!source_file_under_drive && destination_file_under_drive) { // Transfer a file from local to Drive file system - destination_file = gdata::util::ExtractDrivePath(destination_file); + destination_file = drive::util::ExtractDrivePath(destination_file); system_service->file_system()->TransferFileFromLocalToRemote( source_file, destination_file, @@ -2580,13 +2580,13 @@ void TransferFileFunction::GetLocalPathsResponseOnUIThread( } } -void TransferFileFunction::OnTransferCompleted(gdata::DriveFileError error) { - if (error == gdata::DRIVE_FILE_OK) { +void TransferFileFunction::OnTransferCompleted(drive::DriveFileError error) { + if (error == drive::DRIVE_FILE_OK) { SendResponse(true); } else { error_ = base::StringPrintf("%d", static_cast<int>( fileapi::PlatformFileErrorToWebFileError( - gdata::DriveFileErrorToPlatformError(error)))); + drive::DriveFileErrorToPlatformError(error)))); SendResponse(false); } } @@ -2597,7 +2597,7 @@ bool GetDrivePreferencesFunction::RunImpl() { const PrefService* service = profile_->GetPrefs(); - bool drive_enabled = gdata::DriveSystemService::IsDriveEnabled(profile_); + bool drive_enabled = drive::DriveSystemService::IsDriveEnabled(profile_); if (drive_enabled) AddDriveMountPoint(profile_, extension_id(), render_view_host()); @@ -2666,8 +2666,8 @@ void SearchDriveFunction::OnFileSystemOpened( file_system_name_ = file_system_name; file_system_url_ = file_system_url; - gdata::DriveSystemService* system_service = - gdata::DriveSystemServiceFactory::GetForProfile(profile_); + drive::DriveSystemService* system_service = + drive::DriveSystemServiceFactory::GetForProfile(profile_); if (!system_service || !system_service->file_system()) { SendResponse(false); return; @@ -2679,10 +2679,10 @@ void SearchDriveFunction::OnFileSystemOpened( } void SearchDriveFunction::OnSearch( - gdata::DriveFileError error, + drive::DriveFileError error, const GURL& next_feed, - scoped_ptr<std::vector<gdata::SearchResultInfo> > results) { - if (error != gdata::DRIVE_FILE_OK) { + scoped_ptr<std::vector<drive::SearchResultInfo> > results) { + if (error != drive::DRIVE_FILE_OK) { SendResponse(false); return; } @@ -2710,8 +2710,8 @@ void SearchDriveFunction::OnSearch( } bool ClearDriveCacheFunction::RunImpl() { - gdata::DriveSystemService* system_service = - gdata::DriveSystemServiceFactory::GetForProfile(profile_); + drive::DriveSystemService* system_service = + drive::DriveSystemServiceFactory::GetForProfile(profile_); // |system_service| is NULL if incognito window / guest login. if (!system_service || !system_service->file_system()) return false; @@ -2754,8 +2754,8 @@ bool RequestDirectoryRefreshFunction::RunImpl() { if (!args_->GetString(0, &file_url_as_string)) return false; - gdata::DriveSystemService* system_service = - gdata::DriveSystemServiceFactory::GetForProfile(profile_); + drive::DriveSystemService* system_service = + drive::DriveSystemServiceFactory::GetForProfile(profile_); if (!system_service || !system_service->file_system()) return false; diff --git a/chrome/browser/chromeos/extensions/file_browser_private_api.h b/chrome/browser/chromeos/extensions/file_browser_private_api.h index cde79a5..8573221 100644 --- a/chrome/browser/chromeos/extensions/file_browser_private_api.h +++ b/chrome/browser/chromeos/extensions/file_browser_private_api.h @@ -26,7 +26,7 @@ namespace fileapi { class FileSystemContext; } -namespace gdata { +namespace drive { struct SearchResultInfo; struct DriveWebAppInfo; class DriveWebAppsRegistry; @@ -133,7 +133,7 @@ class GetFileTasksFileBrowserFunction : public AsyncExtensionFunction { // Typedef for holding a map from app_id to DriveWebAppInfo so // we can look up information on the apps. - typedef std::map<std::string, gdata::DriveWebAppInfo*> WebAppInfoMap; + typedef std::map<std::string, drive::DriveWebAppInfo*> WebAppInfoMap; // Look up apps in the registry, and collect applications that match the file // paths given. Returns the intersection of all available application ids in @@ -141,7 +141,7 @@ class GetFileTasksFileBrowserFunction : public AsyncExtensionFunction { // info collected in |app_info| so details can be collected later. The caller // takes ownership of the pointers in |app_info|. static void IntersectAvailableDriveTasks( - gdata::DriveWebAppsRegistry* registry, + drive::DriveWebAppsRegistry* registry, const FileInfoList& file_info_list, WebAppInfoMap* app_info, std::set<std::string>* available_apps); @@ -150,7 +150,7 @@ class GetFileTasksFileBrowserFunction : public AsyncExtensionFunction { // of |available_apps| and adds Drive tasks to the |result_list| for each of // the |available_apps|. If a default task is set in the result list, // then |default_already_set| is set to true. - static void CreateDriveTasks(gdata::DriveWebAppsRegistry* registry, + static void CreateDriveTasks(drive::DriveWebAppsRegistry* registry, const WebAppInfoMap& app_info, const std::set<std::string>& available_apps, const std::set<std::string>& default_apps, @@ -332,7 +332,7 @@ class AddMountFunction : public FileBrowserFunction { // A callback method to handle the result of SetMountedState. void OnMountedStateSet(const std::string& mount_type, const FilePath::StringType& file_name, - gdata::DriveFileError error, + drive::DriveFileError error, const FilePath& file_path); }; @@ -404,7 +404,7 @@ class GetSizeStatsFunction : public FileBrowserFunction { // GetLocalPathsOnFileThreadAndRunCallbackOnUIThread. void GetLocalPathsResponseOnUIThread(const SelectedFileInfoList& files); - void GetDriveAvailableSpaceCallback(gdata::DriveFileError error, + void GetDriveAvailableSpaceCallback(drive::DriveFileError error, int64 bytes_total, int64 bytes_used); @@ -473,7 +473,7 @@ class FileDialogStringsFunction : public SyncExtensionFunction { // Retrieve property information for multiple files, returning a list of the // same length as the input list of file URLs. If a particular file has an // error, then return a dictionary with the key "error" set to the error number -// (gdata::DriveFileError) for that entry in the returned list. +// (drive::DriveFileError) for that entry in the returned list. class GetDriveFilePropertiesFunction : public FileBrowserFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getGDataFileProperties"); @@ -490,12 +490,12 @@ class GetDriveFilePropertiesFunction : public FileBrowserFunction { // file path and update its the properties. virtual void DoOperation(const FilePath& file_path, base::DictionaryValue* properties, - scoped_ptr<gdata::DriveEntryProto> entry_proto); + scoped_ptr<drive::DriveEntryProto> entry_proto); void OnOperationComplete(const FilePath& file_path, base::DictionaryValue* properties, - gdata::DriveFileError error, - scoped_ptr<gdata::DriveEntryProto> entry_proto); + drive::DriveFileError error, + scoped_ptr<drive::DriveEntryProto> entry_proto); // AsyncExtensionFunction overrides. virtual bool RunImpl() OVERRIDE; @@ -506,12 +506,12 @@ class GetDriveFilePropertiesFunction : public FileBrowserFunction { private: void OnGetFileInfo(const FilePath& file_path, base::DictionaryValue* property_dict, - gdata::DriveFileError error, - scoped_ptr<gdata::DriveEntryProto> entry_proto); + drive::DriveFileError error, + scoped_ptr<drive::DriveEntryProto> entry_proto); void CacheStateReceived(base::DictionaryValue* property_dict, bool success, - const gdata::DriveCacheEntry& cache_entry); + const drive::DriveCacheEntry& cache_entry); size_t current_index_; base::ListValue* path_list_; @@ -522,7 +522,7 @@ class GetDriveFilePropertiesFunction : public FileBrowserFunction { // properties with the updated cache state. The returned array is the // same length as the input list of file URLs. If a particular file // has an error, then return a dictionary with the key "error" set to -// the error number (gdata::DriveFileError) for that entry in the +// the error number (drive::DriveFileError) for that entry in the // returned list. class PinDriveFileFunction : public GetDriveFilePropertiesFunction { public: @@ -541,13 +541,13 @@ class PinDriveFileFunction : public GetDriveFilePropertiesFunction { virtual void DoOperation( const FilePath& file_path, base::DictionaryValue* properties, - scoped_ptr<gdata::DriveEntryProto> entry_proto) OVERRIDE; + scoped_ptr<drive::DriveEntryProto> entry_proto) OVERRIDE; // Callback for SetPinState. Updates properties with error. void OnPinStateSet(const FilePath& path, base::DictionaryValue* properties, - scoped_ptr<gdata::DriveEntryProto> entry_proto, - gdata::DriveFileError error, + scoped_ptr<drive::DriveEntryProto> entry_proto, + drive::DriveFileError error, const std::string& resource_id, const std::string& md5); @@ -607,10 +607,10 @@ class GetDriveFilesFunction : public FileBrowserFunction { // Called by DriveFileSystem::GetFile(). Pops the file from // |remaining_drive_paths_|, and calls GetFileOrSendResponse(). - void OnFileReady(gdata::DriveFileError error, + void OnFileReady(drive::DriveFileError error, const FilePath& local_path, const std::string& unused_mime_type, - gdata::DriveFileType file_type); + drive::DriveFileType file_type); std::queue<FilePath> remaining_drive_paths_; ListValue* local_paths_; @@ -668,7 +668,7 @@ class TransferFileFunction : public FileBrowserFunction { void GetLocalPathsResponseOnUIThread(const SelectedFileInfoList& files); // Helper callback for handling response from DriveFileSystem::TransferFile(). - void OnTransferCompleted(gdata::DriveFileError error); + void OnTransferCompleted(drive::DriveFileError error); }; // Read setting value. @@ -710,9 +710,9 @@ class SearchDriveFunction : public AsyncExtensionFunction { const std::string& file_system_name, const GURL& file_system_url); // Callback for gdata::SearchAsync called after file system is opened. - void OnSearch(gdata::DriveFileError error, + void OnSearch(drive::DriveFileError error, const GURL& next_feed, - scoped_ptr<std::vector<gdata::SearchResultInfo> > result_paths); + scoped_ptr<std::vector<drive::SearchResultInfo> > result_paths); // Query for which the search is being performed. std::string query_; diff --git a/chrome/browser/chromeos/extensions/file_handler_util.cc b/chrome/browser/chromeos/extensions/file_handler_util.cc index 48fd8cb..147a919 100644 --- a/chrome/browser/chromeos/extensions/file_handler_util.cc +++ b/chrome/browser/chromeos/extensions/file_handler_util.cc @@ -572,7 +572,7 @@ FileTaskExecutor* FileTaskExecutor::Create(Profile* profile, action_id); if (task_type == kTaskDrive) - return new gdata::DriveTaskExecutor(profile, + return new drive::DriveTaskExecutor(profile, extension_id, // really app_id action_id); @@ -737,7 +737,7 @@ class ExtensionTaskExecutor::ExecuteTasksFileSystemCallbackDispatcher { FilePath virtual_path = url.virtual_path(); bool is_drive_file = url.type() == fileapi::kFileSystemTypeDrive; - DCHECK(!is_drive_file || gdata::util::IsUnderDriveMountPoint(local_path)); + DCHECK(!is_drive_file || drive::util::IsUnderDriveMountPoint(local_path)); // If the file is under gdata mount point, there is no actual file to be // found on the url.path(). @@ -980,7 +980,7 @@ void ExtensionTaskExecutor::InitHandlerHostFileAccessPermissions( GetAccessPermissionsForFileBrowserHandler(handler_extension, action_id_))); - if (gdata::util::IsUnderDriveMountPoint(iter->absolute_path)) + if (drive::util::IsUnderDriveMountPoint(iter->absolute_path)) gdata_paths->push_back(iter->virtual_path); } @@ -992,7 +992,7 @@ void ExtensionTaskExecutor::InitHandlerHostFileAccessPermissions( // For files on gdata mount point, we'll have to give handler host permissions // for their cache paths. This has to be called on UI thread. - gdata::util::InsertDriveCachePathsPermissions(profile(), + drive::util::InsertDriveCachePathsPermissions(profile(), gdata_paths.Pass(), &handler_host_permissions_, callback); diff --git a/chrome/browser/chromeos/extensions/file_manager_util.cc b/chrome/browser/chromeos/extensions/file_manager_util.cc index 334ea6a..e856b20 100644 --- a/chrome/browser/chromeos/extensions/file_manager_util.cc +++ b/chrome/browser/chromeos/extensions/file_manager_util.cc @@ -188,7 +188,7 @@ DictionaryValue* ProgessStatusToDictionaryValue( scoped_ptr<DictionaryValue> result(new DictionaryValue()); GURL file_url; if (file_manager_util::ConvertFileToFileSystemUrl(profile, - gdata::util::GetSpecialRemoteRootPath().Append( + drive::util::GetSpecialRemoteRootPath().Append( FilePath(status.file_path)), origin_url, &file_url)) { @@ -235,21 +235,21 @@ void ShowWarningMessageBox(Profile* profile, const FilePath& path) { // in a new tab with a URL computed based on the |file_type| void OnDriveFileFound(Profile* profile, const FilePath& file_path, - gdata::DriveFileType file_type, - gdata::DriveFileError error, - scoped_ptr<gdata::DriveEntryProto> entry_proto) { + drive::DriveFileType file_type, + drive::DriveFileError error, + scoped_ptr<drive::DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (entry_proto.get() && !entry_proto->has_file_specific_info()) - error = gdata::DRIVE_FILE_ERROR_NOT_FOUND; + error = drive::DRIVE_FILE_ERROR_NOT_FOUND; - if (error == gdata::DRIVE_FILE_OK) { + if (error == drive::DRIVE_FILE_OK) { GURL page_url; - if (file_type == gdata::REGULAR_FILE) { - page_url = gdata::util::GetFileResourceUrl( + if (file_type == drive::REGULAR_FILE) { + page_url = drive::util::GetFileResourceUrl( entry_proto->resource_id(), entry_proto->base_name()); - } else if (file_type == gdata::HOSTED_DOCUMENT) { + } else if (file_type == drive::HOSTED_DOCUMENT) { page_url = GURL(entry_proto->file_specific_info().alternate_url()); } else { NOTREACHED(); @@ -262,11 +262,11 @@ void OnDriveFileFound(Profile* profile, // Called when a crx file on Drive was downloaded. void OnCRXDownloadCallback(Browser* browser, - gdata::DriveFileError error, + drive::DriveFileError error, const FilePath& file, const std::string& unused_mime_type, - gdata::DriveFileType file_type) { - if (error != gdata::DRIVE_FILE_OK || file_type != gdata::REGULAR_FILE) + drive::DriveFileType file_type) { + if (error != drive::DRIVE_FILE_OK || file_type != drive::REGULAR_FILE) return; InstallCRX(browser, file); } @@ -674,16 +674,16 @@ bool ExecuteBuiltinHandler(Browser* browser, const FilePath& path, GURL page_url = net::FilePathToFileURL(path); // Override gdata resource to point to internal handler instead of file: // URL. - if (gdata::util::GetSpecialRemoteRootPath().IsParent(path)) { - gdata::DriveSystemService* system_service = - gdata::DriveSystemServiceFactory::GetForProfile(profile); + if (drive::util::GetSpecialRemoteRootPath().IsParent(path)) { + drive::DriveSystemService* system_service = + drive::DriveSystemServiceFactory::GetForProfile(profile); if (!system_service) return false; // Open the file once the file is found. system_service->file_system()->GetEntryInfoByPath( - gdata::util::ExtractDrivePath(path), - base::Bind(&OnDriveFileFound, profile, path, gdata::REGULAR_FILE)); + drive::util::ExtractDrivePath(path), + base::Bind(&OnDriveFileFound, profile, path, drive::REGULAR_FILE)); return true; } OpenNewTab(page_url, NULL); @@ -691,17 +691,17 @@ bool ExecuteBuiltinHandler(Browser* browser, const FilePath& path, } if (IsSupportedGDocsExtension(file_extension.data())) { - if (gdata::util::GetSpecialRemoteRootPath().IsParent(path)) { + if (drive::util::GetSpecialRemoteRootPath().IsParent(path)) { // The file is on Google Docs. Get the Docs from the Drive service. - gdata::DriveSystemService* system_service = - gdata::DriveSystemServiceFactory::GetForProfile(profile); + drive::DriveSystemService* system_service = + drive::DriveSystemServiceFactory::GetForProfile(profile); if (!system_service) return false; system_service->file_system()->GetEntryInfoByPath( - gdata::util::ExtractDrivePath(path), + drive::util::ExtractDrivePath(path), base::Bind(&OnDriveFileFound, profile, path, - gdata::HOSTED_DOCUMENT)); + drive::HOSTED_DOCUMENT)); } else { // The file is local (downloaded from an attachment or otherwise copied). // Parse the file to extract the Docs url and open this url. @@ -745,13 +745,13 @@ bool ExecuteBuiltinHandler(Browser* browser, const FilePath& path, } if (IsCRXFile(file_extension.data())) { - if (gdata::util::IsUnderDriveMountPoint(path)) { - gdata::DriveSystemService* system_service = - gdata::DriveSystemServiceFactory::GetForProfile(profile); + if (drive::util::IsUnderDriveMountPoint(path)) { + drive::DriveSystemService* system_service = + drive::DriveSystemServiceFactory::GetForProfile(profile); if (!system_service) return false; system_service->file_system()->GetFileByPath( - gdata::util::ExtractDrivePath(path), + drive::util::ExtractDrivePath(path), base::Bind(&OnCRXDownloadCallback, browser), gdata::GetContentCallback()); } else { diff --git a/chrome/browser/chromeos/preferences.cc b/chrome/browser/chromeos/preferences.cc index 73c2944..b71b375 100644 --- a/chrome/browser/chromeos/preferences.cc +++ b/chrome/browser/chromeos/preferences.cc @@ -470,7 +470,7 @@ void Preferences::NotifyPrefChanged(const std::string* pref_name) { } } if (!pref_name || *pref_name == prefs::kDownloadDefaultDirectory) { - const bool default_download_to_drive = gdata::util::IsUnderDriveMountPoint( + const bool default_download_to_drive = drive::util::IsUnderDriveMountPoint( download_default_directory_.GetValue()); if (pref_name) UMA_HISTOGRAM_BOOLEAN( @@ -631,7 +631,7 @@ void Preferences::NotifyPrefChanged(const std::string* pref_name) { // selected and GData is disabled. if (!pref_name || *pref_name == prefs::kDisableGData) { if (disable_drive_.GetValue()) { - if (gdata::util::IsUnderDriveMountPoint( + if (drive::util::IsUnderDriveMountPoint( download_default_directory_.GetValue())) { prefs_->SetFilePath(prefs::kDownloadDefaultDirectory, download_util::GetDefaultDownloadDirectory()); diff --git a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc index a73abff..8ce56e6 100644 --- a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc +++ b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc @@ -76,8 +76,8 @@ #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" -using gdata::DriveSystemService; -using gdata::DriveSystemServiceFactory; +using drive::DriveSystemService; +using drive::DriveSystemServiceFactory; namespace chromeos { @@ -151,7 +151,7 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate, public NetworkLibrary::NetworkManagerObserver, public NetworkLibrary::NetworkObserver, public NetworkLibrary::CellularDataPlanObserver, - public gdata::DriveServiceObserver, + public drive::DriveServiceObserver, public content::NotificationObserver, public input_method::InputMethodManager::Observer, public system::TimezoneSettings::Observer, @@ -1143,7 +1143,7 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate, DriveSystemService* FindDriveSystemService() { Profile* profile = ProfileManager::GetDefaultProfile(); - if (!gdata::DriveSystemService::IsDriveEnabled(profile)) + if (!drive::DriveSystemService::IsDriveEnabled(profile)) return NULL; return DriveSystemServiceFactory::FindForProfile(profile); } diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc index 03ee2cc..b1369f9 100644 --- a/chrome/browser/download/chrome_download_manager_delegate.cc +++ b/chrome/browser/download/chrome_download_manager_delegate.cc @@ -326,7 +326,7 @@ bool ChromeDownloadManagerDelegate::IsDownloadReadyForCompletion( #if defined(OS_CHROMEOS) // If there's a Drive upload associated with this download, we wait until that // is complete before allowing the download item to complete. - if (!gdata::DriveDownloadObserver::IsReadyToComplete( + if (!drive::DriveDownloadObserver::IsReadyToComplete( item, internal_complete_callback)) return false; #endif @@ -555,7 +555,7 @@ void ChromeDownloadManagerDelegate::GetSaveDir(BrowserContext* browser_context, *skip_dir_check = false; #if defined(OS_CHROMEOS) - *skip_dir_check = gdata::util::IsUnderDriveMountPoint(*website_save_dir); + *skip_dir_check = drive::util::IsUnderDriveMountPoint(*website_save_dir); #endif } @@ -802,7 +802,7 @@ void ChromeDownloadManagerDelegate::CheckVisitedReferrerBeforeDone( } #if defined (OS_CHROMEOS) - gdata::DriveDownloadObserver::SubstituteDriveDownloadPath( + drive::DriveDownloadObserver::SubstituteDriveDownloadPath( profile_, suggested_path, download, base::Bind( &ChromeDownloadManagerDelegate::SubstituteDriveDownloadPathCallback, diff --git a/chrome/browser/download/download_file_picker_chromeos.cc b/chrome/browser/download/download_file_picker_chromeos.cc index 4a94cf1..b9d9f7f 100644 --- a/chrome/browser/download/download_file_picker_chromeos.cc +++ b/chrome/browser/download/download_file_picker_chromeos.cc @@ -25,9 +25,9 @@ void DownloadFilePickerChromeOS::InitSuggestedPath(DownloadItem* item, const FilePath& path) { // For Drive downloads, |path| is the virtual gdata path instead of the // temporary local one. - if (gdata::DriveDownloadObserver::IsDriveDownload(item)) { - set_suggested_path(gdata::util::GetSpecialRemoteRootPath().Append( - gdata::DriveDownloadObserver::GetDrivePath(item))); + if (drive::DriveDownloadObserver::IsDriveDownload(item)) { + set_suggested_path(drive::util::GetSpecialRemoteRootPath().Append( + drive::DriveDownloadObserver::GetDrivePath(item))); } else { DownloadFilePicker::InitSuggestedPath(item, path); } @@ -55,7 +55,7 @@ void DownloadFilePickerChromeOS::FileSelectedWithExtraInfo( if (download_manager_) { DownloadItem* download = download_manager_->GetDownload(download_id_); - gdata::DriveDownloadObserver::SubstituteDriveDownloadPath( + drive::DriveDownloadObserver::SubstituteDriveDownloadPath( NULL, path, download, base::Bind(&DownloadFilePickerChromeOS::OnFileSelected, base::Unretained(this))); diff --git a/chrome/browser/download/download_item_model.cc b/chrome/browser/download/download_item_model.cc index 3269a5c..feaced0 100644 --- a/chrome/browser/download/download_item_model.cc +++ b/chrome/browser/download/download_item_model.cc @@ -94,7 +94,7 @@ int DownloadItemModel::PercentComplete() const { // For Drive uploads, progress is based on the number of bytes // uploaded. Progress is unknown until the upload starts. if (IsDriveDownload()) - return gdata::DriveDownloadObserver::PercentComplete(download_); + return drive::DriveDownloadObserver::PercentComplete(download_); #endif return download_->PercentComplete(); } @@ -185,14 +185,14 @@ int64 DownloadItemModel::GetCompletedBytes() const { #if defined(OS_CHROMEOS) // For Drive downloads, the size is the count of bytes uploaded. if (IsDriveDownload()) - return gdata::DriveDownloadObserver::GetUploadedBytes(download_); + return drive::DriveDownloadObserver::GetUploadedBytes(download_); #endif return download_->GetReceivedBytes(); } bool DownloadItemModel::IsDriveDownload() const { #if defined(OS_CHROMEOS) - return gdata::DriveDownloadObserver::IsDriveDownload(download_); + return drive::DriveDownloadObserver::IsDriveDownload(download_); #else return false; #endif diff --git a/chrome/browser/download/download_prefs.cc b/chrome/browser/download/download_prefs.cc index c75e834b..b6ac5d3 100644 --- a/chrome/browser/download/download_prefs.cc +++ b/chrome/browser/download/download_prefs.cc @@ -130,8 +130,8 @@ FilePath DownloadPrefs::DownloadPath() const { // If the download path is under /drive, and DriveSystemService isn't // available (which it isn't for incognito mode, for instance), use the // default download directory (/Downloads). - if (gdata::util::IsUnderDriveMountPoint(*download_path_) && - !gdata::DriveSystemServiceFactory::GetForProfile(profile_)) + if (drive::util::IsUnderDriveMountPoint(*download_path_) && + !drive::DriveSystemServiceFactory::GetForProfile(profile_)) return download_util::GetDefaultDownloadDirectory(); #endif return *download_path_; diff --git a/chrome/browser/download/save_package_file_picker_chromeos.cc b/chrome/browser/download/save_package_file_picker_chromeos.cc index 663b976b..a27f9c82 100644 --- a/chrome/browser/download/save_package_file_picker_chromeos.cc +++ b/chrome/browser/download/save_package_file_picker_chromeos.cc @@ -30,7 +30,7 @@ void ContinueSettingUpDriveDownload( const FilePath& drive_path, const FilePath& drive_tmp_download_path) { callback.Run(drive_tmp_download_path, content::SAVE_PAGE_TYPE_AS_MHTML, - base::Bind(&gdata::DriveDownloadObserver::SetDownloadParams, + base::Bind(&drive::DriveDownloadObserver::SetDownloadParams, drive_path)); } @@ -92,13 +92,13 @@ void SavePackageFilePickerChromeOS::FileSelectedWithExtraInfo( web_contents()->GetBrowserContext()); DCHECK(profile); - if (gdata::util::IsUnderDriveMountPoint(selected_path)) { + if (drive::util::IsUnderDriveMountPoint(selected_path)) { // Here's a map to the callback chain: // GetDriveTempDownloadPath -> // ContinueSettingUpDriveDownload -> // callback_ = SavePackage::OnPathPicked -> // download_created_callback = OnSavePackageDownloadCreated - gdata::DriveDownloadObserver::SubstituteDriveDownloadPath( + drive::DriveDownloadObserver::SubstituteDriveDownloadPath( profile, selected_path, NULL, base::Bind(&ContinueSettingUpDriveDownload, callback_, selected_path)); } else { diff --git a/chrome/browser/extensions/webstore_installer.cc b/chrome/browser/extensions/webstore_installer.cc index 979ee82..3076cce 100644 --- a/chrome/browser/extensions/webstore_installer.cc +++ b/chrome/browser/extensions/webstore_installer.cc @@ -100,7 +100,7 @@ void GetDownloadFilePath( #if defined (OS_CHROMEOS) // Do not use drive for extension downloads. - if (gdata::util::IsUnderDriveMountPoint(directory)) + if (drive::util::IsUnderDriveMountPoint(directory)) directory = download_util::GetDefaultDownloadDirectory(); #endif diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc index afadf49..88b270e 100644 --- a/chrome/browser/profiles/profile_io_data.cc +++ b/chrome/browser/profiles/profile_io_data.cc @@ -640,7 +640,7 @@ void ProfileIOData::SetUpJobFactoryDefaults( #if defined(OS_CHROMEOS) if (!is_incognito()) { set_protocol = job_factory->SetProtocolHandler( - chrome::kDriveScheme, new gdata::DriveProtocolHandler()); + chrome::kDriveScheme, new drive::DriveProtocolHandler()); DCHECK(set_protocol); } #if !defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/browser/ui/ash/screenshot_taker.cc b/chrome/browser/ui/ash/screenshot_taker.cc index 2f7c7c1..0b6fe04 100644 --- a/chrome/browser/ui/ash/screenshot_taker.cc +++ b/chrome/browser/ui/ash/screenshot_taker.cc @@ -73,9 +73,9 @@ void SaveScreenshot(const FilePath& screenshot_path, // TODO(kinaba): crbug.com/140425, remove this ungly #ifdef dispatch. #ifdef OS_CHROMEOS void SaveScreenshotToDrive(scoped_refptr<base::RefCountedBytes> png_data, - gdata::DriveFileError error, + drive::DriveFileError error, const FilePath& local_path) { - if (error != gdata::DRIVE_FILE_OK) { + if (error != drive::DRIVE_FILE_OK) { LOG(ERROR) << "Failed to write screenshot image to Google Drive: " << error; return; } @@ -86,12 +86,12 @@ void EnsureDirectoryExistsCallback( Profile* profile, const FilePath& screenshot_path, scoped_refptr<base::RefCountedBytes> png_data, - gdata::DriveFileError error) { + drive::DriveFileError error) { // It is okay to fail with DRIVE_FILE_ERROR_EXISTS since anyway the directory // of the target file exists. - if (error == gdata::DRIVE_FILE_OK || - error == gdata::DRIVE_FILE_ERROR_EXISTS) { - gdata::util::PrepareWritableFileAndRun( + if (error == drive::DRIVE_FILE_OK || + error == drive::DRIVE_FILE_ERROR_EXISTS) { + drive::util::PrepareWritableFileAndRun( profile, screenshot_path, base::Bind(&SaveScreenshotToDrive, png_data)); @@ -103,10 +103,10 @@ void EnsureDirectoryExistsCallback( void PostSaveScreenshotTask(const FilePath& screenshot_path, scoped_refptr<base::RefCountedBytes> png_data) { - if (gdata::util::IsUnderDriveMountPoint(screenshot_path)) { + if (drive::util::IsUnderDriveMountPoint(screenshot_path)) { Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); if (profile) { - gdata::util::EnsureDirectoryExists( + drive::util::EnsureDirectoryExists( profile, screenshot_path.DirName(), base::Bind(&EnsureDirectoryExistsCallback, diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 12e0fa6..99e19a0 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -1805,7 +1805,7 @@ void Browser::FileSelectedWithExtraInfo( GURL file_url = net::FilePathToFileURL(path); #if defined(OS_CHROMEOS) - gdata::util::ModifyDriveFileResourceUrl(profile_, path, &file_url); + drive::util::ModifyDriveFileResourceUrl(profile_, path, &file_url); #endif if (file_url.is_empty()) diff --git a/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc b/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc index da7559c..1ba1c81 100644 --- a/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc +++ b/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc @@ -105,7 +105,7 @@ void GetFreeDiskSpace(const FilePath& home_path, // Formats |entry| into text. std::string FormatEntry(const FilePath& path, - const gdata::DriveEntryProto& entry) { + const drive::DriveEntryProto& entry) { using base::StringAppendF; using gdata::util::FormatTimeAsString; @@ -119,7 +119,7 @@ std::string FormatEntry(const FilePath& path, entry.parent_resource_id().c_str()); StringAppendF(&out, " upload_url: %s\n", entry.upload_url().c_str()); - const gdata::PlatformFileInfoProto& file_info = entry.file_info(); + const drive::PlatformFileInfoProto& file_info = entry.file_info(); StringAppendF(&out, " file_info\n"); StringAppendF(&out, " size: %"PRId64"\n", file_info.size()); StringAppendF(&out, " is_directory: %d\n", file_info.is_directory()); @@ -140,7 +140,7 @@ std::string FormatEntry(const FilePath& path, FormatTimeAsString(creation_time).c_str()); if (entry.has_file_specific_info()) { - const gdata::DriveFileSpecificInfo& file_specific_info = + const drive::DriveFileSpecificInfo& file_specific_info = entry.file_specific_info(); StringAppendF(&out, " thumbnail_url: %s\n", file_specific_info.thumbnail_url().c_str()); @@ -175,7 +175,7 @@ class DriveInternalsWebUIHandler : public content::WebUIMessageHandler { virtual void RegisterMessages() OVERRIDE; // Returns a DriveSystemService. - gdata::DriveSystemService* GetSystemService(); + drive::DriveSystemService* GetSystemService(); // Called when the page is first loaded. void OnPageLoaded(const base::ListValue* args); @@ -186,9 +186,9 @@ class DriveInternalsWebUIHandler : public content::WebUIMessageHandler { // Called when ReadDirectoryByPath() is complete. void OnReadDirectoryByPath(const FilePath& parent_path, - gdata::DriveFileError error, + drive::DriveFileError error, bool hide_hosted_documents, - scoped_ptr<gdata::DriveEntryProtoVector> entries); + scoped_ptr<drive::DriveEntryProtoVector> entries); // Called when GetResourceIdsOfAllFilesOnUIThread() is complete. void OnGetResourceIdsOfAllFiles( @@ -197,7 +197,7 @@ class DriveInternalsWebUIHandler : public content::WebUIMessageHandler { // Called when GetCacheEntryOnUIThread() is complete. void OnGetCacheEntry(const std::string& resource_id, bool success, - const gdata::DriveCacheEntry& cache_entry); + const drive::DriveCacheEntry& cache_entry); // Called when GetFreeDiskSpace() is complete. void OnGetFreeDiskSpace(base::DictionaryValue* local_storage_summary); @@ -211,7 +211,7 @@ class DriveInternalsWebUIHandler : public content::WebUIMessageHandler { // Updates the summary about in-flight operations. void UpdateInFlightOperations( - const gdata::DriveServiceInterface* drive_service); + const drive::DriveServiceInterface* drive_service); // The number of pending ReadDirectoryByPath() calls. int num_pending_reads_; @@ -283,20 +283,20 @@ void DriveInternalsWebUIHandler::RegisterMessages() { weak_ptr_factory_.GetWeakPtr())); } -gdata::DriveSystemService* DriveInternalsWebUIHandler::GetSystemService() { +drive::DriveSystemService* DriveInternalsWebUIHandler::GetSystemService() { Profile* profile = Profile::FromWebUI(web_ui()); - return gdata::DriveSystemServiceFactory::GetForProfile(profile); + return drive::DriveSystemServiceFactory::GetForProfile(profile); } void DriveInternalsWebUIHandler::OnPageLoaded(const base::ListValue* args) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - gdata::DriveSystemService* system_service = GetSystemService(); + drive::DriveSystemService* system_service = GetSystemService(); // |system_service| may be NULL in the guest/incognito mode. if (!system_service) return; - gdata::DriveServiceInterface* drive_service = system_service->drive_service(); + drive::DriveServiceInterface* drive_service = system_service->drive_service(); DCHECK(drive_service); // Update the auth status section. @@ -315,7 +315,7 @@ void DriveInternalsWebUIHandler::OnPageLoaded(const base::ListValue* args) { // Start updating the GCache contents section. Profile* profile = Profile::FromWebUI(web_ui()); const FilePath root_path = - gdata::DriveCache::GetCacheRootPath(profile); + drive::DriveCache::GetCacheRootPath(profile); base::ListValue* gcache_contents = new ListValue; base::DictionaryValue* gcache_summary = new DictionaryValue; BrowserThread::PostBlockingPoolTaskAndReply( @@ -354,12 +354,12 @@ void DriveInternalsWebUIHandler::OnGetGCacheContents( *gcache_summary); // Start updating the file system tree section, if we have access token. - gdata::DriveSystemService* system_service = GetSystemService(); + drive::DriveSystemService* system_service = GetSystemService(); if (!system_service->drive_service()->HasAccessToken()) return; // Start rendering the file system tree as text. - const FilePath root_path = FilePath(gdata::kDriveRootDirectory); + const FilePath root_path = FilePath(drive::kDriveRootDirectory); ++num_pending_reads_; system_service->file_system()->ReadDirectoryByPath( root_path, @@ -370,16 +370,16 @@ void DriveInternalsWebUIHandler::OnGetGCacheContents( void DriveInternalsWebUIHandler::OnReadDirectoryByPath( const FilePath& parent_path, - gdata::DriveFileError error, + drive::DriveFileError error, bool hide_hosted_documents, - scoped_ptr<gdata::DriveEntryProtoVector> entries) { + scoped_ptr<drive::DriveEntryProtoVector> entries) { --num_pending_reads_; - if (error == gdata::DRIVE_FILE_OK) { + if (error == drive::DRIVE_FILE_OK) { DCHECK(entries.get()); std::string file_system_as_text; for (size_t i = 0; i < entries->size(); ++i) { - const gdata::DriveEntryProto& entry = (*entries)[i]; + const drive::DriveEntryProto& entry = (*entries)[i]; const FilePath current_path = parent_path.Append( FilePath::FromUTF8Unsafe(entry.base_name())); @@ -427,7 +427,7 @@ void DriveInternalsWebUIHandler::OnGetResourceIdsOfAllFiles( void DriveInternalsWebUIHandler::OnGetCacheEntry( const std::string& resource_id, bool success, - const gdata::DriveCacheEntry& cache_entry) { + const drive::DriveCacheEntry& cache_entry) { if (!success) { LOG(ERROR) << "Failed to get cache entry: " << resource_id; return; @@ -458,19 +458,19 @@ void DriveInternalsWebUIHandler::OnGetFreeDiskSpace( void DriveInternalsWebUIHandler::OnPeriodicUpdate(const base::ListValue* args) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - gdata::DriveSystemService* system_service = GetSystemService(); + drive::DriveSystemService* system_service = GetSystemService(); // |system_service| may be NULL in the guest/incognito mode. if (!system_service) return; - gdata::DriveServiceInterface* drive_service = system_service->drive_service(); + drive::DriveServiceInterface* drive_service = system_service->drive_service(); DCHECK(drive_service); UpdateInFlightOperations(drive_service); } void DriveInternalsWebUIHandler::UpdateInFlightOperations( - const gdata::DriveServiceInterface* drive_service) { + const drive::DriveServiceInterface* drive_service) { gdata::OperationProgressStatusList progress_status_list = drive_service->GetProgressStatusList(); diff --git a/chrome/browser/ui/webui/feedback_ui.cc b/chrome/browser/ui/webui/feedback_ui.cc index 238d6a2..ff84057 100644 --- a/chrome/browser/ui/webui/feedback_ui.cc +++ b/chrome/browser/ui/webui/feedback_ui.cc @@ -105,8 +105,8 @@ std::string GetUserEmail() { return manager->GetLoggedInUser().display_email(); } -bool ScreenshotDriveTimestampComp(const gdata::DriveEntryProto& entry1, - const gdata::DriveEntryProto& entry2) { +bool ScreenshotDriveTimestampComp(const drive::DriveEntryProto& entry1, + const drive::DriveEntryProto& entry2) { return entry1.file_info().last_modified() > entry2.file_info().last_modified(); } @@ -114,18 +114,18 @@ bool ScreenshotDriveTimestampComp(const gdata::DriveEntryProto& entry1, void ReadDirectoryCallback(size_t max_saved, std::vector<std::string>* saved_screenshots, base::Closure callback, - gdata::DriveFileError error, + drive::DriveFileError error, bool hide_hosted_documents, - scoped_ptr<gdata::DriveEntryProtoVector> entries) { - if (error != gdata::DRIVE_FILE_OK) { + scoped_ptr<drive::DriveEntryProtoVector> entries) { + if (error != drive::DRIVE_FILE_OK) { callback.Run(); return; } size_t max_scan = std::min(kMaxNumScanFiles, entries->size()); - std::vector<gdata::DriveEntryProto> screenshot_entries; + std::vector<drive::DriveEntryProto> screenshot_entries; for (size_t i = 0; i < max_scan; ++i) { - const gdata::DriveEntryProto& entry = (*entries)[i]; + const drive::DriveEntryProto& entry = (*entries)[i]; if (StartsWithASCII(entry.base_name(), ScreenshotSource::kScreenshotPrefix, true) && EndsWith(entry.base_name(), @@ -140,7 +140,7 @@ void ReadDirectoryCallback(size_t max_saved, screenshot_entries.end(), ScreenshotDriveTimestampComp); for (size_t i = 0; i < sort_size; ++i) { - const gdata::DriveEntryProto& entry = screenshot_entries[i]; + const drive::DriveEntryProto& entry = screenshot_entries[i]; saved_screenshots->push_back( std::string(ScreenshotSource::kScreenshotUrlRoot) + std::string(ScreenshotSource::kScreenshotSaved) + @@ -558,7 +558,7 @@ void FeedbackHandler::HandleRefreshSavedScreenshots(const ListValue*) { base::Closure refresh_callback = base::Bind( &FeedbackHandler::RefreshSavedScreenshotsCallback, AsWeakPtr(), base::Owned(saved_screenshots)); - if (gdata::util::IsUnderDriveMountPoint(filepath)) { + if (drive::util::IsUnderDriveMountPoint(filepath)) { GetMostRecentScreenshotsDrive( filepath, saved_screenshots, kMaxSavedScreenshots, refresh_callback); } else { @@ -581,11 +581,11 @@ void FeedbackHandler::RefreshSavedScreenshotsCallback( void FeedbackHandler::GetMostRecentScreenshotsDrive( const FilePath& filepath, std::vector<std::string>* saved_screenshots, size_t max_saved, base::Closure callback) { - gdata::DriveFileSystemInterface* file_system = - gdata::DriveSystemServiceFactory::GetForProfile( + drive::DriveFileSystemInterface* file_system = + drive::DriveSystemServiceFactory::GetForProfile( Profile::FromWebUI(web_ui()))->file_system(); file_system->ReadDirectoryByPath( - gdata::util::ExtractDrivePath(filepath), + drive::util::ExtractDrivePath(filepath), base::Bind(&ReadDirectoryCallback, max_saved, saved_screenshots, callback)); } diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc index 40ce66d..3ce3bd3 100644 --- a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc +++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc @@ -225,9 +225,9 @@ void PrintToPdfCallback(Metafile* metafile, const FilePath& path) { #ifdef OS_CHROMEOS void PrintToPdfCallbackWithCheck(Metafile* metafile, - gdata::DriveFileError error, + drive::DriveFileError error, const FilePath& path) { - if (error != gdata::DRIVE_FILE_OK) { + if (error != drive::DRIVE_FILE_OK) { LOG(ERROR) << "Save to pdf failed to write: " << error; } else { metafile->SaveTo(path); @@ -909,7 +909,7 @@ void PrintPreviewHandler::PostPrintToPdfTask(base::RefCountedBytes* data) { // PrintToPdfCallback takes ownership of |metafile|. #ifdef OS_CHROMEOS DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - gdata::util::PrepareWritableFileAndRun( + drive::util::PrepareWritableFileAndRun( Profile::FromBrowserContext(preview_web_contents()->GetBrowserContext()), *print_to_pdf_path_, base::Bind(&PrintToPdfCallbackWithCheck, metafile)); diff --git a/chrome/browser/ui/webui/screenshot_source.cc b/chrome/browser/ui/webui/screenshot_source.cc index 662d060..91541e9 100644 --- a/chrome/browser/ui/webui/screenshot_source.cc +++ b/chrome/browser/ui/webui/screenshot_source.cc @@ -188,9 +188,9 @@ void ScreenshotSource::SendScreenshot(const std::string& screenshot_path, FilePath download_path; GetScreenshotDirectory(&download_path); - if (gdata::util::IsUnderDriveMountPoint(download_path)) { - gdata::DriveFileSystemInterface* file_system = - gdata::DriveSystemServiceFactory::GetForProfile( + if (drive::util::IsUnderDriveMountPoint(download_path)) { + drive::DriveFileSystemInterface* file_system = + drive::DriveSystemServiceFactory::GetForProfile( profile_)->file_system(); file_system->GetFileByResourceId( decoded_filename, @@ -236,11 +236,11 @@ void ScreenshotSource::SendSavedScreenshot( void ScreenshotSource::GetSavedScreenshotCallback( const std::string& screenshot_path, int request_id, - gdata::DriveFileError error, + drive::DriveFileError error, const FilePath& file, const std::string& unused_mime_type, - gdata::DriveFileType file_type) { - if (error != gdata::DRIVE_FILE_OK || file_type != gdata::REGULAR_FILE) { + drive::DriveFileType file_type) { + if (error != drive::DRIVE_FILE_OK || file_type != drive::REGULAR_FILE) { ScreenshotDataPtr read_bytes(new ScreenshotData); CacheAndSendScreenshot(screenshot_path, request_id, read_bytes); return; diff --git a/chrome/browser/ui/webui/screenshot_source.h b/chrome/browser/ui/webui/screenshot_source.h index 4d33b59..c768ce6 100644 --- a/chrome/browser/ui/webui/screenshot_source.h +++ b/chrome/browser/ui/webui/screenshot_source.h @@ -92,10 +92,10 @@ class ScreenshotSource : public ChromeURLDataManager::DataSource { // The callback for Drive's getting file method. void GetSavedScreenshotCallback(const std::string& screenshot_path, int request_id, - gdata::DriveFileError error, + drive::DriveFileError error, const FilePath& file, const std::string& unused_mime_type, - gdata::DriveFileType file_type); + drive::DriveFileType file_type); #endif // Sends the screenshot data to the requestor while caching it locally to the |