Index: chrome/browser/chromeos/status/network_menu_button.cc |
=================================================================== |
--- chrome/browser/chromeos/status/network_menu_button.cc (revision 55422) |
+++ chrome/browser/chromeos/status/network_menu_button.cc (working copy) |
@@ -222,144 +222,6 @@ |
canvas->DrawBitmapInt(IconForDisplay(icon(), badge()), 0, 0); |
} |
-// Override the DrawIcon method to draw the wifi icon. |
-// The wifi icon is composed of 1 or more alpha-blended icons to show the |
-// network strength. We also draw an animation for when there's upload/download |
-// traffic. |
-/* TODO(chocobo): Add this code back in when UI is finalized. |
-void NetworkMenuButton::DrawIcon(gfx::Canvas* canvas) { |
- |
- // First draw the base icon. |
- canvas->DrawBitmapInt(icon(), 0, 0); |
- |
- // If wifi, we draw the wifi signal bars. |
- NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary(); |
- if (cros->wifi_connecting() || |
- (!cros->ethernet_connected() && cros->wifi_connected())) { |
- ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
- // We want a value between 0-1. |
- // 0 reperesents no signal and 1 represents full signal strength. |
- double value = cros->wifi_connecting() ? |
- animation_connecting_.GetCurrentValue() : |
- cros->wifi_strength() / 100.0; |
- if (value < 0) |
- value = 0; |
- else if (value > 1) |
- value = 1; |
- |
- // If we are animating network traffic and not connecting, then we need to |
- // figure out if we are to also draw the extra image. |
- int downloading_index = -1; |
- int uploading_index = -1; |
- if (!animation_connecting_.is_animating()) { |
- // For network animation, we only show animation in one direction. |
- // So when we are hiding, we just use 1 minus the value. |
- // We have kNumWifiImages + 1 number of states. For the first state, where |
- // we are not adding any images, we set the index to -1. |
- if (animation_downloading_.is_animating()) { |
- double value_downloading = animation_downloading_.IsShowing() ? |
- animation_downloading_.GetCurrentValue() : |
- 1.0 - animation_downloading_.GetCurrentValue(); |
- downloading_index = static_cast<int>(value_downloading * |
- nextafter(static_cast<float>(kNumWifiImages + 1), 0)) - 1; |
- } |
- if (animation_uploading_.is_animating()) { |
- double value_uploading = animation_uploading_.IsShowing() ? |
- animation_uploading_.GetCurrentValue() : |
- 1.0 - animation_uploading_.GetCurrentValue(); |
- uploading_index = static_cast<int>(value_uploading * |
- nextafter(static_cast<float>(kNumWifiImages + 1), 0)) - 1; |
- } |
- } |
- |
- // We need to determine opacity for each of the kNumWifiImages images. |
- // We split the range (0-1) into equal ranges per kNumWifiImages images. |
- // For example if kNumWifiImages is 3, then [0-0.33) is the first image and |
- // [0.33-0.66) is the second image and [0.66-1] is the last image. |
- // For each of the image: |
- // If value < the range of this image, draw at kMinOpacity opacity. |
- // If value > the range of this image, draw at kMaxOpacity-1 opacity. |
- // If value within the range of this image, draw at an opacity value |
- // between kMinOpacity and kMaxOpacity-1 relative to where in the range |
- // value is at. |
- // NOTE: Use an array rather than just calculating a resource number to |
- // avoid creating implicit ordering dependencies on the resource values. |
- static const int kWifiUpImages[kNumWifiImages] = { |
- IDR_STATUSBAR_WIFI_UP1, |
- IDR_STATUSBAR_WIFI_UP2, |
- IDR_STATUSBAR_WIFI_UP3, |
- IDR_STATUSBAR_WIFI_UP4, |
- IDR_STATUSBAR_WIFI_UP5, |
- IDR_STATUSBAR_WIFI_UP6, |
- IDR_STATUSBAR_WIFI_UP7, |
- IDR_STATUSBAR_WIFI_UP8, |
- IDR_STATUSBAR_WIFI_UP9, |
- }; |
- static const int kWifiUpPImages[kNumWifiImages] = { |
- IDR_STATUSBAR_WIFI_UP1P, |
- IDR_STATUSBAR_WIFI_UP2P, |
- IDR_STATUSBAR_WIFI_UP3P, |
- IDR_STATUSBAR_WIFI_UP4P, |
- IDR_STATUSBAR_WIFI_UP5P, |
- IDR_STATUSBAR_WIFI_UP6P, |
- IDR_STATUSBAR_WIFI_UP7P, |
- IDR_STATUSBAR_WIFI_UP8P, |
- IDR_STATUSBAR_WIFI_UP9P, |
- }; |
- static const int kWifiDownImages[kNumWifiImages] = { |
- IDR_STATUSBAR_WIFI_DOWN1, |
- IDR_STATUSBAR_WIFI_DOWN2, |
- IDR_STATUSBAR_WIFI_DOWN3, |
- IDR_STATUSBAR_WIFI_DOWN4, |
- IDR_STATUSBAR_WIFI_DOWN5, |
- IDR_STATUSBAR_WIFI_DOWN6, |
- IDR_STATUSBAR_WIFI_DOWN7, |
- IDR_STATUSBAR_WIFI_DOWN8, |
- IDR_STATUSBAR_WIFI_DOWN9, |
- }; |
- static const int kWifiDownPImages[kNumWifiImages] = { |
- IDR_STATUSBAR_WIFI_DOWN1P, |
- IDR_STATUSBAR_WIFI_DOWN2P, |
- IDR_STATUSBAR_WIFI_DOWN3P, |
- IDR_STATUSBAR_WIFI_DOWN4P, |
- IDR_STATUSBAR_WIFI_DOWN5P, |
- IDR_STATUSBAR_WIFI_DOWN6P, |
- IDR_STATUSBAR_WIFI_DOWN7P, |
- IDR_STATUSBAR_WIFI_DOWN8P, |
- IDR_STATUSBAR_WIFI_DOWN9P, |
- }; |
- |
- double value_per_image = 1.0 / kNumWifiImages; |
- SkPaint paint; |
- for (int i = 0; i < kNumWifiImages; i++) { |
- if (value > value_per_image) { |
- paint.setAlpha(kMaxOpacity - 1); |
- value -= value_per_image; |
- } else { |
- // Map value between 0 and value_per_image to [kMinOpacity,kMaxOpacity). |
- paint.setAlpha(kMinOpacity + static_cast<int>(value / value_per_image * |
- nextafter(static_cast<float>(kMaxOpacity - kMinOpacity), 0))); |
- // For following iterations, we want to draw at kMinOpacity. |
- // So we set value to 0 here. |
- value = 0; |
- } |
- canvas->DrawBitmapInt(*rb.GetBitmapNamed(kWifiUpImages[i]), 0, 0, paint); |
- canvas->DrawBitmapInt(*rb.GetBitmapNamed(kWifiDownImages[i]), 0, 0, |
- paint); |
- |
- // Draw network traffic downloading/uploading image if necessary. |
- if (i == downloading_index) { |
- canvas->DrawBitmapInt(*rb.GetBitmapNamed(kWifiDownPImages[i]), 0, 0, |
- paint); |
- } |
- if (i == uploading_index) { |
- canvas->DrawBitmapInt(*rb.GetBitmapNamed(kWifiUpPImages[i]), 0, 0, |
- paint); |
- } |
- } |
- } |
-} |
-*/ |
//////////////////////////////////////////////////////////////////////////////// |
// NetworkMenuButton, NetworkLibrary::Observer implementation: |
@@ -406,21 +268,6 @@ |
SchedulePaint(); |
} |
-void NetworkMenuButton::NetworkTraffic(NetworkLibrary* cros, int traffic_type) { |
-/* TODO(chocobo): Add this code back in when network traffic UI is finalized. |
- if (!cros->ethernet_connected() && cros->wifi_connected() && |
- !cros->wifi_connecting()) { |
- // For downloading/uploading animation, we want to force at least one cycle |
- // so that it looks smooth. And if we keep downloading/uploading, we will |
- // keep calling StartThrobbing which will update the cycle count back to 2. |
- if (traffic_type & TRAFFIC_DOWNLOAD) |
- animation_downloading_.StartThrobbing(2); |
- if (traffic_type & TRAFFIC_UPLOAD) |
- animation_uploading_.StartThrobbing(2); |
- } |
- */ |
-} |
- |
void NetworkMenuButton::SetBadge(const SkBitmap& badge) { |
badge_ = badge; |
} |