File: drive_service_wrapper.cc

package info (click to toggle)
chromium 135.0.7049.95-1~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 5,959,392 kB
  • sloc: cpp: 34,198,526; ansic: 7,100,035; javascript: 3,985,800; python: 1,395,489; asm: 896,754; xml: 722,891; pascal: 180,504; sh: 94,909; perl: 88,388; objc: 79,739; sql: 53,020; cs: 41,358; fortran: 24,137; makefile: 22,501; php: 13,699; tcl: 10,142; yacc: 8,822; ruby: 7,350; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; awk: 197; sed: 36
file content (137 lines) | stat: -rw-r--r-- 5,120 bytes parent folder | download | duplicates (7)
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
// Copyright 2014 The Chromium Authors
// 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 "components/drive/service/drive_service_interface.h"

namespace sync_file_system {
namespace drive_backend {

DriveServiceWrapper::DriveServiceWrapper(
    drive::DriveServiceInterface* drive_service)
    : drive_service_(drive_service) {
  DCHECK(drive_service_);
}

DriveServiceWrapper::~DriveServiceWrapper() = default;

void DriveServiceWrapper::AddNewDirectory(
    const std::string& parent_resource_id,
    const std::string& directory_title,
    const drive::AddNewDirectoryOptions& options,
    google_apis::FileResourceCallback callback) {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  drive_service_->AddNewDirectory(parent_resource_id, directory_title, options,
                                  std::move(callback));
}

void DriveServiceWrapper::DeleteResource(
    const std::string& resource_id,
    const std::string& etag,
    google_apis::EntryActionCallback callback) {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  drive_service_->DeleteResource(resource_id, etag, std::move(callback));
}

void DriveServiceWrapper::DownloadFile(
    const base::FilePath& local_cache_path,
    const std::string& resource_id,
    google_apis::DownloadActionCallback download_action_callback,
    const google_apis::GetContentCallback& get_content_callback,
    google_apis::ProgressCallback progress_callback) {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  drive_service_->DownloadFile(local_cache_path, resource_id,
                               std::move(download_action_callback),
                               get_content_callback, progress_callback);
}

void DriveServiceWrapper::GetAboutResource(
    google_apis::AboutResourceCallback callback) {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  drive_service_->GetAboutResource(std::move(callback));
}

void DriveServiceWrapper::GetStartPageToken(
    const std::string& team_drive_id,
    google_apis::StartPageTokenCallback callback) {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  drive_service_->GetStartPageToken(team_drive_id, std::move(callback));
}

void DriveServiceWrapper::GetChangeList(
    int64_t start_changestamp,
    google_apis::ChangeListCallback callback) {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  drive_service_->GetChangeList(start_changestamp, std::move(callback));
}

void DriveServiceWrapper::GetChangeListByToken(
    const std::string& team_drive_id,
    const std::string& start_page_token,
    google_apis::ChangeListCallback callback) {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  drive_service_->GetChangeListByToken(team_drive_id, start_page_token,
                                       std::move(callback));
}

void DriveServiceWrapper::GetRemainingChangeList(
    const GURL& next_link,
    google_apis::ChangeListCallback callback) {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  drive_service_->GetRemainingChangeList(next_link, std::move(callback));
}

void DriveServiceWrapper::GetRemainingTeamDriveList(
    const std::string& page_token,
    google_apis::TeamDriveListCallback callback) {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  drive_service_->GetRemainingTeamDriveList(page_token, std::move(callback));
}

void DriveServiceWrapper::GetRemainingFileList(
    const GURL& next_link,
    google_apis::FileListCallback callback) {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  drive_service_->GetRemainingFileList(next_link, std::move(callback));
}

void DriveServiceWrapper::GetFileResource(
    const std::string& resource_id,
    google_apis::FileResourceCallback callback) {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  drive_service_->GetFileResource(resource_id, std::move(callback));
}

void DriveServiceWrapper::GetFileListInDirectory(
    const std::string& directory_resource_id,
    google_apis::FileListCallback callback) {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  drive_service_->GetFileListInDirectory(directory_resource_id,
                                         std::move(callback));
}

void DriveServiceWrapper::RemoveResourceFromDirectory(
    const std::string& parent_resource_id,
    const std::string& resource_id,
    google_apis::EntryActionCallback callback) {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  drive_service_->RemoveResourceFromDirectory(parent_resource_id, resource_id,
                                              std::move(callback));
}

void DriveServiceWrapper::SearchByTitle(
    const std::string& title,
    const std::string& directory_resource_id,
    google_apis::FileListCallback callback) {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  drive_service_->SearchByTitle(title, directory_resource_id,
                                std::move(callback));
}

}  // namespace drive_backend
}  // namespace sync_file_system