summaryrefslogtreecommitdiffstats
path: root/chrome/browser/google_apis/gdata_wapi_service.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/google_apis/gdata_wapi_service.cc')
-rw-r--r--chrome/browser/google_apis/gdata_wapi_service.cc156
1 files changed, 82 insertions, 74 deletions
diff --git a/chrome/browser/google_apis/gdata_wapi_service.cc b/chrome/browser/google_apis/gdata_wapi_service.cc
index 02ee8be..75d5cc2 100644
--- a/chrome/browser/google_apis/gdata_wapi_service.cc
+++ b/chrome/browser/google_apis/gdata_wapi_service.cc
@@ -79,7 +79,7 @@ GDataWapiService::~GDataWapiService() {
}
}
-gdata::AuthService* GDataWapiService::auth_service_for_testing() {
+google_apis::AuthService* GDataWapiService::auth_service_for_testing() {
return runner_->auth_service();
}
@@ -92,7 +92,7 @@ void GDataWapiService::Initialize(Profile* profile) {
scopes.push_back(kUserContentScope);
// Drive App scope is required for even WAPI v3 apps access.
scopes.push_back(kDriveAppsScope);
- runner_.reset(new gdata::OperationRunner(profile, scopes));
+ runner_.reset(new google_apis::OperationRunner(profile, scopes));
runner_->Initialize();
runner_->auth_service()->AddObserver(this);
@@ -123,59 +123,63 @@ bool GDataWapiService::CancelForFilePath(const FilePath& file_path) {
return operation_registry()->CancelForFilePath(file_path);
}
-gdata::OperationProgressStatusList GDataWapiService::GetProgressStatusList()
- const {
+google_apis::OperationProgressStatusList
+GDataWapiService::GetProgressStatusList() const {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
return operation_registry()->GetProgressStatusList();
}
-void GDataWapiService::Authenticate(const gdata::AuthStatusCallback& callback) {
+void GDataWapiService::Authenticate(
+ const google_apis::AuthStatusCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
runner_->Authenticate(callback);
}
-void GDataWapiService::GetDocuments(const GURL& url,
- int64 start_changestamp,
- const std::string& search_query,
- const std::string& directory_resource_id,
- const gdata::GetDataCallback& callback) {
+void GDataWapiService::GetDocuments(
+ const GURL& url,
+ int64 start_changestamp,
+ const std::string& search_query,
+ const std::string& directory_resource_id,
+ const google_apis::GetDataCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
// Drive V2 API defines changestamp in int64, while DocumentsList API uses
// int32. This narrowing should not cause any trouble.
- gdata::GetDocumentsOperation* operation =
- new gdata::GetDocumentsOperation(operation_registry(),
- url,
- static_cast<int>(start_changestamp),
- search_query,
- directory_resource_id,
- callback);
+ google_apis::GetDocumentsOperation* operation =
+ new google_apis::GetDocumentsOperation(
+ operation_registry(),
+ url,
+ static_cast<int>(start_changestamp),
+ search_query,
+ directory_resource_id,
+ callback);
runner_->StartOperationWithRetry(operation);
}
void GDataWapiService::GetDocumentEntry(
const std::string& resource_id,
- const gdata::GetDataCallback& callback) {
+ const google_apis::GetDataCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- gdata::GetDocumentEntryOperation* operation =
- new gdata::GetDocumentEntryOperation(operation_registry(),
- resource_id,
- callback);
+ google_apis::GetDocumentEntryOperation* operation =
+ new google_apis::GetDocumentEntryOperation(operation_registry(),
+ resource_id,
+ callback);
runner_->StartOperationWithRetry(operation);
}
void GDataWapiService::GetAccountMetadata(
- const gdata::GetDataCallback& callback) {
+ const google_apis::GetDataCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- gdata::GetAccountMetadataOperation* operation =
- new gdata::GetAccountMetadataOperation(operation_registry(), callback);
+ google_apis::GetAccountMetadataOperation* operation =
+ new google_apis::GetAccountMetadataOperation(
+ operation_registry(), callback);
runner_->StartOperationWithRetry(operation);
}
void GDataWapiService::GetApplicationInfo(
- const gdata::GetDataCallback& callback) {
+ const google_apis::GetDataCallback& callback) {
// For WAPI, AccountMetadata includes Drive application information.
GetAccountMetadata(callback);
}
@@ -185,7 +189,7 @@ void GDataWapiService::DownloadDocument(
const FilePath& local_cache_path,
const GURL& document_url,
DocumentExportFormat format,
- const gdata::DownloadActionCallback& callback) {
+ const google_apis::DownloadActionCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DownloadFile(
@@ -195,128 +199,131 @@ void GDataWapiService::DownloadDocument(
"exportFormat",
GetExportFormatParam(format)),
callback,
- gdata::GetContentCallback());
+ google_apis::GetContentCallback());
}
void GDataWapiService::DownloadFile(
const FilePath& virtual_path,
const FilePath& local_cache_path,
const GURL& document_url,
- const gdata::DownloadActionCallback& download_action_callback,
- const gdata::GetContentCallback& get_content_callback) {
+ const google_apis::DownloadActionCallback& download_action_callback,
+ const google_apis::GetContentCallback& get_content_callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
runner_->StartOperationWithRetry(
- new gdata::DownloadFileOperation(operation_registry(),
- download_action_callback,
- get_content_callback, document_url,
- virtual_path, local_cache_path));
+ new google_apis::DownloadFileOperation(operation_registry(),
+ download_action_callback,
+ get_content_callback, document_url,
+ virtual_path, local_cache_path));
}
void GDataWapiService::DeleteDocument(
const GURL& document_url,
- const gdata::EntryActionCallback& callback) {
+ const google_apis::EntryActionCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
runner_->StartOperationWithRetry(
- new gdata::DeleteDocumentOperation(operation_registry(), callback,
- document_url));
+ new google_apis::DeleteDocumentOperation(operation_registry(), callback,
+ document_url));
}
void GDataWapiService::CreateDirectory(
const GURL& parent_content_url,
const FilePath::StringType& directory_name,
- const gdata::GetDataCallback& callback) {
+ const google_apis::GetDataCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
runner_->StartOperationWithRetry(
- new gdata::CreateDirectoryOperation(operation_registry(), callback,
- parent_content_url, directory_name));
+ new google_apis::CreateDirectoryOperation(
+ operation_registry(), callback, parent_content_url, directory_name));
}
-void GDataWapiService::CopyDocument(const std::string& resource_id,
- const FilePath::StringType& new_name,
- const gdata::GetDataCallback& callback) {
+void GDataWapiService::CopyDocument(
+ const std::string& resource_id,
+ const FilePath::StringType& new_name,
+ const google_apis::GetDataCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
runner_->StartOperationWithRetry(
- new gdata::CopyDocumentOperation(operation_registry(), callback,
- resource_id, new_name));
+ new google_apis::CopyDocumentOperation(operation_registry(), callback,
+ resource_id, new_name));
}
void GDataWapiService::RenameResource(
const GURL& resource_url,
const FilePath::StringType& new_name,
- const gdata::EntryActionCallback& callback) {
+ const google_apis::EntryActionCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
runner_->StartOperationWithRetry(
- new gdata::RenameResourceOperation(operation_registry(), callback,
- resource_url, new_name));
+ new google_apis::RenameResourceOperation(operation_registry(), callback,
+ resource_url, new_name));
}
void GDataWapiService::AddResourceToDirectory(
const GURL& parent_content_url,
const GURL& resource_url,
- const gdata::EntryActionCallback& callback) {
+ const google_apis::EntryActionCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
runner_->StartOperationWithRetry(
- new gdata::AddResourceToDirectoryOperation(operation_registry(),
- callback,
- parent_content_url,
- resource_url));
+ new google_apis::AddResourceToDirectoryOperation(operation_registry(),
+ callback,
+ parent_content_url,
+ resource_url));
}
void GDataWapiService::RemoveResourceFromDirectory(
const GURL& parent_content_url,
const GURL& resource_url,
const std::string& resource_id,
- const gdata::EntryActionCallback& callback) {
+ const google_apis::EntryActionCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
runner_->StartOperationWithRetry(
- new gdata::RemoveResourceFromDirectoryOperation(operation_registry(),
- callback,
- parent_content_url,
- resource_url,
- resource_id));
+ new google_apis::RemoveResourceFromDirectoryOperation(
+ operation_registry(),
+ callback,
+ parent_content_url,
+ resource_url,
+ resource_id));
}
void GDataWapiService::InitiateUpload(
- const gdata::InitiateUploadParams& params,
- const gdata::InitiateUploadCallback& callback) {
+ const google_apis::InitiateUploadParams& params,
+ const google_apis::InitiateUploadCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (params.upload_location.is_empty()) {
if (!callback.is_null())
- callback.Run(gdata::HTTP_BAD_REQUEST, GURL());
+ callback.Run(google_apis::HTTP_BAD_REQUEST, GURL());
return;
}
runner_->StartOperationWithRetry(
- new gdata::InitiateUploadOperation(
+ new google_apis::InitiateUploadOperation(
operation_registry(), callback, params));
}
void GDataWapiService::ResumeUpload(
- const gdata::ResumeUploadParams& params,
- const gdata::ResumeUploadCallback& callback) {
+ const google_apis::ResumeUploadParams& params,
+ const google_apis::ResumeUploadCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
runner_->StartOperationWithRetry(
- new gdata::ResumeUploadOperation(
+ new google_apis::ResumeUploadOperation(
operation_registry(), callback, params));
}
-void GDataWapiService::AuthorizeApp(const GURL& resource_url,
- const std::string& app_ids,
- const gdata::GetDataCallback& callback) {
+void GDataWapiService::AuthorizeApp(
+ const GURL& resource_url,
+ const std::string& app_ids,
+ const google_apis::GetDataCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
runner_->StartOperationWithRetry(
- new gdata::AuthorizeAppsOperation(operation_registry(), callback,
- resource_url, app_ids));
+ new google_apis::AuthorizeAppsOperation(operation_registry(), callback,
+ resource_url, app_ids));
}
bool GDataWapiService::HasAccessToken() const {
@@ -331,7 +338,7 @@ bool GDataWapiService::HasRefreshToken() const {
return runner_->auth_service()->HasRefreshToken();
}
-gdata::OperationRegistry* GDataWapiService::operation_registry() const {
+google_apis::OperationRegistry* GDataWapiService::operation_registry() const {
return runner_->operation_registry();
}
@@ -344,13 +351,14 @@ void GDataWapiService::OnOAuth2RefreshTokenChanged() {
}
void GDataWapiService::OnProgressUpdate(
- const gdata::OperationProgressStatusList& list) {
+ const google_apis::OperationProgressStatusList& list) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
FOR_EACH_OBSERVER(
DriveServiceObserver, observers_, OnProgressUpdate(list));
}
-void GDataWapiService::OnAuthenticationFailed(gdata::GDataErrorCode error) {
+void GDataWapiService::OnAuthenticationFailed(
+ google_apis::GDataErrorCode error) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
FOR_EACH_OBSERVER(
DriveServiceObserver, observers_, OnAuthenticationFailed(error));