Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(761)

Side by Side Diff: chrome/common/extensions/extension_action.h

Issue 306004: Revert 29457, because this is making ExtensionBrowserTest.PageAction crash on... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/views/location_bar_view.cc ('k') | chrome/common/extensions/extension_action.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 }; 77 };
78 78
79 typedef std::map<std::string, ExtensionAction*> ExtensionActionMap; 79 typedef std::map<std::string, ExtensionAction*> ExtensionActionMap;
80 80
81 // This class keeps track of what values each tab uses to override the default 81 // This class keeps track of what values each tab uses to override the default
82 // values of the ExtensionAction. 82 // values of the ExtensionAction.
83 class ExtensionActionState { 83 class ExtensionActionState {
84 public: 84 public:
85 ExtensionActionState(std::string title, int icon_index) 85 ExtensionActionState(std::string title, int icon_index)
86 : hidden_(false), title_(title), icon_index_(icon_index), 86 : hidden_(false), title_(title), icon_index_(icon_index),
87 badge_background_color_(SkColorSetARGB(255, 218, 0, 24)), 87 badge_background_color_(SkColorSetARGB(255, 218, 0, 24)) {
88 badge_text_color_(SK_ColorWHITE) {
89 } 88 }
90 89
91 const std::string& title() const { return title_; } 90 const std::string& title() const { return title_; }
92 void set_title(const std::string& title) { title_ = title; } 91 void set_title(const std::string& title) { title_ = title; }
93 92
94 const std::string& badge_text() const { return badge_text_; } 93 const std::string& badge_text() const { return badge_text_; }
95 void set_badge_text(const std::string& badge_text) { 94 void set_badge_text(const std::string& badge_text) {
96 badge_text_ = badge_text; 95 badge_text_ = badge_text;
97 } 96 }
98 97
99 SkColor badge_background_color() const { 98 SkColor badge_background_color() const {
100 return badge_background_color_; 99 return badge_background_color_;
101 } 100 }
102 void set_badge_background_color(SkColor badge_background_color) { 101 void set_badge_background_color(SkColor badge_background_color) {
103 badge_background_color_ = badge_background_color; 102 badge_background_color_ = badge_background_color;
104 } 103 }
105 104
106 SkColor badge_text_color() const {
107 return badge_text_color_;
108 }
109 void set_badge_text_color(SkColor badge_text_color) {
110 badge_text_color_ = badge_text_color;
111 }
112
113 int icon_index() const { return icon_index_; } 105 int icon_index() const { return icon_index_; }
114 void set_icon_index(int icon_index) { icon_index_ = icon_index; } 106 void set_icon_index(int icon_index) { icon_index_ = icon_index; }
115 107
116 SkBitmap* icon() const { return icon_.get(); } 108 SkBitmap* icon() const { return icon_.get(); }
117 void set_icon(SkBitmap* icon) { icon_.reset(icon); } 109 void set_icon(SkBitmap* icon) { icon_.reset(icon); }
118 110
119 bool hidden() const { return hidden_; } 111 bool hidden() const { return hidden_; }
120 void set_hidden(bool hidden) { hidden_ = hidden; } 112 void set_hidden(bool hidden) { hidden_ = hidden; }
121 113
122 void PaintBadge(gfx::Canvas* canvas, const gfx::Rect& bounds) const; 114 void PaintBadge(gfx::Canvas* canvas, const gfx::Rect& bounds);
123 115
124 private: 116 private:
125 // True if the action is in the hidden state. 117 // True if the action is in the hidden state.
126 bool hidden_; 118 bool hidden_;
127 119
128 // The title text to use for tooltips and labels. 120 // The title text to use for tooltips and labels.
129 std::string title_; 121 std::string title_;
130 122
131 // The icon to use. 123 // The icon to use.
132 int icon_index_; 124 int icon_index_;
133 125
134 // If non-NULL, overrides icon_index. 126 // If non-NULL, overrides icon_index.
135 scoped_ptr<SkBitmap> icon_; 127 scoped_ptr<SkBitmap> icon_;
136 128
137 // The badge text. 129 // The badge text.
138 std::string badge_text_; 130 std::string badge_text_;
139 131
140 // The background color for the badge. 132 // The background color for the badge.
141 SkColor badge_background_color_; 133 SkColor badge_background_color_;
142 134
143 // The text color for the badge.
144 SkColor badge_text_color_;
145
146 DISALLOW_COPY_AND_ASSIGN(ExtensionActionState); 135 DISALLOW_COPY_AND_ASSIGN(ExtensionActionState);
147 }; 136 };
148 137
149 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_ACTION_H_ 138 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_ACTION_H_
OLDNEW
« no previous file with comments | « chrome/browser/views/location_bar_view.cc ('k') | chrome/common/extensions/extension_action.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698