blob: 80c746badeaec30030ec6887b13b0e0f2f1e6508 [file] [log] [blame]
Daichi Hirono0cf590f82017-08-21 01:37:061// Copyright 2017 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef COMPONENTS_EXO_FILE_HELPER_H_
6#define COMPONENTS_EXO_FILE_HELPER_H_
7
8#include <string>
9
10class GURL;
11
12namespace base {
13class FilePath;
14}
15
16namespace exo {
17
18class FileHelper {
19 public:
20 virtual ~FileHelper() {}
21
22 // Returns mime type which is used for list of Uris returned by this
23 // FileHelper.
24 virtual std::string GetMimeTypeForUriList() const = 0;
25
Daichi Hironof3f855c02018-01-16 01:50:1626 // Converts native file path to URL which can be used by application with
27 // |app_id|. We don't expose enter file system to a container directly.
28 // Instead we mount specific directory in the containers' namespace. Thus we
29 // need to convert native path to file URL which points mount point in
30 // containers. The conversion should be container specific, now we only have
31 // ARC container though.
32 virtual bool GetUrlFromPath(const std::string& app_id,
33 const base::FilePath& path,
34 GURL* out) = 0;
35
Satoshi Niwae40eeeb2018-02-19 10:36:1036 // Takes in |pickle| constructed by the web contents view and returns true if
37 // it contains any valid filesystem URLs.
38 virtual bool HasUrlsInPickle(const base::Pickle& pickle) = 0;
39
40 using UrlsFromPickleCallback =
41 base::OnceCallback<void(const std::vector<GURL>& urls)>;
42
Satoshi Niwa22ac0e632018-01-30 04:41:0343 // Takes in |pickle| constructed by the web contents view, reads filesystem
44 // URLs from it and converts the URLs to something that applications can
45 // understand. e.g. content:// URI for Android apps.
Satoshi Niwae40eeeb2018-02-19 10:36:1046 virtual void GetUrlsFromPickle(const std::string& app_id,
Satoshi Niwa22ac0e632018-01-30 04:41:0347 const base::Pickle& pickle,
Satoshi Niwae40eeeb2018-02-19 10:36:1048 UrlsFromPickleCallback callback) = 0;
Daichi Hirono0cf590f82017-08-21 01:37:0649};
50
51} // namespace exo
52
53#endif // COMPONENTS_EXO_FILE_HELPER_H_