diff options
author | chocobo@chromium.org <chocobo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-09 18:59:50 +0000 |
---|---|---|
committer | chocobo@chromium.org <chocobo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-09 18:59:50 +0000 |
commit | afdcd4010a449e3d89a37b025e5970173b85a180 (patch) | |
tree | 8c5eb6c48c0166aa7228f023b9383b150f8d15ec /chrome/browser/chromeos/status | |
parent | 8a3125a7100ffc53f6731604fcf299ab9331e0ba (diff) | |
download | chromium_src-afdcd4010a449e3d89a37b025e5970173b85a180.zip chromium_src-afdcd4010a449e3d89a37b025e5970173b85a180.tar.gz chromium_src-afdcd4010a449e3d89a37b025e5970173b85a180.tar.bz2 |
Clean up code by removing network traffic code in network library.
We are no longer using the code. If we decide that we need it later, we will likely do something different.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3084027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55432 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/status')
-rw-r--r-- | chrome/browser/chromeos/status/network_menu_button.cc | 153 | ||||
-rw-r--r-- | chrome/browser/chromeos/status/network_menu_button.h | 1 |
2 files changed, 0 insertions, 154 deletions
diff --git a/chrome/browser/chromeos/status/network_menu_button.cc b/chrome/browser/chromeos/status/network_menu_button.cc index be180a2..ad5e7cc 100644 --- a/chrome/browser/chromeos/status/network_menu_button.cc +++ b/chrome/browser/chromeos/status/network_menu_button.cc @@ -222,144 +222,6 @@ void NetworkMenuButton::DrawIcon(gfx::Canvas* canvas) { 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 @@ void NetworkMenuButton::NetworkChanged(NetworkLibrary* cros) { 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; } diff --git a/chrome/browser/chromeos/status/network_menu_button.h b/chrome/browser/chromeos/status/network_menu_button.h index c72e5eb..096f88a5 100644 --- a/chrome/browser/chromeos/status/network_menu_button.h +++ b/chrome/browser/chromeos/status/network_menu_button.h @@ -86,7 +86,6 @@ class NetworkMenuButton : public StatusAreaButton, // NetworkLibrary::Observer implementation. virtual void NetworkChanged(NetworkLibrary* obj); - virtual void NetworkTraffic(NetworkLibrary* cros, int traffic_type); // Returns the Icon for a network strength between 0 and 100. // |black| is used to specify whether to return a black icon for display |