Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 125 Type action_type() const { return action_type_; } | 125 Type action_type() const { return action_type_; } |
| 126 | 126 |
| 127 // action id -- only used with legacy page actions API | 127 // action id -- only used with legacy page actions API |
| 128 std::string id() const { return id_; } | 128 std::string id() const { return id_; } |
| 129 void set_id(const std::string& id) { id_ = id; } | 129 void set_id(const std::string& id) { id_ = id; } |
| 130 | 130 |
| 131 // static icon paths from manifest -- only used with legacy page actions API. | 131 // static icon paths from manifest -- only used with legacy page actions API. |
| 132 std::vector<std::string>* icon_paths() { return &icon_paths_; } | 132 std::vector<std::string>* icon_paths() { return &icon_paths_; } |
| 133 const std::vector<std::string>* icon_paths() const { return &icon_paths_; } | 133 const std::vector<std::string>* icon_paths() const { return &icon_paths_; } |
| 134 | 134 |
| 135 bool defaults_have_changed() const { return defaults_have_changed_; } | |
| 136 void set_defaults_have_changed(bool value) { defaults_have_changed_ = value; } | |
| 137 | |
| 135 // Set the url which the popup will load when the user clicks this action's | 138 // Set the url which the popup will load when the user clicks this action's |
| 136 // icon. Setting an empty URL will disable the popup for a given tab. | 139 // icon. Setting an empty URL will disable the popup for a given tab. |
| 137 void SetPopupUrl(int tab_id, const GURL& url); | 140 void SetPopupUrl(int tab_id, const GURL& url); |
| 138 | 141 |
| 139 // Use HasPopup() to see if a popup should be displayed. | 142 // Use HasPopup() to see if a popup should be displayed. |
| 140 bool HasPopup(int tab_id) const; | 143 bool HasPopup(int tab_id) const; |
| 141 | 144 |
| 142 // Get the URL to display in a popup. | 145 // Get the URL to display in a popup. |
| 143 GURL GetPopupUrl(int tab_id) const; | 146 GURL GetPopupUrl(int tab_id) const; |
| 144 | 147 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 310 // needed for compat with an older version of the page actions API. | 313 // needed for compat with an older version of the page actions API. |
| 311 std::string id_; | 314 std::string id_; |
| 312 | 315 |
| 313 // A list of paths to icons this action might show. This is needed to support | 316 // A list of paths to icons this action might show. This is needed to support |
| 314 // the legacy setIcon({iconIndex:...} method of the page actions API. | 317 // the legacy setIcon({iconIndex:...} method of the page actions API. |
| 315 std::vector<std::string> icon_paths_; | 318 std::vector<std::string> icon_paths_; |
| 316 | 319 |
| 317 // Saves the arguments from CacheIcon() calls. | 320 // Saves the arguments from CacheIcon() calls. |
| 318 std::map<std::string, gfx::Image> path_to_icon_cache_; | 321 std::map<std::string, gfx::Image> path_to_icon_cache_; |
| 319 | 322 |
| 323 // True if the ExtensionAction's defaults have changed from what was | |
|
Yoyo Zhou
2012/08/08 01:21:06
Isn't it that the action has changed its foobar fr
Matt Perry
2012/08/08 01:40:08
"default" is sort of an overloaded term here. I'm
| |
| 324 // specified in the manifest. | |
| 325 bool defaults_have_changed_; | |
| 326 | |
| 320 DISALLOW_COPY_AND_ASSIGN(ExtensionAction); | 327 DISALLOW_COPY_AND_ASSIGN(ExtensionAction); |
| 321 }; | 328 }; |
| 322 | 329 |
| 323 template<> | 330 template<> |
| 324 struct ExtensionAction::ValueTraits<int> { | 331 struct ExtensionAction::ValueTraits<int> { |
| 325 static int CreateEmpty() { | 332 static int CreateEmpty() { |
| 326 return -1; | 333 return -1; |
| 327 } | 334 } |
| 328 }; | 335 }; |
| 329 | 336 |
| 330 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_ACTION_H_ | 337 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_ACTION_H_ |
| OLD | NEW |