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_CHROMEOS_STATUS_NETWORK_MENU_ICON_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_ICON_H_ |
6 #define CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_ICON_H_ | 6 #define CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_ICON_H_ |
7 | 7 |
8 // NetworkMenuIcon Manages an icon that reflects the current state of the | 8 // NetworkMenuIcon Manages an icon that reflects the current state of the |
9 // network (see chromeos::NetworkLibrary). It takes an optional Delegate | 9 // network (see chromeos::NetworkLibrary). It takes an optional Delegate |
10 // argument in the constructor that signals the delegate when the icon changes. | 10 // argument in the constructor that signals the delegate when the icon changes. |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 virtual ~NetworkMenuIcon(); | 79 virtual ~NetworkMenuIcon(); |
80 | 80 |
81 // Setter for |last_network_type_| | 81 // Setter for |last_network_type_| |
82 void set_last_network_type(ConnectionType last_network_type) { | 82 void set_last_network_type(ConnectionType last_network_type) { |
83 last_network_type_ = last_network_type; | 83 last_network_type_ = last_network_type; |
84 } | 84 } |
85 | 85 |
86 // Sets the resource color theme (e.g. light or dark icons). | 86 // Sets the resource color theme (e.g. light or dark icons). |
87 void SetResourceColorTheme(ResourceColorTheme color); | 87 void SetResourceColorTheme(ResourceColorTheme color); |
88 | 88 |
| 89 // Returns true if the icon should be visible in a system tray. |
| 90 bool ShouldShowIconInTray(); |
| 91 |
89 // Generates and returns the icon image. If |text| is not NULL, sets it to | 92 // Generates and returns the icon image. If |text| is not NULL, sets it to |
90 // the tooltip or display text to show, based on the value of mode_. | 93 // the tooltip or display text to show, based on the value of mode_. |
91 const gfx::ImageSkia GetIconAndText(string16* text); | 94 const gfx::ImageSkia GetIconAndText(string16* text); |
92 | 95 |
93 // ui::AnimationDelegate implementation. | 96 // ui::AnimationDelegate implementation. |
94 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 97 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
95 | 98 |
96 // Static functions for generating network icon images: | 99 // Static functions for generating network icon images: |
97 | 100 |
98 // Composites the images to generate a network icon. Input parameters are | 101 // Composites the images to generate a network icon. Input parameters are |
99 // the icon and badges that are composited to generate |result|. Public | 102 // the icon and badges that are composited to generate |result|. Public |
100 // primarily for unit tests. | 103 // primarily for unit tests. |
101 static const gfx::ImageSkia GenerateImageFromComponents( | 104 static const gfx::ImageSkia GenerateImageFromComponents( |
102 const gfx::ImageSkia& icon, | 105 const gfx::ImageSkia& icon, |
103 const gfx::ImageSkia* top_left_badge, | 106 const gfx::ImageSkia* top_left_badge, |
104 const gfx::ImageSkia* top_right_badge, | 107 const gfx::ImageSkia* top_right_badge, |
105 const gfx::ImageSkia* bottom_left_badge, | 108 const gfx::ImageSkia* bottom_left_badge, |
106 const gfx::ImageSkia* bottom_right_badge); | 109 const gfx::ImageSkia* bottom_right_badge); |
107 | 110 |
108 // Returns a modified version of |source| representing the connecting state | 111 // Returns a modified version of |source| representing the connecting state |
109 // of a network. Public for unit tests. | 112 // of a network. Public for unit tests. |
110 static const gfx::ImageSkia GenerateConnectingImage( | 113 static const gfx::ImageSkia GenerateConnectingImage( |
111 const gfx::ImageSkia& source); | 114 const gfx::ImageSkia& source); |
112 | 115 |
113 // Returns an image associated with |network|, reflecting its current state. | 116 // Returns an image associated with |network|, reflecting its current state. |
114 static const gfx::ImageSkia GetImage(const Network* network, | 117 static const gfx::ImageSkia GetImage(const Network* network, |
115 ResourceColorTheme color); | 118 ResourceColorTheme color); |
116 | 119 |
117 // Returns an image representing an unconnected VPN. | |
118 static const gfx::ImageSkia GetVpnImage(); | |
119 | |
120 // Access a specific image of the specified color theme. If index is out of | 120 // Access a specific image of the specified color theme. If index is out of |
121 // range, an empty image will be returned. | 121 // range, an empty image will be returned. |
122 static const gfx::ImageSkia GetImage(ImageType type, | 122 static const gfx::ImageSkia GetImage(ImageType type, |
123 int index, | 123 int index, |
124 ResourceColorTheme color); | 124 ResourceColorTheme color); |
125 | 125 |
126 // Gets the disconnected image for given type. | 126 // Gets the disconnected image for given type. |
127 static const gfx::ImageSkia GetDisconnectedImage(ImageType type, | 127 static const gfx::ImageSkia GetDisconnectedImage(ImageType type, |
128 ResourceColorTheme color); | 128 ResourceColorTheme color); |
129 | 129 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 const Network* connecting_network_; | 172 const Network* connecting_network_; |
173 // The tooltip or display text associated with the menu icon. | 173 // The tooltip or display text associated with the menu icon. |
174 string16 text_; | 174 string16 text_; |
175 | 175 |
176 DISALLOW_COPY_AND_ASSIGN(NetworkMenuIcon); | 176 DISALLOW_COPY_AND_ASSIGN(NetworkMenuIcon); |
177 }; | 177 }; |
178 | 178 |
179 } // namespace chromeos | 179 } // namespace chromeos |
180 | 180 |
181 #endif // CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_ICON_H_ | 181 #endif // CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_ICON_H_ |
OLD | NEW |