-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsmbfs_impl.cc
48 lines (37 loc) · 1.31 KB
/
smbfs_impl.cc
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
// Copyright 2020 The Chromium OS 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 "smbfs/smb_filesystem.h"
#include "smbfs/smbfs_impl.h"
#include <utility>
#include <base/bind.h>
#include <base/files/file_path.h>
#include <base/files/file_util.h>
#include <base/logging.h>
namespace smbfs {
SmbFsImpl::SmbFsImpl(base::WeakPtr<SmbFilesystem> fs,
mojom::SmbFsRequest request,
const base::FilePath& password_file_path)
: fs_(fs),
binding_(this, std::move(request)),
password_file_path_(password_file_path) {
DCHECK(fs_);
}
SmbFsImpl::~SmbFsImpl() = default;
void SmbFsImpl::RemoveSavedCredentials(
RemoveSavedCredentialsCallback callback) {
if (password_file_path_.empty()) {
std::move(callback).Run(true /* success */);
return;
}
bool success = base::DeleteFile(password_file_path_);
LOG_IF(WARNING, !success) << "Unable to erase credential file";
std::move(callback).Run(success);
}
void SmbFsImpl::DeleteRecursively(const base::FilePath& path,
DeleteRecursivelyCallback callback) {
CHECK(path.IsAbsolute());
CHECK(!path.ReferencesParent());
fs_->DeleteRecursively(path, std::move(callback));
}
} // namespace smbfs