blob: ec87d0110392e5e04c1195a8bc848d30d1f7f4c7 (
plain)
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
|
// Copyright 2016 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.
#ifndef CHROME_BROWSER_EXTENSIONS_API_FILE_HANDLERS_DIRECTORY_UTIL_H_
#define CHROME_BROWSER_EXTENSIONS_API_FILE_HANDLERS_DIRECTORY_UTIL_H_
#include <set>
#include <string>
#include <vector>
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
class Profile;
namespace base {
class FilePath;
} // namespace base
namespace storage {
class FileSystemURL;
} // namespace storage
namespace extensions {
namespace app_file_handler_util {
class IsDirectoryCollector {
public:
typedef base::Callback<void(scoped_ptr<std::set<base::FilePath>>)>
CompletionCallback;
explicit IsDirectoryCollector(Profile* profile);
virtual ~IsDirectoryCollector();
// For the given paths obtains a set with which of them are directories.
// The collector does not support virtual files if OS != CHROMEOS.
void CollectForEntriesPaths(const std::vector<base::FilePath>& paths,
const CompletionCallback& callback);
private:
void OnIsDirectoryCollected(size_t index, bool directory);
Profile* profile_;
std::vector<base::FilePath> paths_;
scoped_ptr<std::set<base::FilePath>> result_;
size_t left_;
CompletionCallback callback_;
base::WeakPtrFactory<IsDirectoryCollector> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(IsDirectoryCollector);
};
} // namespace app_file_handler_util
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_FILE_HANDLERS_DIRECTORY_UTIL_H_
|