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_BROWSER_EXTENSIONS_EXTENSION_ACTION_ICON_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_ICON_FACTORY_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_ICON_FACTORY_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_ICON_FACTORY_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/scoped_observer.h" | 9 #include "base/scoped_observer.h" |
10 #include "extensions/browser/extension_icon_image.h" | 10 #include "extensions/browser/extension_icon_image.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 // If there is an icon set using |SetIcon|, that icon is returned. | 46 // If there is an icon set using |SetIcon|, that icon is returned. |
47 // Else, if there is a default icon set for the extension action, the icon is | 47 // Else, if there is a default icon set for the extension action, the icon is |
48 // created using IconImage. Observer is triggered wheniever the icon gets | 48 // created using IconImage. Observer is triggered wheniever the icon gets |
49 // updated. | 49 // updated. |
50 // Else, extension favicon is returned. | 50 // Else, extension favicon is returned. |
51 // In all cases, action's attention and animation icon transformations are | 51 // In all cases, action's attention and animation icon transformations are |
52 // applied on the icon. | 52 // applied on the icon. |
53 gfx::Image GetIcon(int tab_id); | 53 gfx::Image GetIcon(int tab_id); |
54 | 54 |
55 private: | 55 private: |
56 // Gets the icon that should be returned by |GetIcon| (without the attention | |
57 // and animation transformations). | |
58 gfx::ImageSkia GetBaseIconFromAction(int tab_id); | |
59 | |
60 const extensions::Extension* extension_; | 56 const extensions::Extension* extension_; |
61 const ExtensionAction* action_; | 57 const ExtensionAction* action_; |
62 Observer* observer_; | 58 Observer* observer_; |
63 | 59 |
64 ScopedObserver<extensions::IconImage, extensions::IconImage::Observer> | 60 ScopedObserver<extensions::IconImage, extensions::IconImage::Observer> |
65 icon_image_observer_; | 61 icon_image_observer_; |
66 | 62 |
67 DISALLOW_COPY_AND_ASSIGN(ExtensionActionIconFactory); | 63 DISALLOW_COPY_AND_ASSIGN(ExtensionActionIconFactory); |
68 }; | 64 }; |
69 | 65 |
70 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_ICON_FACTORY_H_ | 66 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_ICON_FACTORY_H_ |
OLD | NEW |