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

Unified Diff: ash/system/network/tray_network.cc

Issue 2817223003: Chrome OS: adjust wifi icons. (Closed)
Patch Set: 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
Index: ash/system/network/tray_network.cc
diff --git a/ash/system/network/tray_network.cc b/ash/system/network/tray_network.cc
index 297ee10c5b06384d15be1713580919ff3a95c195..69b179a66f59b00834eb112e87b41adabbcbae3e 100644
--- a/ash/system/network/tray_network.cc
+++ b/ash/system/network/tray_network.cc
@@ -28,6 +28,7 @@
#include "third_party/cros_system_api/dbus/service_constants.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/base/l10n/l10n_util.h"
+#include "ui/gfx/image/image_skia_operations.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/link.h"
#include "ui/views/controls/link_listener.h"
@@ -141,10 +142,17 @@ class NetworkDefaultView : public TrayItemMore,
gfx::ImageSkia image;
base::string16 label;
bool animating = false;
- // TODO(bruthig): Update the image to use the proper color. See
- // https://crbug.com/632027.
network_icon::GetDefaultNetworkImageAndLabel(
network_icon::ICON_TYPE_DEFAULT_VIEW, &image, &label, &animating);
+ // We use the inactive icon alpha only if there is no active network and
+ // wifi is disabled.
+ if (!IsActive() &&
+ !NetworkHandler::Get()->network_state_handler()->IsTechnologyEnabled(
+ NetworkTypePattern::WiFi())) {
+ image = gfx::ImageSkiaOperations::CreateTransparentImage(
+ image, TrayPopupItemStyle::kInactiveIconAlpha);
+ }
+
if (animating)
network_icon::NetworkIconAnimation::GetInstance()->AddObserver(this);
else
@@ -163,12 +171,15 @@ class NetworkDefaultView : public TrayItemMore,
std::unique_ptr<TrayPopupItemStyle> HandleCreateStyle() const override {
std::unique_ptr<TrayPopupItemStyle> style =
TrayItemMore::HandleCreateStyle();
- style->set_color_style(GetConnectedNetwork() != nullptr
+ style->set_color_style(IsActive()
? TrayPopupItemStyle::ColorStyle::ACTIVE
: TrayPopupItemStyle::ColorStyle::INACTIVE);
return style;
}
+ // Determines whether to use the ACTIVE or INACTIVE text style.
+ bool IsActive() const { return GetConnectedNetwork() != nullptr; }
+
private:
DISALLOW_COPY_AND_ASSIGN(NetworkDefaultView);
};
@@ -204,11 +215,10 @@ class NetworkWifiDetailedView : public NetworkDetailedView {
}
void Update() override {
- bool wifi_enabled =
+ const bool wifi_enabled =
NetworkHandler::Get()->network_state_handler()->IsTechnologyEnabled(
NetworkTypePattern::WiFi());
- image_view_->SetImage(
- network_icon::GetBasicImageForWiFiNetwork(wifi_enabled));
+ image_view_->SetImage(network_icon::GetImageForWiFiChipState(wifi_enabled));
const int string_id = wifi_enabled
? IDS_ASH_STATUS_TRAY_NETWORK_WIFI_ENABLED

Powered by Google App Engine
This is Rietveld 408576698