| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_EXTENSION_ACTION_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_ACTION_H_ |
| 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_ACTION_H_ | 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_ACTION_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 void set_id(const std::string& id) { id_ = id; } | 31 void set_id(const std::string& id) { id_ = id; } |
| 32 | 32 |
| 33 ExtensionActionType type() const { return type_; } | 33 ExtensionActionType type() const { return type_; } |
| 34 void set_type(ExtensionActionType type) { type_ = type; } | 34 void set_type(ExtensionActionType type) { type_ = type; } |
| 35 | 35 |
| 36 std::string extension_id() const { return extension_id_; } | 36 std::string extension_id() const { return extension_id_; } |
| 37 void set_extension_id(const std::string& extension_id) { | 37 void set_extension_id(const std::string& extension_id) { |
| 38 extension_id_ = extension_id; | 38 extension_id_ = extension_id; |
| 39 } | 39 } |
| 40 | 40 |
| 41 std::string name() const { return name_; } | 41 std::string title() const { return title_; } |
| 42 void set_name(const std::string& name) { name_ = name; } | 42 void set_title(const std::string& title) { title_ = title; } |
| 43 | 43 |
| 44 const std::vector<std::string>& icon_paths() const { return icon_paths_; } | 44 const std::vector<std::string>& icon_paths() const { return icon_paths_; } |
| 45 void AddIconPath(const std::string& icon_path) { | 45 void AddIconPath(const std::string& icon_path) { |
| 46 icon_paths_.push_back(icon_path); | 46 icon_paths_.push_back(icon_path); |
| 47 } | 47 } |
| 48 | 48 |
| 49 const GURL& popup_url() const { return popup_url_; } | 49 const GURL& popup_url() const { return popup_url_; } |
| 50 void set_popup_url(const GURL& url) { popup_url_ = url; } | 50 void set_popup_url(const GURL& url) { popup_url_ = url; } |
| 51 | 51 |
| 52 const int popup_height() const { return popup_height_; } | 52 const int popup_height() const { return popup_height_; } |
| 53 void set_popup_height(int height) { popup_height_ = height; } | 53 void set_popup_height(int height) { popup_height_ = height; } |
| 54 | 54 |
| 55 bool is_popup() const { return !popup_url_.is_empty(); } | 55 bool is_popup() const { return !popup_url_.is_empty(); } |
| 56 | 56 |
| 57 private: | 57 private: |
| 58 static int next_command_id_; | 58 static int next_command_id_; |
| 59 | 59 |
| 60 // The id for the ExtensionAction, for example: "RssPageAction". | 60 // The id for the ExtensionAction, for example: "RssPageAction". |
| 61 // For BrowserActions this is blank. | 61 // For BrowserActions this is blank. |
| 62 std::string id_; | 62 std::string id_; |
| 63 | 63 |
| 64 // The type of the ExtensionAction, either PageAction or BrowserAction. | 64 // The type of the ExtensionAction, either PageAction or BrowserAction. |
| 65 ExtensionActionType type_; | 65 ExtensionActionType type_; |
| 66 | 66 |
| 67 // The id for the extension this ExtensionAction belongs to (as defined in | 67 // The id for the extension this ExtensionAction belongs to (as defined in |
| 68 // the extension manifest). | 68 // the extension manifest). |
| 69 std::string extension_id_; | 69 std::string extension_id_; |
| 70 | 70 |
| 71 // The name of the ExtensionAction. | 71 // The title text of the ExtensionAction. |
| 72 std::string name_; | 72 std::string title_; |
| 73 | 73 |
| 74 // The paths to the icons that this PageIcon can show. | 74 // The paths to the icons that this PageIcon can show. |
| 75 std::vector<std::string> icon_paths_; | 75 std::vector<std::string> icon_paths_; |
| 76 | 76 |
| 77 // An integer for use with the browser's command system. These should always | 77 // An integer for use with the browser's command system. These should always |
| 78 // be in the range [IDC_BROWSER_ACTION_FIRST, IDC_BROWSER_ACTION_LAST]. | 78 // be in the range [IDC_BROWSER_ACTION_FIRST, IDC_BROWSER_ACTION_LAST]. |
| 79 int command_id_; | 79 int command_id_; |
| 80 | 80 |
| 81 // If the action has a popup, it has a URL and a height. | 81 // If the action has a popup, it has a URL and a height. |
| 82 GURL popup_url_; | 82 GURL popup_url_; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 109 badge_background_color_ = badge_background_color; | 109 badge_background_color_ = badge_background_color; |
| 110 } | 110 } |
| 111 | 111 |
| 112 int icon_index() const { return icon_index_; } | 112 int icon_index() const { return icon_index_; } |
| 113 void set_icon_index(int icon_index) { icon_index_ = icon_index; } | 113 void set_icon_index(int icon_index) { icon_index_ = icon_index; } |
| 114 | 114 |
| 115 SkBitmap* icon() const { return icon_.get(); } | 115 SkBitmap* icon() const { return icon_.get(); } |
| 116 void set_icon(SkBitmap* icon) { icon_.reset(icon); } | 116 void set_icon(SkBitmap* icon) { icon_.reset(icon); } |
| 117 | 117 |
| 118 private: | 118 private: |
| 119 // The title to use. | 119 // The title text to use for tooltips and labels. |
| 120 std::string title_; | 120 std::string title_; |
| 121 | 121 |
| 122 // The icon to use. | 122 // The icon to use. |
| 123 int icon_index_; | 123 int icon_index_; |
| 124 | 124 |
| 125 // If non-NULL, overrides icon_index. | 125 // If non-NULL, overrides icon_index. |
| 126 scoped_ptr<SkBitmap> icon_; | 126 scoped_ptr<SkBitmap> icon_; |
| 127 | 127 |
| 128 // The badge text. | 128 // The badge text. |
| 129 std::string badge_text_; | 129 std::string badge_text_; |
| 130 | 130 |
| 131 // The background color for the badge. | 131 // The background color for the badge. |
| 132 SkColor badge_background_color_; | 132 SkColor badge_background_color_; |
| 133 | 133 |
| 134 DISALLOW_COPY_AND_ASSIGN(ExtensionActionState); | 134 DISALLOW_COPY_AND_ASSIGN(ExtensionActionState); |
| 135 }; | 135 }; |
| 136 | 136 |
| 137 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_ACTION_H_ | 137 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_ACTION_H_ |
| OLD | NEW |