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

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

Issue 209663006: [fsp] Simplify ID of provided file systems. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments. Created 6 years, 9 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>
(...skipping 10 matching lines...) Expand all
21 21
22 class ServiceFactory; 22 class ServiceFactory;
23 23
24 // Manages and registers the fileSystemProvider service. 24 // Manages and registers the fileSystemProvider service.
25 class Service : public KeyedService { 25 class Service : public KeyedService {
26 public: 26 public:
27 explicit Service(Profile* profile); 27 explicit Service(Profile* profile);
28 virtual ~Service(); 28 virtual ~Service();
29 29
30 // Registers a file system provided by an extension with the |extension_id|. 30 // Registers a file system provided by an extension with the |extension_id|.
31 // For success, it returns a file system id, which is of the following format: 31 // For success, it returns a numeric file system id, which is an
32 // |extension_id|-unique-hash, where unique is an auto-incremented non-zero 32 // auto-incremented non-zero value. For failures, it returns zero.
33 // number, and hash is the user profile hash. 33 int RegisterFileSystem(const std::string& extension_id,
34 // For failures, it returns an empty string. 34 const std::string& file_system_name);
35 std::string RegisterFileSystem(const std::string& extension_id,
36 const std::string& file_system_name);
37 35
38 // Unregisters a file system with the specified |file_system_id| for the 36 // Unregisters a file system with the specified |file_system_id| for the
39 // |extension_id|. For success returns true, otherwise false. 37 // |extension_id|. For success returns true, otherwise false.
40 bool UnregisterFileSystem(const std::string& extension_id, 38 bool UnregisterFileSystem(const std::string& extension_id,
41 const std::string& file_system_id); 39 int file_system_id);
42 40
43 // Returns a list of currently registered file systems. All items are copied. 41 // Returns a list of currently registered file systems. All items are copied.
44 std::vector<ProvidedFileSystem> GetRegisteredFileSystems(); 42 std::vector<ProvidedFileSystem> GetRegisteredFileSystems();
45 43
46 // Adds and removes observers. 44 // Adds and removes observers.
47 void AddObserver(Observer* observer); 45 void AddObserver(Observer* observer);
48 void RemoveObserver(Observer* observer); 46 void RemoveObserver(Observer* observer);
49 47
50 // Gets the singleton instance for the |context|. 48 // Gets the singleton instance for the |context|.
51 static Service* Get(content::BrowserContext* context); 49 static Service* Get(content::BrowserContext* context);
52 50
53 private: 51 private:
54 typedef std::map<std::string, ProvidedFileSystem> FileSystemMap; 52 typedef std::map<int, ProvidedFileSystem> FileSystemMap;
55 53
56 Profile* profile_; 54 Profile* profile_;
57 ObserverList<Observer> observers_; 55 ObserverList<Observer> observers_;
58 FileSystemMap file_systems_; 56 FileSystemMap file_systems_;
59 int next_handle_; 57 int next_id_;
60 58
61 DISALLOW_COPY_AND_ASSIGN(Service); 59 DISALLOW_COPY_AND_ASSIGN(Service);
62 }; 60 };
63 61
64 } // namespace file_system_provider 62 } // namespace file_system_provider
65 } // namespace chromeos 63 } // namespace chromeos
66 64
67 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_SERVICE_H_ 65 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698