Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2023)

Unified Diff: ash/common/system/chromeos/network/network_icon.cc

Issue 2792253002: Remove a use of raster asset for VPN; update to MD. (Closed)
Patch Set: restore Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/system/chromeos/network/network_icon.cc
diff --git a/ash/common/system/chromeos/network/network_icon.cc b/ash/common/system/chromeos/network/network_icon.cc
index 9eebcc6ddbf868a9ea9500184a1d782b7eafcf0e..372761896a69dff9ba8dab3d07e7f81602ee667f 100644
--- a/ash/common/system/chromeos/network/network_icon.cc
+++ b/ash/common/system/chromeos/network/network_icon.cc
@@ -7,7 +7,6 @@
#include "ash/common/system/chromeos/network/network_icon_animation.h"
#include "ash/common/system/chromeos/network/network_icon_animation_observer.h"
#include "ash/common/system/tray/tray_constants.h"
-#include "ash/resources/grit/ash_resources.h"
#include "ash/resources/vector_icons/vector_icons.h"
#include "ash/strings/grit/ash_strings.h"
#include "base/macros.h"
@@ -21,7 +20,6 @@
#include "third_party/skia/include/core/SkPaint.h"
#include "third_party/skia/include/core/SkPath.h"
#include "ui/base/l10n/l10n_util.h"
-#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/geometry/insets.h"
@@ -483,17 +481,13 @@ gfx::ImageSkia* ConnectingWirelessImage(ImageType image_type,
}
gfx::ImageSkia ConnectingVpnImage(double animation) {
- int index = animation * nextafter(static_cast<float>(kNumFadeImages), 0);
- static gfx::ImageSkia* s_vpn_images[kNumFadeImages];
- if (!s_vpn_images[index]) {
- // Lazily cache images.
- ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- // TODO(estade): update this icon to MD. See crbug.com/690176
- gfx::ImageSkia* icon = rb.GetImageSkiaNamed(IDR_AURA_UBER_TRAY_NETWORK_VPN);
- s_vpn_images[index] = new gfx::ImageSkia(
- gfx::ImageSkiaOperations::CreateTransparentImage(*icon, animation));
- }
- return *s_vpn_images[index];
+ float floored_animation_value =
+ std::floor(animation * kNumFadeImages) / kNumFadeImages;
+ return gfx::CreateVectorIcon(
+ kNetworkVpnIcon,
+ gfx::Tween::ColorValueBetween(
+ floored_animation_value,
+ SkColorSetA(kMenuIconColor, kConnectingImageAlpha), kMenuIconColor));
}
Badge ConnectingVpnBadge(double animation, IconType icon_type) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698