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

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

Issue 11588004: Move ScriptBadge, ActionInfo out of Extension; preparation for BrowserAction (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Latest master for CQ Created 7 years, 11 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) 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>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/memory/linked_ptr.h" 13 #include "base/memory/linked_ptr.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/scoped_vector.h" 15 #include "base/memory/scoped_vector.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/observer_list.h" 17 #include "base/observer_list.h"
18 #include "chrome/common/extensions/extension.h" 18 #include "chrome/common/extensions/api/extension_action/action_info.h"
19 #include "chrome/common/extensions/extension_icon_set.h" 19 #include "chrome/common/extensions/extension_icon_set.h"
20 #include "third_party/skia/include/core/SkColor.h" 20 #include "third_party/skia/include/core/SkColor.h"
21 #include "ui/base/animation/linear_animation.h" 21 #include "ui/base/animation/linear_animation.h"
22 22
23 class GURL; 23 class GURL;
24 class SkBitmap; 24 class SkBitmap;
25 class SkDevice; 25 class SkDevice;
26 26
27 namespace gfx { 27 namespace gfx {
28 class Canvas; 28 class Canvas;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 mutable scoped_ptr<SkDevice> device_; 106 mutable scoped_ptr<SkDevice> device_;
107 107
108 ObserverList<Observer> observers_; 108 ObserverList<Observer> observers_;
109 109
110 base::WeakPtrFactory<IconAnimation> weak_ptr_factory_; 110 base::WeakPtrFactory<IconAnimation> weak_ptr_factory_;
111 111
112 DISALLOW_COPY_AND_ASSIGN(IconAnimation); 112 DISALLOW_COPY_AND_ASSIGN(IconAnimation);
113 }; 113 };
114 114
115 ExtensionAction(const std::string& extension_id, 115 ExtensionAction(const std::string& extension_id,
116 extensions::Extension::ActionInfo::Type action_type, 116 extensions::ActionInfo::Type action_type,
117 const extensions::Extension::ActionInfo& manifest_data); 117 const extensions::ActionInfo& manifest_data);
118 ~ExtensionAction(); 118 ~ExtensionAction();
119 119
120 // Gets a copy of this, ownership passed to caller. 120 // Gets a copy of this, ownership passed to caller.
121 // It doesn't make sense to copy of an ExtensionAction except in tests. 121 // It doesn't make sense to copy of an ExtensionAction except in tests.
122 scoped_ptr<ExtensionAction> CopyForTest() const; 122 scoped_ptr<ExtensionAction> CopyForTest() const;
123 123
124 // Given the extension action type, returns the size the extension action icon 124 // Given the extension action type, returns the size the extension action icon
125 // should have. The icon should be square, so only one dimension is 125 // should have. The icon should be square, so only one dimension is
126 // returned. 126 // returned.
127 static int GetIconSizeForType(extensions::Extension::ActionInfo::Type type); 127 static int GetIconSizeForType(extensions::ActionInfo::Type type);
128 128
129 // extension id 129 // extension id
130 const std::string& extension_id() const { return extension_id_; } 130 const std::string& extension_id() const { return extension_id_; }
131 131
132 // What kind of action is this? 132 // What kind of action is this?
133 extensions::Extension::ActionInfo::Type action_type() const { 133 extensions::ActionInfo::Type action_type() const {
134 return action_type_; 134 return action_type_;
135 } 135 }
136 136
137 // action id -- only used with legacy page actions API 137 // action id -- only used with legacy page actions API
138 std::string id() const { return id_; } 138 std::string id() const { return id_; }
139 void set_id(const std::string& id) { id_ = id; } 139 void set_id(const std::string& id) { id_ = id; }
140 140
141 bool has_changed() const { return has_changed_; } 141 bool has_changed() const { return has_changed_; }
142 void set_has_changed(bool value) { has_changed_ = value; } 142 void set_has_changed(bool value) { has_changed_ = value; }
143 143
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 } else { 280 } else {
281 iter = map->find(kDefaultTabId); 281 iter = map->find(kDefaultTabId);
282 return iter != map->end() ? iter->second : ValueTraits<T>::CreateEmpty(); 282 return iter != map->end() ? iter->second : ValueTraits<T>::CreateEmpty();
283 } 283 }
284 } 284 }
285 285
286 // The id for the extension this action belongs to (as defined in the 286 // The id for the extension this action belongs to (as defined in the
287 // extension manifest). 287 // extension manifest).
288 const std::string extension_id_; 288 const std::string extension_id_;
289 289
290 const extensions::Extension::ActionInfo::Type action_type_; 290 const extensions::ActionInfo::Type action_type_;
291 291
292 // Each of these data items can have both a global state (stored with the key 292 // Each of these data items can have both a global state (stored with the key
293 // kDefaultTabId), or tab-specific state (stored with the tab_id as the key). 293 // kDefaultTabId), or tab-specific state (stored with the tab_id as the key).
294 std::map<int, GURL> popup_url_; 294 std::map<int, GURL> popup_url_;
295 std::map<int, std::string> title_; 295 std::map<int, std::string> title_;
296 std::map<int, gfx::ImageSkia> icon_; 296 std::map<int, gfx::ImageSkia> icon_;
297 std::map<int, std::string> badge_text_; 297 std::map<int, std::string> badge_text_;
298 std::map<int, SkColor> badge_background_color_; 298 std::map<int, SkColor> badge_background_color_;
299 std::map<int, SkColor> badge_text_color_; 299 std::map<int, SkColor> badge_text_color_;
300 std::map<int, Appearance> appearance_; 300 std::map<int, Appearance> appearance_;
(...skipping 21 matching lines...) Expand all
322 }; 322 };
323 323
324 template<> 324 template<>
325 struct ExtensionAction::ValueTraits<int> { 325 struct ExtensionAction::ValueTraits<int> {
326 static int CreateEmpty() { 326 static int CreateEmpty() {
327 return -1; 327 return -1;
328 } 328 }
329 }; 329 };
330 330
331 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_H_ 331 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/browser_event_router.cc ('k') | chrome/browser/extensions/extension_action.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698