1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/sync_file_system/drive_backend/drive_service_wrapper.h"
#include <string>
#include "base/memory/weak_ptr.h"
#include "chrome/browser/drive/drive_service_interface.h"
namespace sync_file_system {
namespace drive_backend {
DriveServiceWrapper::DriveServiceWrapper(
drive::DriveServiceInterface* drive_service)
: drive_service_(drive_service) {
DCHECK(drive_service_);
}
void DriveServiceWrapper::AddNewDirectory(
const std::string& parent_resource_id,
const std::string& directory_title,
const drive::DriveServiceInterface::AddNewDirectoryOptions& options,
const google_apis::FileResourceCallback& callback) {
DCHECK(sequece_checker_.CalledOnValidSequencedThread());
drive_service_->AddNewDirectory(parent_resource_id,
directory_title,
options,
callback);
}
void DriveServiceWrapper::DeleteResource(
const std::string& resource_id,
const std::string& etag,
const google_apis::EntryActionCallback& callback) {
DCHECK(sequece_checker_.CalledOnValidSequencedThread());
drive_service_->DeleteResource(resource_id,
etag,
callback);
}
void DriveServiceWrapper::DownloadFile(
const base::FilePath& local_cache_path,
const std::string& resource_id,
const google_apis::DownloadActionCallback& download_action_callback,
const google_apis::GetContentCallback& get_content_callback,
const google_apis::ProgressCallback& progress_callback) {
DCHECK(sequece_checker_.CalledOnValidSequencedThread());
drive_service_->DownloadFile(local_cache_path,
resource_id,
download_action_callback,
get_content_callback,
progress_callback);
}
void DriveServiceWrapper::GetAboutResource(
const google_apis::AboutResourceCallback& callback) {
DCHECK(sequece_checker_.CalledOnValidSequencedThread());
drive_service_->GetAboutResource(callback);
}
void DriveServiceWrapper::GetChangeList(
int64 start_changestamp,
const google_apis::ChangeListCallback& callback) {
DCHECK(sequece_checker_.CalledOnValidSequencedThread());
drive_service_->GetChangeList(start_changestamp, callback);
}
void DriveServiceWrapper::GetRemainingChangeList(
const GURL& next_link,
const google_apis::ChangeListCallback& callback) {
DCHECK(sequece_checker_.CalledOnValidSequencedThread());
drive_service_->GetRemainingChangeList(next_link, callback);
}
void DriveServiceWrapper::GetRemainingFileList(
const GURL& next_link,
const google_apis::FileListCallback& callback) {
DCHECK(sequece_checker_.CalledOnValidSequencedThread());
drive_service_->GetRemainingFileList(next_link, callback);
}
void DriveServiceWrapper::GetFileResource(
const std::string& resource_id,
const google_apis::FileResourceCallback& callback) {
DCHECK(sequece_checker_.CalledOnValidSequencedThread());
drive_service_->GetFileResource(resource_id, callback);
}
void DriveServiceWrapper::GetFileListInDirectory(
const std::string& directory_resource_id,
const google_apis::FileListCallback& callback) {
DCHECK(sequece_checker_.CalledOnValidSequencedThread());
drive_service_->GetFileListInDirectory(directory_resource_id, callback);
}
void DriveServiceWrapper::RemoveResourceFromDirectory(
const std::string& parent_resource_id,
const std::string& resource_id,
const google_apis::EntryActionCallback& callback) {
DCHECK(sequece_checker_.CalledOnValidSequencedThread());
drive_service_->RemoveResourceFromDirectory(
parent_resource_id, resource_id, callback);
}
void DriveServiceWrapper::SearchByTitle(
const std::string& title,
const std::string& directory_resource_id,
const google_apis::FileListCallback& callback) {
DCHECK(sequece_checker_.CalledOnValidSequencedThread());
drive_service_->SearchByTitle(
title, directory_resource_id, callback);
}
} // namespace drive_backend
} // namespace sync_file_system
|