| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_COMMON_EXTENSIONS_FILE_BROWSER_HANDLER_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_FILE_BROWSER_HANDLER_H_ |
| 6 #define CHROME_COMMON_EXTENSIONS_FILE_BROWSER_HANDLER_H_ | 6 #define CHROME_COMMON_EXTENSIONS_FILE_BROWSER_HANDLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 void AddPattern(const URLPattern& pattern); | 43 void AddPattern(const URLPattern& pattern); |
| 44 bool MatchesURL(const GURL& url) const; | 44 bool MatchesURL(const GURL& url) const; |
| 45 void ClearPatterns(); | 45 void ClearPatterns(); |
| 46 | 46 |
| 47 // Action icon path. | 47 // Action icon path. |
| 48 const std::string icon_path() const { return default_icon_path_; } | 48 const std::string icon_path() const { return default_icon_path_; } |
| 49 void set_icon_path(const std::string& path) { | 49 void set_icon_path(const std::string& path) { |
| 50 default_icon_path_ = path; | 50 default_icon_path_ = path; |
| 51 } | 51 } |
| 52 | 52 |
| 53 // File access permissions. |
| 54 // Adjusts file_access_permission_flags_ to allow specified permission. |
| 55 bool AddFileAccessPermission(const std::string& permission_str); |
| 56 // Checks that specified file access permissions are valid (all set |
| 57 // permissions are valid and there is no other permission specified with |
| 58 // "create") |
| 59 // If no access permissions were set, initialize them to default value. |
| 60 bool ValidateFileAccessPermissions(); |
| 61 // Checks if handler has read access. |
| 62 bool CanRead() const; |
| 63 // Checks if handler has write access. |
| 64 bool CanWrite() const; |
| 65 // Checks if handler has "create" access specified. |
| 66 bool HasCreateAccessPermission() const; |
| 67 |
| 53 private: | 68 private: |
| 54 // The id for the extension this action belongs to (as defined in the | 69 // The id for the extension this action belongs to (as defined in the |
| 55 // extension manifest). | 70 // extension manifest). |
| 56 std::string extension_id_; | 71 std::string extension_id_; |
| 57 std::string title_; | 72 std::string title_; |
| 58 std::string default_icon_path_; | 73 std::string default_icon_path_; |
| 59 // The id for the FileBrowserHandler, for example: "PdfFileAction". | 74 // The id for the FileBrowserHandler, for example: "PdfFileAction". |
| 60 std::string id_; | 75 std::string id_; |
| 76 unsigned int file_access_permission_flags_; |
| 77 |
| 61 // A list of file filters. | 78 // A list of file filters. |
| 62 URLPatternSet url_set_; | 79 URLPatternSet url_set_; |
| 63 }; | 80 }; |
| 64 | 81 |
| 65 #endif // CHROME_COMMON_EXTENSIONS_FILE_BROWSER_HANDLER_H_ | 82 #endif // CHROME_COMMON_EXTENSIONS_FILE_BROWSER_HANDLER_H_ |
| OLD | NEW |