Skip to content

Commit

Permalink
Revert 282837 because it broke non-chromeos builds.
Browse files Browse the repository at this point in the history
> chromeos: Move some network related UI in ui/chromeos/
> 
> Move the code responsible for showing network icons into a common component
> so that it can be used from both ash and athena. This also moves the relevant
> string and image-resources out of ash into separate ui_chromeos_ targets.
> 
> R=mmoss@chromium.org, oshima@chromium.org, sky@chromium.org, stevenjb@chromium.org
> TBR=derat@ for third_party/cros_system_api owners
> BUG=387199
> 
> Review URL: https://codereview.chromium.org/351353004

TBR=sadrul@chromium.org

Review URL: https://codereview.chromium.org/383373002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282839 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
sadrul@chromium.org committed Jul 12, 2014
1 parent 670621d commit 49e709f
Show file tree
Hide file tree
Showing 96 changed files with 182 additions and 395 deletions.
8 changes: 5 additions & 3 deletions ash/ash.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
'../ui/app_list/app_list.gyp:app_list',
'../ui/aura/aura.gyp:aura',
'../ui/base/ui_base.gyp:ui_base',
'../ui/chromeos/ui_chromeos.gyp:ui_chromeos_resources',
'../ui/chromeos/ui_chromeos.gyp:ui_chromeos_strings',
'../ui/chromeos/ui_chromeos.gyp:ui_chromeos',
'../ui/compositor/compositor.gyp:compositor',
'../ui/events/events.gyp:events',
'../ui/events/events.gyp:events_base',
Expand Down Expand Up @@ -334,6 +331,11 @@
'system/chromeos/network/network_connect.cc',
'system/chromeos/network/network_connect.h',
'system/chromeos/network/network_detailed_view.h',
'system/chromeos/network/network_icon.cc',
'system/chromeos/network/network_icon.h',
'system/chromeos/network/network_icon_animation.cc',
'system/chromeos/network/network_icon_animation.h',
'system/chromeos/network/network_icon_animation_observer.h',
'system/chromeos/network/network_observer.h',
'system/chromeos/network/network_portal_detector_observer.h',
'system/chromeos/network/network_state_list_detailed_view.cc',
Expand Down
30 changes: 30 additions & 0 deletions ash/ash_chromeos_strings.grdp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
<message name="IDS_ASH_STATUS_TRAY_VPN" desc="The label used in the VPN detailed view header.">
Private Network
</message>
<message name="IDS_ASH_STATUS_TRAY_ETHERNET" desc="The ethernet network device.">
Ethernet
</message>
<message name="IDS_ASH_STATUS_TRAY_WIFI" desc="The wifi network device.">
Wi-Fi
</message>
Expand All @@ -43,9 +46,30 @@
<message name="IDS_ASH_STATUS_TRAY_NO_CELLULAR_NETWORKS" desc="The message to display in the network list when no cellular networks are available.">
No cellular network available
</message>
<message name="IDS_ASH_STATUS_TRAY_NETWORK_NOT_CONNECTED" desc="Description in status area or network dropdown when no network is connected.">
No network
</message>
<message name="IDS_ASH_STATUS_TRAY_VPN_DISCONNECTED" desc="The label used in system tray bubble to display vpn is disconnected.">
VPN disconnected
</message>
<message name="IDS_ASH_STATUS_TRAY_NETWORK_CONNECTED" desc="Message for the network tray tooltip and default menu text when connected to a network.">
Connected to <ph name="NAME">$1<ex>GoogleGuest</ex></ph>
</message>
<message name="IDS_ASH_STATUS_TRAY_NETWORK_CONNECTING" desc="Message for the network tray tooltip and default menu text when connecting to a network.">
Connecting to <ph name="NAME">$1<ex>GoogleGuest</ex></ph>
</message>
<message name="IDS_ASH_STATUS_TRAY_NETWORK_ACTIVATING" desc="Message for the network tray tooltip and default menu text when activating a network.">
Activating <ph name="NAME">$1<ex>YBH Cellular</ex></ph>
</message>
<message name="IDS_ASH_STATUS_TRAY_NETWORK_LIST_CONNECTING" desc="Message for the network list when connecting to a network.">
<ph name="NAME">$1<ex>GoogleGuest</ex></ph>: Connecting...
</message>
<message name="IDS_ASH_STATUS_TRAY_NETWORK_LIST_ACTIVATING" desc="Message for the network list when activating a network.">
<ph name="NAME">$1<ex>YBH Cellular</ex></ph>: Activating...
</message>
<message name="IDS_ASH_STATUS_TRAY_NETWORK_LIST_ACTIVATE" desc="Message for the network list to activate the network.">
Activate <ph name="NETWORKSERVICE">$1<ex>YBH Cellular</ex></ph>
</message>
<message name="IDS_ASH_STATUS_TRAY_NETWORK_SETTINGS" desc="The label used in the settings entry in the network dialog.">
Settings...
</message>
Expand Down Expand Up @@ -94,6 +118,12 @@
<message name="IDS_ASH_STATUS_TRAY_WIFI_SCANNING_MESSAGE" desc="Scanning for wifi networks">
Searching for Wi-Fi networks...
</message>
<message name="IDS_ASH_STATUS_TRAY_INITIALIZING_CELLULAR" desc="Message for the status area when initializing the cellular device.">
Initializing cellular modem...
</message>
<message name="IDS_ASH_STATUS_TRAY_CELLULAR_SCANNING" desc="Message when scanning for cellular networks">
Searching for cellular networks...
</message>
<message name="IDS_ASH_STATUS_TRAY_BLUETOOTH_DISCOVERABLE" desc="Notification shown when a Bluetooth adapter is discoverable.">
Your computer is discoverable to nearby Bluetooth devices and will appear as "<ph name="NAME">$1<ex>Chromebook</ex></ph>" with address <ph name="ADDRESS">$2<ex>01:23:45:67:89:0A</ex></ph>
</message>
Expand Down
32 changes: 32 additions & 0 deletions ash/resources/ash_resources.grd
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,40 @@
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_LOGOUT_BUTTON_PUSHED_TOP_LEFT" file="cros/status/status_logout_button_pushed_top_left.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_LOGOUT_BUTTON_PUSHED_TOP_RIGHT" file="cros/status/status_logout_button_pushed_top_right.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_MANAGED_USER" file="cros/status/status_managed_mode_user.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_1X" file="cros/network/statusbar_network_1x.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_3G_DARK" file="cros/network/statusbar_network_3g_dark.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_3G_LIGHT" file="cros/network/statusbar_network_3g_light.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_4G_DARK" file="cros/network/statusbar_network_4g_dark.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_4G_LIGHT" file="cros/network/statusbar_network_4g_light.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_ARCS_DARK" file="cros/network/statusbar_network_arcs_dark.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_ARCS_LIGHT" file="cros/network/statusbar_network_arcs_light.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_BARS_DARK" file="cros/network/statusbar_network_bars_dark.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_BARS_LIGHT" file="cros/network/statusbar_network_bars_light.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_EDGE_DARK" file="cros/network/statusbar_network_edge_dark.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_EDGE_LIGHT" file="cros/network/statusbar_network_edge_light.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_EVDO_DARK" file="cros/network/statusbar_network_evdo_dark.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_EVDO_LIGHT" file="cros/network/statusbar_network_evdo_light.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_FAILED" file="cros/network/status_network_failed.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_GPRS_DARK" file="cros/network/statusbar_network_gprs_dark.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_GPRS_LIGHT" file="cros/network/statusbar_network_gprs_light.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_HSPA_DARK" file="cros/network/statusbar_network_hspa_dark.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_HSPA_LIGHT" file="cros/network/statusbar_network_hspa_light.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_HSPA_PLUS_DARK" file="cros/network/statusbar_network_hspa_plus_dark.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_HSPA_PLUS_LIGHT" file="cros/network/statusbar_network_hspa_plus_light.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_INFO" file="cros/network/status_network_info.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_INFO_HOVER" file="cros/network/status_network_info_hover.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_LTE_ADVANCED_DARK" file="cros/network/statusbar_network_lte_advanced_dark.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_LTE_ADVANCED_LIGHT" file="cros/network/statusbar_network_lte_advanced_light.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_LTE_DARK" file="cros/network/statusbar_network_lte_dark.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_LTE_LIGHT" file="cros/network/statusbar_network_lte_light.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_PORTAL_DARK" file="cros/network/statusbar_network_active_portal_dark.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_PORTAL_LIGHT" file="cros/network/statusbar_network_active_portal_light.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_ROAMING_DARK" file="cros/network/statusbar_network_roaming_dark.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_ROAMING_LIGHT" file="cros/network/statusbar_network_roaming_light.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_SECURE_DARK" file="cros/network/statusbar_network_secure_dark.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_VPN" file="cros/network/statusbar_vpn_dark.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_VPN_BADGE" file="cros/network/statusbar_network_vpn_badge.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_WIRED" file="cros/network/statusbar_wired.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NOTIFICATION_3G" file="cros/network/notification_3g.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NOTIFICATION_LTE" file="cros/network/notification_lte.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NOTIFICATION_SESSION_LENGTH_LIMIT" file="cros/notification/notification_session_length_timer.png" />
Expand Down
2 changes: 0 additions & 2 deletions ash/system/chromeos/DEPS
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
include_rules = [
"+chromeos",
"+grit/ui_chromeos_resources.h",
"+grit/ui_chromeos_strings.h",
]
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ui/chromeos/network/network_icon.h"
#include "ash/system/chromeos/network/network_icon.h"

#include "ash/system/chromeos/network/network_icon_animation.h"
#include "ash/system/chromeos/network/network_icon_animation_observer.h"
#include "base/strings/utf_string_conversions.h"
#include "chromeos/network/device_state.h"
#include "chromeos/network/network_connection_handler.h"
#include "chromeos/network/network_state.h"
#include "chromeos/network/network_state_handler.h"
#include "chromeos/network/portal_detector/network_portal_detector.h"
#include "grit/ui_chromeos_resources.h"
#include "grit/ui_chromeos_strings.h"
#include "grit/ash_resources.h"
#include "grit/ash_strings.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/webui/web_ui_util.h"
#include "ui/chromeos/network/network_icon_animation.h"
#include "ui/chromeos/network/network_icon_animation_observer.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/image/image_skia_operations.h"
#include "ui/gfx/image/image_skia_source.h"
Expand All @@ -32,7 +32,7 @@ using chromeos::NetworkState;
using chromeos::NetworkStateHandler;
using chromeos::NetworkTypePattern;

namespace ui {
namespace ash {
namespace network_icon {

namespace {
Expand Down Expand Up @@ -959,4 +959,4 @@ void PurgeNetworkIconCache() {
}

} // namespace network_icon
} // namespace ui
} // namespace ash
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_CHROMEOS_NETWORK_NETWORK_ICON_H_
#define UI_CHROMEOS_NETWORK_NETWORK_ICON_H_
#ifndef ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_ICON_H_
#define ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_ICON_H_

#include <string>

#include "ash/ash_export.h"
#include "base/strings/string16.h"
#include "ui/chromeos/ui_chromeos_export.h"
#include "ui/gfx/image/image_skia.h"

namespace chromeos {
class NetworkState;
}

namespace ui {
namespace ash {
namespace network_icon {

class AnimationObserver;
Expand All @@ -30,54 +30,54 @@ enum IconType {
// Gets the image for the network associated with |service_path|. |network| must
// not be NULL. |icon_type| determines the color theme and whether or not to
// show the VPN badge. This caches badged icons per network per |icon_type|.
UI_CHROMEOS_EXPORT gfx::ImageSkia GetImageForNetwork(
ASH_EXPORT gfx::ImageSkia GetImageForNetwork(
const chromeos::NetworkState* network,
IconType icon_type);

// Similar to GetImageForNetwork but returns the cached image url based on
// |scale_factor| instead.
UI_CHROMEOS_EXPORT std::string GetImageUrlForNetwork(
ASH_EXPORT std::string GetImageUrlForNetwork(
const chromeos::NetworkState* network,
IconType icon_type,
float scale_factor);

// Gets the fulls strength image for a connected network type.
UI_CHROMEOS_EXPORT gfx::ImageSkia GetImageForConnectedNetwork(
ASH_EXPORT gfx::ImageSkia GetImageForConnectedNetwork(
IconType icon_type,
const std::string& network_type);

// Gets the image for a connecting network type.
UI_CHROMEOS_EXPORT gfx::ImageSkia GetImageForConnectingNetwork(
ASH_EXPORT gfx::ImageSkia GetImageForConnectingNetwork(
IconType icon_type,
const std::string& network_type);

// Gets the image for a disconnected network type.
UI_CHROMEOS_EXPORT gfx::ImageSkia GetImageForDisconnectedNetwork(
ASH_EXPORT gfx::ImageSkia GetImageForDisconnectedNetwork(
IconType icon_type,
const std::string& network_type);

// Returns the label for |network| based on |icon_type|. |network| can be NULL.
UI_CHROMEOS_EXPORT base::string16 GetLabelForNetwork(
ASH_EXPORT base::string16 GetLabelForNetwork(
const chromeos::NetworkState* network,
IconType icon_type);

// Updates and returns the appropriate message id if the cellular network
// is uninitialized.
UI_CHROMEOS_EXPORT int GetCellularUninitializedMsg();
ASH_EXPORT int GetCellularUninitializedMsg();

// Gets the correct icon and label for |icon_type|. Also sets |animating|
// based on whether or not the icon is animating (i.e. connecting).
UI_CHROMEOS_EXPORT void GetDefaultNetworkImageAndLabel(IconType icon_type,
gfx::ImageSkia* image,
base::string16* label,
bool* animating);
ASH_EXPORT void GetDefaultNetworkImageAndLabel(IconType icon_type,
gfx::ImageSkia* image,
base::string16* label,
bool* animating);

// Called when the list of networks changes. Retreives the list of networks
// from the global NetworkStateHandler instance and removes cached entries
// that are no longer in the list.
UI_CHROMEOS_EXPORT void PurgeNetworkIconCache();
ASH_EXPORT void PurgeNetworkIconCache();

} // namespace network_icon
} // namespace ui
} // namespace ash

#endif // UI_CHROMEOS_NETWORK_NETWORK_ICON_H_
#endif // ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_ICON_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ui/chromeos/network/network_icon_animation.h"
#include "ash/system/chromeos/network/network_icon_animation.h"

#include "ui/chromeos/network/network_icon_animation_observer.h"
#include "ash/system/chromeos/network/network_icon_animation_observer.h"

namespace {
const int kThrobDurationMs = 750; // Animation cycle length.
}

namespace ui {
namespace ash {
namespace network_icon {

NetworkIconAnimation::NetworkIconAnimation()
Expand Down Expand Up @@ -58,4 +58,4 @@ NetworkIconAnimation* NetworkIconAnimation::GetInstance() {
}

} // namespace network_icon
} // namespace ui
} // namespace ash
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_CHROMEOS_NETWORK_NETWORK_ICON_ANIMATION_H_
#define UI_CHROMEOS_NETWORK_NETWORK_ICON_ANIMATION_H_
#ifndef ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_ICON_ANIMATION_H_
#define ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_ICON_ANIMATION_H_

#include <set>
#include <string>

#include "ash/ash_export.h"
#include "base/observer_list.h"
#include "ui/chromeos/ui_chromeos_export.h"
#include "ui/gfx/animation/animation_delegate.h"
#include "ui/gfx/animation/throb_animation.h"

namespace ui {
namespace ash {
namespace network_icon {

class AnimationObserver;

// Single instance class to handle icon animations and keep them in sync.
class UI_CHROMEOS_EXPORT NetworkIconAnimation : public gfx::AnimationDelegate {
class ASH_EXPORT NetworkIconAnimation : public gfx::AnimationDelegate {
public:
NetworkIconAnimation();
virtual ~NetworkIconAnimation();
Expand All @@ -43,6 +43,6 @@ class UI_CHROMEOS_EXPORT NetworkIconAnimation : public gfx::AnimationDelegate {
};

} // namespace network_icon
} // namespace ui
} // namespace ash

#endif // UI_CHROMEOS_NETWORK_NETWORK_ICON_ANIMATION_H_
#endif // ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_ICON_ANIMATION_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_CHROMEOS_NETWORK_NETWORK_ICON_ANIMATION_OBSERVER_H_
#define UI_CHROMEOS_NETWORK_NETWORK_ICON_ANIMATION_OBSERVER_H_
#ifndef ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_ICON_ANIMATION_OBSERVER_H_
#define ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_ICON_ANIMATION_OBSERVER_H_

#include "ui/chromeos/ui_chromeos_export.h"
#include "ash/ash_export.h"

namespace ui {
namespace ash {
namespace network_icon {

// Observer interface class for animating network icons.
class UI_CHROMEOS_EXPORT AnimationObserver {
class ASH_EXPORT AnimationObserver {
public:
// Called when the image has changed due to animation. The callback should
// trigger a call to GetImageForNetwork() to retrieve the image.
Expand All @@ -22,6 +22,6 @@ class UI_CHROMEOS_EXPORT AnimationObserver {
};

} // namespace network_icon
} // namespace ui
} // namespace ash

#endif // UI_CHROMEOS_NETWORK_NETWORK_ICON_ANIMATION_OBSERVER_H_
#endif // ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_ICON_ANIMATION_OBSERVER_H_
Loading

0 comments on commit 49e709f

Please sign in to comment.