OLD | NEW |
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_DEVTOOLS_DEVTOOLS_FILE_HELPER_H_ | 5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_FILE_HELPER_H_ |
6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_FILE_HELPER_H_ | 6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_FILE_HELPER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // The |url| can be associated with a file via calling Save method. | 64 // The |url| can be associated with a file via calling Save method. |
65 // If the Save method has not been called for this |url|, then | 65 // If the Save method has not been called for this |url|, then |
66 // Append method does nothing. | 66 // Append method does nothing. |
67 void Append(const std::string& url, | 67 void Append(const std::string& url, |
68 const std::string& content, | 68 const std::string& content, |
69 const AppendCallback& callback); | 69 const AppendCallback& callback); |
70 | 70 |
71 // Shows select folder dialog. | 71 // Shows select folder dialog. |
72 // If user cancels folder selection, passes empty FileSystem struct to | 72 // If user cancels folder selection, passes empty FileSystem struct to |
73 // |callback|. | 73 // |callback|. |
74 // If selected folder contains magic file, grants renderer read/write | 74 // Shows infobar by means of |show_info_bar_callback| to let the user decide |
| 75 // whether to grant security permissions or not. |
| 76 // If user allows adding file system in infobar, grants renderer read/write |
75 // permissions, registers isolated file system for it and passes FileSystem | 77 // permissions, registers isolated file system for it and passes FileSystem |
76 // struct to |callback|. Saves file system path to prefs. | 78 // struct to |callback|. Saves file system path to prefs. |
77 // If selected folder does not contain magic file, passes error string to | 79 // If user denies adding file system in infobar, passes error string to |
78 // |callback|. | 80 // |callback|. |
79 void AddFileSystem(const AddFileSystemCallback& callback, | 81 void AddFileSystem(const AddFileSystemCallback& callback, |
80 const ShowInfoBarCallback& show_info_bar_callback); | 82 const ShowInfoBarCallback& show_info_bar_callback); |
81 | 83 |
| 84 // Upgrades dragged file system permissions to a read-write access. |
| 85 // Shows infobar by means of |show_info_bar_callback| to let the user decide |
| 86 // whether to grant security permissions or not. |
| 87 // If user allows adding file system in infobar, grants renderer read/write |
| 88 // permissions, registers isolated file system for it and passes FileSystem |
| 89 // struct to |callback|. Saves file system path to prefs. |
| 90 // If user denies adding file system in infobar, passes error string to |
| 91 // |callback|. |
| 92 void UpgradeDraggedFileSystemPermissions( |
| 93 const std::string& file_system_url, |
| 94 const AddFileSystemCallback& callback, |
| 95 const ShowInfoBarCallback& show_info_bar_callback); |
| 96 |
82 // Loads file system paths from prefs, grants permissions and registers | 97 // Loads file system paths from prefs, grants permissions and registers |
83 // isolated file system for those of them that contain magic file and passes | 98 // isolated file system for those of them that contain magic file and passes |
84 // FileSystem structs for registered file systems to |callback|. | 99 // FileSystem structs for registered file systems to |callback|. |
85 void RequestFileSystems(const RequestFileSystemsCallback& callback); | 100 void RequestFileSystems(const RequestFileSystemsCallback& callback); |
86 | 101 |
87 // Removes isolated file system for given |file_system_path|. | 102 // Removes isolated file system for given |file_system_path|. |
88 void RemoveFileSystem(const std::string& file_system_path); | 103 void RemoveFileSystem(const std::string& file_system_path); |
89 | 104 |
90 // Returns whether access to the folder on given |file_system_path| was | 105 // Returns whether access to the folder on given |file_system_path| was |
91 // granted. | 106 // granted. |
(...skipping 19 matching lines...) Expand all Loading... |
111 | 126 |
112 content::WebContents* web_contents_; | 127 content::WebContents* web_contents_; |
113 Profile* profile_; | 128 Profile* profile_; |
114 typedef std::map<std::string, base::FilePath> PathsMap; | 129 typedef std::map<std::string, base::FilePath> PathsMap; |
115 PathsMap saved_files_; | 130 PathsMap saved_files_; |
116 base::WeakPtrFactory<DevToolsFileHelper> weak_factory_; | 131 base::WeakPtrFactory<DevToolsFileHelper> weak_factory_; |
117 DISALLOW_COPY_AND_ASSIGN(DevToolsFileHelper); | 132 DISALLOW_COPY_AND_ASSIGN(DevToolsFileHelper); |
118 }; | 133 }; |
119 | 134 |
120 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_FILE_HELPER_H_ | 135 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_FILE_HELPER_H_ |
OLD | NEW |