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

Side by Side Diff: chrome/browser/extensions/api/file_handlers/app_file_handler_util.h

Issue 14607023: Add support for persistent file access in apps. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_EXTENSIONS_API_FILE_HANDLERS_APP_FILE_HANDLER_UTIL_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_FILE_HANDLERS_APP_FILE_HANDLER_UTIL_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_FILE_HANDLERS_APP_FILE_HANDLER_UTIL_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_FILE_HANDLERS_APP_FILE_HANDLER_UTIL_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 29 matching lines...) Expand all
40 // |files| must be populated, but the MIME types are optional. 40 // |files| must be populated, but the MIME types are optional.
41 std::vector<const FileHandlerInfo*> 41 std::vector<const FileHandlerInfo*>
42 FindFileHandlersForFiles(const Extension& extension, 42 FindFileHandlersForFiles(const Extension& extension,
43 const PathAndMimeTypeSet& files); 43 const PathAndMimeTypeSet& files);
44 44
45 bool FileHandlerCanHandleFile( 45 bool FileHandlerCanHandleFile(
46 const FileHandlerInfo& handler, 46 const FileHandlerInfo& handler,
47 const std::string& mime_type, 47 const std::string& mime_type,
48 const base::FilePath& path); 48 const base::FilePath& path);
49 49
50 // Represents a file entry that a user has given an extension permission to
51 // access. Intended to be persisted to disk (in the Preferences file), so should
52 // remain serializable.
53 struct SavedFileEntry {
54 SavedFileEntry(const std::string& id,
55 const base::FilePath& path,
56 bool writable)
57 : id(id),
58 path(path),
59 writable(writable) {}
60
61 std::string id;
62 base::FilePath path;
63 bool writable;
64 };
65
66 // Refers to a file entry that a renderer has been given access to. 50 // Refers to a file entry that a renderer has been given access to.
67 struct GrantedFileEntry { 51 struct GrantedFileEntry {
68 std::string id; 52 std::string id;
69 std::string filesystem_id; 53 std::string filesystem_id;
70 std::string registered_name; 54 std::string registered_name;
71 }; 55 };
72 56
73 // Creates a new file entry and allows |renderer_id| to access |path|. This 57 // Creates a new file entry and allows |renderer_id| to access |path|. This
74 // registers a new file system for |path|. 58 // registers a new file system for |path|.
75 GrantedFileEntry CreateFileEntry( 59 GrantedFileEntry CreateFileEntry(
76 Profile* profile, 60 Profile* profile,
77 const std::string& extension_id, 61 const std::string& extension_id,
78 int renderer_id, 62 int renderer_id,
79 const base::FilePath& path, 63 const base::FilePath& path,
80 bool writable); 64 bool writable);
81 65
82 // Methods to adjust the file entry preferences for a given extension.
83 void AddSavedFileEntry(ExtensionPrefs* prefs,
84 const std::string& extension_id,
85 const std::string& file_entry_id,
86 const base::FilePath& file_path,
87 bool writable);
88 void GetSavedFileEntries(
89 const ExtensionPrefs* prefs,
90 const std::string& extension_id,
91 std::vector<app_file_handler_util::SavedFileEntry>* out);
92 void ClearSavedFileEntries(ExtensionPrefs* prefs,
93 const std::string& extension_id);
94
95 } // namespace app_file_handler_util 66 } // namespace app_file_handler_util
96 67
97 } // namespace extensions 68 } // namespace extensions
98 69
99 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_HANDLERS_APP_FILE_HANDLER_UTIL_H_ 70 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_HANDLERS_APP_FILE_HANDLER_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698