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

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

Issue 237583015: [fsp] Add FileSystemURLParser to the file system provider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Simplified. Created 6 years, 8 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 | Annotate | Revision Log
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_SERVICE_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_SERVICE_H_
6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_SERVICE_H_ 6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_SERVICE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/files/file.h" 12 #include "base/files/file.h"
13 #include "base/files/file_path.h"
13 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
15 #include "base/observer_list.h" 16 #include "base/observer_list.h"
16 #include "base/values.h" 17 #include "base/values.h"
17 #include "chrome/browser/chromeos/file_system_provider/observer.h" 18 #include "chrome/browser/chromeos/file_system_provider/observer.h"
18 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/common/extensions/api/file_system_provider.h" 20 #include "chrome/common/extensions/api/file_system_provider.h"
20 #include "components/keyed_service/core/keyed_service.h" 21 #include "components/keyed_service/core/keyed_service.h"
21 #include "content/public/browser/browser_context.h" 22 #include "content/public/browser/browser_context.h"
22 23
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 // Returns a list of information of all currently provided file systems. All 68 // Returns a list of information of all currently provided file systems. All
68 // items are copied. 69 // items are copied.
69 std::vector<ProvidedFileSystemInfo> GetProvidedFileSystemInfoList(); 70 std::vector<ProvidedFileSystemInfo> GetProvidedFileSystemInfoList();
70 71
71 // Returns a provided file system with |file_system_id|, handled by 72 // Returns a provided file system with |file_system_id|, handled by
72 // the extension with |extension_id|. If not found, then returns NULL. 73 // the extension with |extension_id|. If not found, then returns NULL.
73 ProvidedFileSystemInterface* GetProvidedFileSystem( 74 ProvidedFileSystemInterface* GetProvidedFileSystem(
74 const std::string& extension_id, 75 const std::string& extension_id,
75 int file_system_id); 76 int file_system_id);
76 77
78 // Returns a provided file system attached to the the passed
79 // |mount_point_name|. If not found, then returns NULL.
80 ProvidedFileSystemInterface* GetProvidedFileSystem(
81 const std::string& mount_point_name);
82
77 // Adds and removes observers. 83 // Adds and removes observers.
78 void AddObserver(Observer* observer); 84 void AddObserver(Observer* observer);
79 void RemoveObserver(Observer* observer); 85 void RemoveObserver(Observer* observer);
80 86
81 // Gets the singleton instance for the |context|. 87 // Gets the singleton instance for the |context|.
82 static Service* Get(content::BrowserContext* context); 88 static Service* Get(content::BrowserContext* context);
83 89
84 // BrowserContextKeyedService overrides. 90 // BrowserContextKeyedService overrides.
85 virtual void Shutdown() OVERRIDE; 91 virtual void Shutdown() OVERRIDE;
86 92
87 private: 93 private:
88 typedef std::map<int, ProvidedFileSystemInterface*> ProvidedFileSystemMap; 94 typedef std::map<int, ProvidedFileSystemInterface*> ProvidedFileSystemMap;
95 typedef std::map<std::string, int> MountPointNameToIdMap;
89 96
90 // Called when the providing extension accepts or refuses a unmount request. 97 // Called when the providing extension accepts or refuses a unmount request.
91 // If |error| is equal to FILE_OK, then the request is accepted. 98 // If |error| is equal to FILE_OK, then the request is accepted.
92 void OnRequestUnmountStatus(const ProvidedFileSystemInfo& file_system_info, 99 void OnRequestUnmountStatus(const ProvidedFileSystemInfo& file_system_info,
93 base::File::Error error); 100 base::File::Error error);
94 101
95 Profile* profile_; 102 Profile* profile_;
96 FileSystemFactoryCallback file_system_factory_; 103 FileSystemFactoryCallback file_system_factory_;
97 ObserverList<Observer> observers_; 104 ObserverList<Observer> observers_;
98 ProvidedFileSystemMap file_system_map_; // Owns pointers. 105 ProvidedFileSystemMap file_system_map_; // Owns pointers.
106 MountPointNameToIdMap mount_point_name_to_id_map_;
99 int next_id_; 107 int next_id_;
100 base::WeakPtrFactory<Service> weak_ptr_factory_; 108 base::WeakPtrFactory<Service> weak_ptr_factory_;
101 109
102 DISALLOW_COPY_AND_ASSIGN(Service); 110 DISALLOW_COPY_AND_ASSIGN(Service);
103 }; 111 };
104 112
105 } // namespace file_system_provider 113 } // namespace file_system_provider
106 } // namespace chromeos 114 } // namespace chromeos
107 115
108 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_SERVICE_H_ 116 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698