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_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 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "chrome/common/extensions/url_pattern_set.h" | |
13 #include "extensions/common/url_pattern.h" | 12 #include "extensions/common/url_pattern.h" |
| 13 #include "extensions/common/url_pattern_set.h" |
14 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
15 | 15 |
16 class URLPattern; | 16 class URLPattern; |
17 | 17 |
18 // FileBrowserHandler encapsulates the state of a file browser action. | 18 // FileBrowserHandler encapsulates the state of a file browser action. |
19 class FileBrowserHandler { | 19 class FileBrowserHandler { |
20 public: | 20 public: |
21 FileBrowserHandler(); | 21 FileBrowserHandler(); |
22 ~FileBrowserHandler(); | 22 ~FileBrowserHandler(); |
23 | 23 |
24 // extension id | 24 // extension id |
25 std::string extension_id() const { return extension_id_; } | 25 std::string extension_id() const { return extension_id_; } |
26 void set_extension_id(const std::string& extension_id) { | 26 void set_extension_id(const std::string& extension_id) { |
27 extension_id_ = extension_id; | 27 extension_id_ = extension_id; |
28 } | 28 } |
29 | 29 |
30 // action id | 30 // action id |
31 const std::string& id() const { return id_; } | 31 const std::string& id() const { return id_; } |
32 void set_id(const std::string& id) { id_ = id; } | 32 void set_id(const std::string& id) { id_ = id; } |
33 | 33 |
34 // default title | 34 // default title |
35 const std::string& title() const { return title_; } | 35 const std::string& title() const { return title_; } |
36 void set_title(const std::string& title) { title_ = title; } | 36 void set_title(const std::string& title) { title_ = title; } |
37 | 37 |
38 // File schema URL patterns. | 38 // File schema URL patterns. |
39 const URLPatternSet& file_url_patterns() const { | 39 const extensions::URLPatternSet& file_url_patterns() const { |
40 return url_set_; | 40 return url_set_; |
41 } | 41 } |
42 void AddPattern(const URLPattern& pattern); | 42 void AddPattern(const URLPattern& pattern); |
43 bool MatchesURL(const GURL& url) const; | 43 bool MatchesURL(const GURL& url) const; |
44 void ClearPatterns(); | 44 void ClearPatterns(); |
45 | 45 |
46 // Action icon path. | 46 // Action icon path. |
47 const std::string icon_path() const { return default_icon_path_; } | 47 const std::string icon_path() const { return default_icon_path_; } |
48 void set_icon_path(const std::string& path) { | 48 void set_icon_path(const std::string& path) { |
49 default_icon_path_ = path; | 49 default_icon_path_ = path; |
(...skipping 18 matching lines...) Expand all Loading... |
68 // The id for the extension this action belongs to (as defined in the | 68 // The id for the extension this action belongs to (as defined in the |
69 // extension manifest). | 69 // extension manifest). |
70 std::string extension_id_; | 70 std::string extension_id_; |
71 std::string title_; | 71 std::string title_; |
72 std::string default_icon_path_; | 72 std::string default_icon_path_; |
73 // The id for the FileBrowserHandler, for example: "PdfFileAction". | 73 // The id for the FileBrowserHandler, for example: "PdfFileAction". |
74 std::string id_; | 74 std::string id_; |
75 unsigned int file_access_permission_flags_; | 75 unsigned int file_access_permission_flags_; |
76 | 76 |
77 // A list of file filters. | 77 // A list of file filters. |
78 URLPatternSet url_set_; | 78 extensions::URLPatternSet url_set_; |
79 }; | 79 }; |
80 | 80 |
81 #endif // CHROME_COMMON_EXTENSIONS_FILE_BROWSER_HANDLER_H_ | 81 #endif // CHROME_COMMON_EXTENSIONS_FILE_BROWSER_HANDLER_H_ |
OLD | NEW |