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. |
| 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 { |
| 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_; } |
| 40 void set_default_title(const std::string& title) { title_ = title; } |
| 41 |
| 42 // File schema URL patterns. |
| 43 const PatternList& patterns() const { return patterns_; } |
| 44 void AddPattern(const URLPattern& pattern); |
| 45 bool ContainsURL(const GURL& url) const; |
| 46 void ClearPatterns(); |
| 47 bool OverlapsWith(const FileBrowserAction& other) const; |
| 48 |
| 49 // Action icon path. |
| 50 const std::string default_icon_path() const { return default_icon_path_; } |
| 51 void set_default_icon_path(const std::string& path) { |
| 52 default_icon_path_ = path; |
| 53 } |
| 54 |
| 55 private: |
| 56 // The id for the extension this action belongs to (as defined in the |
| 57 // extension manifest). |
| 58 std::string extension_id_; |
| 59 std::string title_; |
| 60 std::string default_icon_path_; |
| 61 // The id for the FileBrowserAction, for example: "PdfFileAction". |
| 62 std::string id_; |
| 63 // A list of file filters. |
| 64 PatternList patterns_; |
| 65 }; |
| 66 |
| 67 #endif // CHROME_COMMON_EXTENSIONS_FILE_BROWSER_ACTION_H_ |
OLD | NEW |