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

Side by Side Diff: chrome/browser/chromeos/file_system_provider/file_system_plugin/plugin_service.h

Issue 1093383002: [WIP] Provided file system from NACL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved several modules to chromeos folder. Created 5 years, 5 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
(Empty)
1 // Copyright 2015 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 CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILE_SYSTEM_PLUGIN_PLUGIN_S ERVICE_H_
6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILE_SYSTEM_PLUGIN_PLUGIN_S ERVICE_H_
7
8 #include "base/files/file.h"
9 #include "base/files/file_path.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/observer_list.h"
13 #include "base/threading/thread_checker.h"
14 #include "base/values.h"
15 #include "chrome/browser/chromeos/file_system_provider/file_system_plugin/provid ed_file_system_adapter.h"
16 #include "chrome/browser/chromeos/file_system_provider/observer.h"
17 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_defs .h"
18 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte rface.h"
19 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_obse rver.h"
20 #include "chrome/browser/chromeos/file_system_provider/watcher.h"
21 #include "chrome/browser/profiles/profile.h"
22 #include "components/keyed_service/core/keyed_service.h"
23 #include "content/public/browser/browser_context.h"
24 #include "storage/browser/fileapi/watcher_manager.h"
25
26 namespace chromeos {
27 namespace file_system_provider {
28
29 class ProvidedFileSystemInfo;
30 class ProvidedFileSystemInterface;
31 struct MountOptions;
32
33 // Manages and registers the file system plugin provider service.
34 class PluginService : public KeyedService/*,
35 public ProvidedFileSystemObserver*/ {
36 public:
37 enum UnmountReason { UNMOUNT_REASON_USER, UNMOUNT_REASON_SHUTDOWN };
38 PluginService(Profile* profile);
39 ~PluginService() override;
40 base::File::Error MountFileSystem(
41 const std::string& source_id,
42 const MountOptions& options);
43 base::File::Error UnmountFileSystem( const std::string& source_id,
44 const std::string& file_system_id,
45 UnmountReason reason);
46
47 // Adds and removes observers.
48 void AddObserver(Observer* observer);
49 void RemoveObserver(Observer* observer);
50 // Gets the singleton instance for the |context|.
51 static PluginService* Get(content::BrowserContext* context);
52 ProvidedFileSystemAdapter* GetProvidedFileSystemAdapter(
53 const std::string& plugin_id,
54 const std::string& file_system_id);
55 ProvidedFileSystemInterface* GetProvidedFileSystem(
56 const std::string& source_id,
57 const std::string& file_system_id);
58 // Returns a provided file system attached to the the passed
59 // |mount_point_name|. If not found, then returns NULL.
60 ProvidedFileSystemInterface* GetProvidedFileSystem(
61 const std::string& mount_point_name);
62 // Returns a list of information of all currently provided file systems. All
63 // items are copied.
64 std::vector<ProvidedFileSystemInfo> GetProvidedFileSystemInfoList();
65 // // ProvidedFileSystemInterface::Observer overrides.
66 // void OnWatcherChanged(const ProvidedFileSystemInfo& file_system_info,
67 // const Watcher& watcher,
68 // storage::WatcherManager::ChangeType change_type,
69 // const ProvidedFileSystemObserver::Changes& changes,
70 // const base::Closure& callback) override;
71 // void OnWatcherTagUpdated(const ProvidedFileSystemInfo& file_system_info,
72 // const Watcher& watcher) override;
73 // void OnWatcherListChanged(const ProvidedFileSystemInfo& file_system_info,
74 // const Watchers& watchers) override;
75 private:
76 base::File::Error MountFileSystemInternal(
77 const std::string& source_id,
78 const MountOptions& options,
79 MountContext context);
80 // Key is a pair of an extension id and file system id, which makes it
81 // unique among the entire service instance.
82 typedef std::pair<std::string, std::string> FileSystemKey;
83
84 typedef std::map<FileSystemKey, ProvidedFileSystemAdapter*>
85 ProvidedFileSystemMap;
86 typedef std::map<std::string, FileSystemKey> MountPointNameToKeyMap;
87
88 Profile* profile_;
89 base::ObserverList<Observer> observers_;
90 ProvidedFileSystemMap file_system_map_; // Owns pointers.
91 MountPointNameToKeyMap mount_point_name_to_key_map_;
92 base::ThreadChecker thread_checker_;
93
94 base::WeakPtrFactory<PluginService> weak_ptr_factory_;
95 DISALLOW_COPY_AND_ASSIGN(PluginService);
96 };
97
98 } // namespace file_system_provider
99 } // namespace chromeos
100
101 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILE_SYSTEM_PLUGIN_PLUGIN _SERVICE_H_
102
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698