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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 // Since ExtensionAction, living in common/, can't interact with the browser | 161 // Since ExtensionAction, living in common/, can't interact with the browser |
162 // to load images, the UI code needs to load the images for each path. For | 162 // to load images, the UI code needs to load the images for each path. For |
163 // each path in default_icon_path() and icon_paths(), load the image there | 163 // each path in default_icon_path() and icon_paths(), load the image there |
164 // using an ImageLoadingTracker and call CacheIcon(path, image) with the | 164 // using an ImageLoadingTracker and call CacheIcon(path, image) with the |
165 // result. | 165 // result. |
166 // | 166 // |
167 // If an image is cached redundantly, the first load will be used. | 167 // If an image is cached redundantly, the first load will be used. |
168 void CacheIcon(const std::string& path, const gfx::Image& icon); | 168 void CacheIcon(const std::string& path, const gfx::Image& icon); |
169 | 169 |
170 // Set this action's icon bitmap on a specific tab. | 170 // Set this action's icon bitmap on a specific tab. |
171 void SetIcon(int tab_id, const SkBitmap& bitmap); | 171 void SetIcon(int tab_id, const gfx::Image& image); |
172 | 172 |
173 // Get the icon for a tab, or the default if no icon was set for this tab, | 173 // Get the icon for a tab, or the default if no icon was set for this tab, |
174 // retrieving icons that have been specified by path from the previous | 174 // retrieving icons that have been specified by path from the previous |
175 // arguments to CacheIcon(). If the default icon isn't found in the cache, | 175 // arguments to CacheIcon(). If the default icon isn't found in the cache, |
176 // returns the puzzle piece icon. | 176 // returns the puzzle piece icon. |
177 gfx::Image GetIcon(int tab_id) const; | 177 gfx::Image GetIcon(int tab_id) const; |
178 | 178 |
179 // Set this action's icon index for a specific tab. For use with | 179 // Set this action's icon index for a specific tab. For use with |
180 // icon_paths(), only used in page actions. | 180 // icon_paths(), only used in page actions. |
181 void SetIconIndex(int tab_id, int index); | 181 void SetIconIndex(int tab_id, int index); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 }; | 328 }; |
329 | 329 |
330 template<> | 330 template<> |
331 struct ExtensionAction::ValueTraits<int> { | 331 struct ExtensionAction::ValueTraits<int> { |
332 static int CreateEmpty() { | 332 static int CreateEmpty() { |
333 return -1; | 333 return -1; |
334 } | 334 } |
335 }; | 335 }; |
336 | 336 |
337 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_ACTION_H_ | 337 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_ACTION_H_ |
OLD | NEW |