summaryrefslogtreecommitdiffstats
path: root/chrome/common/page_action.h
diff options
context:
space:
mode:
authorfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-01 21:57:00 +0000
committerfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-01 21:57:00 +0000
commitd7eaf5753249cbb6e95441b07e00a6349c7afe89 (patch)
tree7d03c6ce6a182a52465ad4d8f410117c2430a6bf /chrome/common/page_action.h
parent92ac30171a8334bc1691096abccf004ed02d0d42 (diff)
downloadchromium_src-d7eaf5753249cbb6e95441b07e00a6349c7afe89.zip
chromium_src-d7eaf5753249cbb6e95441b07e00a6349c7afe89.tar.gz
chromium_src-d7eaf5753249cbb6e95441b07e00a6349c7afe89.tar.bz2
PageActions can now specify multiple icons and switch between them
using optional parameters to enableForTab. BUG=http://crbug.com/11906 TEST=None Review URL: http://codereview.chromium.org/149046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19772 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/page_action.h')
-rw-r--r--chrome/common/page_action.h34
1 files changed, 28 insertions, 6 deletions
diff --git a/chrome/common/page_action.h b/chrome/common/page_action.h
index d9ccfea..3331f8e 100644
--- a/chrome/common/page_action.h
+++ b/chrome/common/page_action.h
@@ -5,8 +5,9 @@
#ifndef CHROME_COMMON_PAGE_ACTION_H_
#define CHROME_COMMON_PAGE_ACTION_H_
-#include <string>
#include <map>
+#include <string>
+#include <vector>
#include "base/file_path.h"
@@ -34,9 +35,9 @@ class PageAction {
std::string name() const { return name_; }
void set_name(const std::string& name) { name_ = name; }
- FilePath icon_path() const { return icon_path_; }
- void set_icon_path(const FilePath& icon_path) {
- icon_path_ = icon_path;
+ const std::vector<FilePath>& icon_paths() const { return icon_paths_; }
+ void AddIconPath(const FilePath& icon_path) {
+ icon_paths_.push_back(icon_path);
}
private:
@@ -53,10 +54,31 @@ class PageAction {
// The name of the PageAction.
std::string name_;
- // The icon that represents the PageIcon.
- FilePath icon_path_;
+ // The paths to the icons that this PageIcon can show.
+ std::vector<FilePath> icon_paths_;
};
typedef std::map<std::string, PageAction*> PageActionMap;
+// This class keeps track of what values each tab uses to override the default
+// values of the PageAction.
+class PageActionState {
+ public:
+ PageActionState(std::string title, int icon_index)
+ : title_(title), icon_index_(icon_index) {
+ }
+
+ std::string title() const { return title_; }
+ int icon_index() const { return icon_index_; }
+
+ private:
+ // The title to use.
+ std::string title_;
+
+ // The icon to use.
+ int icon_index_;
+
+ DISALLOW_COPY_AND_ASSIGN(PageActionState);
+};
+
#endif // CHROME_COMMON_PAGE_ACTION_H_