|
OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_COMMON_EXTENSIONS_FILE_BROWSER_ACTION_H_ | |
6 #define CHROME_COMMON_EXTENSIONS_FILE_BROWSER_ACTION_H_ | |
7 #pragma once | |
8 | |
9 #include <string> | |
10 #include <vector> | |
11 | |
12 #include "base/basictypes.h" | |
13 #include "chrome/common/extensions/url_pattern.h" | |
14 #include "googleurl/src/gurl.h" | |
15 | |
16 class URLPattern; | |
17 | |
18 // ExtensionAction encapsulates the state of a browser or page action. | |
Aaron Boodman
2011/04/12 22:47:21
Comment needs updating.
zel
2011/04/13 17:49:55
Done.
| |
19 // Instances can have both global and per-tab state. If a property does not have | |
20 // a per-tab value, the global value is used instead. | |
21 class FileBrowserAction { | |
Aaron Boodman
2011/04/12 22:47:21
Did you look at just using ExtensionAction directl
zel
2011/04/13 17:49:55
I did. It felt way too complex for this purpose an
| |
22 public: | |
23 typedef std::vector<URLPattern> PatternList; | |
24 | |
25 FileBrowserAction(); | |
26 ~FileBrowserAction(); | |
27 | |
28 // extension id | |
29 std::string extension_id() const { return extension_id_; } | |
30 void set_extension_id(const std::string& extension_id) { | |
31 extension_id_ = extension_id; | |
32 } | |
33 | |
34 // action id | |
35 const std::string& id() const { return id_; } | |
36 void set_id(const std::string& id) { id_ = id; } | |
37 | |
38 // default title | |
39 const std::string& default_title() const { return title_; } | |
Aaron Boodman
2011/04/12 22:47:21
s/default_// ?
zel
2011/04/13 17:49:55
Done.
| |
40 void set_default_title(const std::string& title) { title_ = title; } | |
41 | |
42 // File schema URL patterns. | |
43 const PatternList& file_url_patterns() const { return patterns_; } | |
44 void AddPattern(const URLPattern& pattern); | |
45 bool MatchesURL(const GURL& url) const; | |
46 void ClearPatterns(); | |
47 | |
48 // Action icon path. | |
49 const std::string default_icon_path() const { return default_icon_path_; } | |
50 void set_default_icon_path(const std::string& path) { | |
51 default_icon_path_ = path; | |
52 } | |
53 | |
54 private: | |
55 // The id for the extension this action belongs to (as defined in the | |
56 // extension manifest). | |
57 std::string extension_id_; | |
58 std::string title_; | |
59 std::string default_icon_path_; | |
60 // The id for the FileBrowserAction, for example: "PdfFileAction". | |
61 std::string id_; | |
62 // A list of file filters. | |
63 PatternList patterns_; | |
64 }; | |
65 | |
66 #endif // CHROME_COMMON_EXTENSIONS_FILE_BROWSER_ACTION_H_ | |
OLD | NEW |