Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(217)

Side by Side Diff: chrome/browser/chromeos/file_system_provider/provided_file_system_info.h

Issue 1093383002: [WIP] Provided file system from NACL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Various cleanups Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INFO_H _ 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INFO_H _
6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INFO_H _ 6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INFO_H _
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_defs .h"
11 12
12 namespace chromeos { 13 namespace chromeos {
13 namespace file_system_provider { 14 namespace file_system_provider {
14 15
15 // Source of the file system's contents. 16 // Source of the file system's contents.
16 enum Source { SOURCE_UNKNOWN, SOURCE_FILE, SOURCE_DEVICE, SOURCE_NETWORK }; 17 enum Source { SOURCE_UNKNOWN, SOURCE_FILE, SOURCE_DEVICE, SOURCE_NETWORK };
17 18
18 // Options for creating the provided file system info. 19 // Options for creating the provided file system info.
19 struct MountOptions { 20 struct MountOptions {
20 MountOptions(); 21 MountOptions();
21 22
22 // Only mandatory fields. 23 // Only mandatory fields.
23 MountOptions(const std::string& file_system_id, 24 MountOptions(const std::string& file_system_id,
24 const std::string& display_name); 25 const std::string& display_name);
25 26
26 std::string file_system_id; 27 std::string file_system_id;
27 std::string display_name; 28 std::string display_name;
28 bool writable; 29 bool writable;
29 Source source; 30 Source source;
30 bool supports_notify_tag; 31 bool supports_notify_tag;
31 int opened_files_limit; 32 int opened_files_limit;
32 }; 33 };
33 34
34 // Contains information about the provided file system instance. 35 // Contains information about the provided file system instance.
35 class ProvidedFileSystemInfo { 36 class ProvidedFileSystemInfo {
36 public: 37 public:
37 ProvidedFileSystemInfo(); 38 ProvidedFileSystemInfo();
38 39
39 ProvidedFileSystemInfo(const std::string& extension_id, 40 ProvidedFileSystemInfo(const std::string& source_id,
40 const MountOptions& mount_options, 41 const MountOptions& mount_options,
41 const base::FilePath& mount_path); 42 const base::FilePath& mount_path,
43 Source_Type type = Source_Type::extension);
42 44
43 ~ProvidedFileSystemInfo(); 45 ~ProvidedFileSystemInfo();
44 46
45 const std::string& extension_id() const { return extension_id_; } 47 // return the source or an empty string if the source type
48 // is not the same as the expected one
49 const std::string extension_id() const {
50 return get_source_id(Source_Type::extension);
51 }
52 const std::string plugin_id() const {
53 return get_source_id(Source_Type::plugin);
54 }
55 const std::string source_id() const { return get_source_id(source_type_); }
56
57 Source_Type source_type() const { return source_type_; }
58
46 const std::string& file_system_id() const { return file_system_id_; } 59 const std::string& file_system_id() const { return file_system_id_; }
47 const std::string& display_name() const { return display_name_; } 60 const std::string& display_name() const { return display_name_; }
48 bool writable() const { return writable_; } 61 bool writable() const { return writable_; }
49 Source source() const { return source_; } 62 Source source() const { return source_; }
50 bool supports_notify_tag() const { return supports_notify_tag_; } 63 bool supports_notify_tag() const { return supports_notify_tag_; }
51 int opened_files_limit() const { return opened_files_limit_; } 64 int opened_files_limit() const { return opened_files_limit_; }
52 const base::FilePath& mount_path() const { return mount_path_; } 65 const base::FilePath& mount_path() const { return mount_path_; }
53 66
54 private: 67 private:
55 // ID of the extension providing this file system. 68 // Return the source that is providing the file system
56 std::string extension_id_; 69 const std::string get_source_id(Source_Type type) const;
70 // ID of the source providing this file system.
71 std::string source_id_;
57 72
58 // ID of the file system. 73 // ID of the file system.
59 std::string file_system_id_; 74 std::string file_system_id_;
60 75
61 // Name of the file system, can be rendered in the UI. 76 // Name of the file system, can be rendered in the UI.
62 std::string display_name_; 77 std::string display_name_;
63 78
64 // Whether the file system is writable or just read-only. 79 // Whether the file system is writable or just read-only.
65 bool writable_; 80 bool writable_;
66 81
67 // Source of the file system's contents. By default SOURCE_UNKNOWN. 82 // Source of the file system's contents. By default SOURCE_UNKNOWN.
68 Source source_; 83 Source source_;
69 84
70 // Supports tags for file/directory change notifications. 85 // Supports tags for file/directory change notifications.
71 bool supports_notify_tag_; 86 bool supports_notify_tag_;
72 87
73 // Limit of opened files in parallel. If unlimited, then 0. 88 // Limit of opened files in parallel. If unlimited, then 0.
74 int opened_files_limit_; 89 int opened_files_limit_;
75 90
76 // Mount path of the underlying file system. 91 // Mount path of the underlying file system.
77 base::FilePath mount_path_; 92 base::FilePath mount_path_;
93
94 // The source of the filesystem
95 Source_Type source_type_;
78 }; 96 };
79 97
80 } // namespace file_system_provider 98 } // namespace file_system_provider
81 } // namespace chromeos 99 } // namespace chromeos
82 100
83 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INF O_H_ 101 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INF O_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698