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

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

Issue 12387065: Convert TrayVPN to use new NetworkState code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix browser_tests Created 7 years, 10 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/chromeos/network/network_icon.cc
diff --git a/ash/system/chromeos/network/network_icon.cc b/ash/system/chromeos/network/network_icon.cc
index 2a90d26414d7aeb3dc885799e38f31874bfec652..05de7d1c7f96a3905410dbd0d66602a34658336d 100644
--- a/ash/system/chromeos/network/network_icon.cc
+++ b/ash/system/chromeos/network/network_icon.cc
@@ -287,6 +287,11 @@ gfx::ImageSkia GetImageForIndex(ImageType image_type,
const gfx::ImageSkia GetDisconnectedImage(const std::string& type,
IconType icon_type) {
+ if (type == flimflam::kTypeVPN) {
+ // Note: same as connected image, shouldn't normally be seen.
+ return *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
+ IDR_AURA_UBER_TRAY_NETWORK_VPN);
+ }
ImageType image_type = ImageTypeForNetworkType(type);
const int disconnected_index = 0;
return GetImageForIndex(image_type, icon_type, disconnected_index);
@@ -597,5 +602,31 @@ string16 GetLabelForNetwork(const chromeos::NetworkState* network,
return UTF8ToUTF16(network->name());
}
+int GetCellularUninitializedMsg() {
+ static base::Time s_uninitialized_state_time;
+ static int s_uninitialized_msg(0);
+
+ NetworkStateHandler* handler = NetworkStateHandler::Get();
+ if (handler->TechnologyUninitialized(
+ NetworkStateHandler::kMatchTypeMobile)) {
+ s_uninitialized_msg = IDS_ASH_STATUS_TRAY_INITIALIZING_CELLULAR;
+ s_uninitialized_state_time = base::Time::Now();
+ return s_uninitialized_msg;
+ } else if (handler->GetScanningByType(
+ NetworkStateHandler::kMatchTypeMobile)) {
+ s_uninitialized_msg = IDS_ASH_STATUS_TRAY_CELLULAR_SCANNING;
+ s_uninitialized_state_time = base::Time::Now();
+ return s_uninitialized_msg;
+ }
+ // There can be a delay between leaving the Initializing state and when
+ // a Cellular device shows up, so keep showing the initializing
+ // animation for a bit to avoid flashing the disconnect icon.
+ const int kInitializingDelaySeconds = 1;
+ base::TimeDelta dtime = base::Time::Now() - s_uninitialized_state_time;
+ if (dtime.InSeconds() < kInitializingDelaySeconds)
+ return s_uninitialized_msg;
+ return 0;
+}
+
} // namespace network_icon
} // namespace ash
« no previous file with comments | « ash/system/chromeos/network/network_icon.h ('k') | ash/system/chromeos/network/network_state_list_detailed_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698