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

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

Issue 242150: Implement browserAction.setIcon(ImageData) for extensions. (Closed)
Patch Set: common function 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
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>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/scoped_ptr.h" 13 #include "base/scoped_ptr.h"
14 #include "googleurl/src/gurl.h" 14 #include "googleurl/src/gurl.h"
15 #include "third_party/skia/include/core/SkBitmap.h"
15 #include "third_party/skia/include/core/SkColor.h" 16 #include "third_party/skia/include/core/SkColor.h"
16 17
17 class ExtensionAction { 18 class ExtensionAction {
18 public: 19 public:
19 ExtensionAction(); 20 ExtensionAction();
20 virtual ~ExtensionAction(); 21 virtual ~ExtensionAction();
21 22
22 typedef enum { 23 typedef enum {
23 PAGE_ACTION = 0, 24 PAGE_ACTION = 0,
24 BROWSER_ACTION = 1, 25 BROWSER_ACTION = 1,
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 SkColor* badge_background_color() const { 103 SkColor* badge_background_color() const {
103 return badge_background_color_.get(); 104 return badge_background_color_.get();
104 } 105 }
105 void set_badge_background_color(const SkColor& badge_background_color) { 106 void set_badge_background_color(const SkColor& badge_background_color) {
106 badge_background_color_.reset(new SkColor(badge_background_color)); 107 badge_background_color_.reset(new SkColor(badge_background_color));
107 } 108 }
108 109
109 int icon_index() const { return icon_index_; } 110 int icon_index() const { return icon_index_; }
110 void set_icon_index(int icon_index) { icon_index_ = icon_index; } 111 void set_icon_index(int icon_index) { icon_index_ = icon_index; }
111 112
113 SkBitmap* icon() const { return icon_.get(); }
114 void set_icon(SkBitmap* icon) { icon_.reset(icon); }
115
112 private: 116 private:
113 // The title to use. 117 // The title to use.
114 std::string title_; 118 std::string title_;
115 119
116 // The icon to use. 120 // The icon to use.
117 int icon_index_; 121 int icon_index_;
118 122
119 // The badge text. 123 // If non-NULL, overrides icon_index.
124 scoped_ptr<SkBitmap> icon_;
125
126 // The badge text.
120 std::string badge_text_; 127 std::string badge_text_;
121 128
122 // The background color for the badge. 129 // The background color for the badge.
123 scoped_ptr<SkColor> badge_background_color_; 130 scoped_ptr<SkColor> badge_background_color_;
124 131
125 DISALLOW_COPY_AND_ASSIGN(ExtensionActionState); 132 DISALLOW_COPY_AND_ASSIGN(ExtensionActionState);
126 }; 133 };
127 134
128 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_ACTION_H_ 135 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_ACTION_H_
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/extension_api.json ('k') | chrome/renderer/extensions/extension_process_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698