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

Side by Side Diff: trunk/src/chrome/browser/extensions/extension_action.h

Issue 189873005: Revert 255588 "Persist browseraction properties across restarts" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 9 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_BROWSER_EXTENSIONS_EXTENSION_ACTION_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_H_ 6 #define CHROME_BROWSER_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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 // What kind of action is this? 62 // What kind of action is this?
63 extensions::ActionInfo::Type action_type() const { 63 extensions::ActionInfo::Type action_type() const {
64 return action_type_; 64 return action_type_;
65 } 65 }
66 66
67 // action id -- only used with legacy page actions API 67 // action id -- only used with legacy page actions API
68 std::string id() const { return id_; } 68 std::string id() const { return id_; }
69 void set_id(const std::string& id) { id_ = id; } 69 void set_id(const std::string& id) { id_ = id; }
70 70
71 bool has_changed() const { return has_changed_; }
72 void set_has_changed(bool value) { has_changed_ = value; }
73
71 // Set the url which the popup will load when the user clicks this action's 74 // Set the url which the popup will load when the user clicks this action's
72 // icon. Setting an empty URL will disable the popup for a given tab. 75 // icon. Setting an empty URL will disable the popup for a given tab.
73 void SetPopupUrl(int tab_id, const GURL& url); 76 void SetPopupUrl(int tab_id, const GURL& url);
74 77
75 // Use HasPopup() to see if a popup should be displayed. 78 // Use HasPopup() to see if a popup should be displayed.
76 bool HasPopup(int tab_id) const; 79 bool HasPopup(int tab_id) const;
77 80
78 // Get the URL to display in a popup. 81 // Get the URL to display in a popup.
79 GURL GetPopupUrl(int tab_id) const; 82 GURL GetPopupUrl(int tab_id) const;
80 83
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 void ClearAllValuesForTab(int tab_id); 175 void ClearAllValuesForTab(int tab_id);
173 176
174 // If the specified tab has a badge, paint it into the provided bounds. 177 // If the specified tab has a badge, paint it into the provided bounds.
175 void PaintBadge(gfx::Canvas* canvas, const gfx::Rect& bounds, int tab_id); 178 void PaintBadge(gfx::Canvas* canvas, const gfx::Rect& bounds, int tab_id);
176 179
177 // Returns icon image with badge for specified tab. 180 // Returns icon image with badge for specified tab.
178 gfx::ImageSkia GetIconWithBadge(const gfx::ImageSkia& icon, 181 gfx::ImageSkia GetIconWithBadge(const gfx::ImageSkia& icon,
179 int tab_id, 182 int tab_id,
180 const gfx::Size& spacing) const; 183 const gfx::Size& spacing) const;
181 184
182 // Determine whether or not the ExtensionAction has a value set for the given
183 // |tab_id| for each property.
184 bool HasPopupUrl(int tab_id) const;
185 bool HasTitle(int tab_id) const;
186 bool HasBadgeText(int tab_id) const;
187 bool HasBadgeBackgroundColor(int tab_id) const;
188 bool HasBadgeTextColor(int tab_id) const;
189 bool HasIsVisible(int tab_id) const;
190 bool HasIcon(int tab_id) const;
191
192 private: 185 private:
193 // Returns width of the current icon for tab_id. 186 // Returns width of the current icon for tab_id.
194 // TODO(tbarzic): The icon selection is done in ExtensionActionIconFactory. 187 // TODO(tbarzic): The icon selection is done in ExtensionActionIconFactory.
195 // We should probably move this there too. 188 // We should probably move this there too.
196 int GetIconWidth(int tab_id) const; 189 int GetIconWidth(int tab_id) const;
197 190
198 template <class T> 191 template <class T>
199 struct ValueTraits { 192 struct ValueTraits {
200 static T CreateEmpty() { 193 static T CreateEmpty() {
201 return T(); 194 return T();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 std::map<int, int> declarative_show_count_; 249 std::map<int, int> declarative_show_count_;
257 250
258 // ExtensionIconSet containing paths to bitmaps from which default icon's 251 // ExtensionIconSet containing paths to bitmaps from which default icon's
259 // image representations will be selected. 252 // image representations will be selected.
260 scoped_ptr<const ExtensionIconSet> default_icon_; 253 scoped_ptr<const ExtensionIconSet> default_icon_;
261 254
262 // The id for the ExtensionAction, for example: "RssPageAction". This is 255 // The id for the ExtensionAction, for example: "RssPageAction". This is
263 // needed for compat with an older version of the page actions API. 256 // needed for compat with an older version of the page actions API.
264 std::string id_; 257 std::string id_;
265 258
259 // True if the ExtensionAction's settings have changed from what was
260 // specified in the manifest.
261 bool has_changed_;
262
266 DISALLOW_COPY_AND_ASSIGN(ExtensionAction); 263 DISALLOW_COPY_AND_ASSIGN(ExtensionAction);
267 }; 264 };
268 265
269 template<> 266 template<>
270 struct ExtensionAction::ValueTraits<int> { 267 struct ExtensionAction::ValueTraits<int> {
271 static int CreateEmpty() { 268 static int CreateEmpty() {
272 return -1; 269 return -1;
273 } 270 }
274 }; 271 };
275 272
276 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_H_ 273 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698