| Index: ash/common/system/chromeos/network/vpn_list_view.cc
|
| diff --git a/ash/common/system/chromeos/network/vpn_list_view.cc b/ash/common/system/chromeos/network/vpn_list_view.cc
|
| index d2fbd234a2c1f6422c921f7d3d0a67f054773c63..8069efbd484f744204cca548a0b5c11137c73c23 100644
|
| --- a/ash/common/system/chromeos/network/vpn_list_view.cc
|
| +++ b/ash/common/system/chromeos/network/vpn_list_view.cc
|
| @@ -9,7 +9,6 @@
|
| #include <vector>
|
|
|
| #include "ash/common/ash_view_ids.h"
|
| -#include "ash/common/material_design/material_design_controller.h"
|
| #include "ash/common/system/chromeos/network/network_icon.h"
|
| #include "ash/common/system/chromeos/network/network_icon_animation.h"
|
| #include "ash/common/system/chromeos/network/network_icon_animation_observer.h"
|
| @@ -47,7 +46,6 @@
|
| #include "ui/views/controls/button/label_button.h"
|
| #include "ui/views/controls/label.h"
|
| #include "ui/views/controls/separator.h"
|
| -#include "ui/views/layout/box_layout.h"
|
| #include "ui/views/layout/fill_layout.h"
|
| #include "ui/views/view.h"
|
|
|
| @@ -55,10 +53,6 @@ namespace ash {
|
|
|
| namespace {
|
|
|
| -bool UseMd() {
|
| - return MaterialDesignController::IsSystemTrayMenuMaterial();
|
| -}
|
| -
|
| // Indicates whether |network| belongs to this VPN provider.
|
| bool VpnProviderMatchesNetwork(const VPNProvider& provider,
|
| const chromeos::NetworkState& network) {
|
| @@ -85,27 +79,12 @@ class VPNListEntryBase : public HoverHighlightView {
|
| };
|
|
|
| // A list entry that represents a VPN provider.
|
| -class VPNListProviderEntry : public VPNListEntryBase {
|
| +class VPNListProviderEntry : public views::ButtonListener, public views::View {
|
| public:
|
| - VPNListProviderEntry(VPNListView* parent, const std::string& name)
|
| - : VPNListEntryBase(parent) {
|
| - views::Label* const label = AddLabel(
|
| - base::UTF8ToUTF16(name), gfx::ALIGN_LEFT, false /* highlight */);
|
| - label->SetBorder(views::CreateEmptyBorder(5, 0, 5, 0));
|
| - }
|
| -
|
| - private:
|
| - DISALLOW_COPY_AND_ASSIGN(VPNListProviderEntry);
|
| -};
|
| -
|
| -// A list entry that represents a VPN provider with Material Design.
|
| -class VPNListProviderEntryMd : public views::ButtonListener,
|
| - public views::View {
|
| - public:
|
| - VPNListProviderEntryMd(ViewClickListener* parent,
|
| - bool top_item,
|
| - const std::string& name,
|
| - int button_accessible_name_id)
|
| + VPNListProviderEntry(ViewClickListener* parent,
|
| + bool top_item,
|
| + const std::string& name,
|
| + int button_accessible_name_id)
|
| : parent_(parent) {
|
| TrayPopupUtils::ConfigureAsStickyHeader(this);
|
| SetLayoutManager(new views::FillLayout);
|
| @@ -140,7 +119,7 @@ class VPNListProviderEntryMd : public views::ButtonListener,
|
| // Our parent to handle events.
|
| ViewClickListener* parent_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(VPNListProviderEntryMd);
|
| + DISALLOW_COPY_AND_ASSIGN(VPNListProviderEntry);
|
| };
|
|
|
| // A list entry that represents a network. If the network is currently
|
| @@ -162,10 +141,10 @@ class VPNListNetworkEntry : public VPNListEntryBase,
|
|
|
| private:
|
| void UpdateFromNetworkState(const chromeos::NetworkState* network);
|
| - void SetupConnectedItemMd(const base::string16& text,
|
| - const gfx::ImageSkia& image);
|
| - void SetupConnectingItemMd(const base::string16& text,
|
| - const gfx::ImageSkia& image);
|
| + void SetupConnectedItem(const base::string16& text,
|
| + const gfx::ImageSkia& image);
|
| + void SetupConnectingItem(const base::string16& text,
|
| + const gfx::ImageSkia& image);
|
|
|
| const std::string guid_;
|
|
|
| @@ -175,10 +154,7 @@ class VPNListNetworkEntry : public VPNListEntryBase,
|
| };
|
|
|
| VPNListEntryBase::VPNListEntryBase(VPNListView* parent)
|
| - : HoverHighlightView(parent) {
|
| - if (!UseMd())
|
| - SetBorder(views::CreateEmptyBorder(0, kTrayPopupPaddingHorizontal, 0, 0));
|
| -}
|
| + : HoverHighlightView(parent) {}
|
|
|
| VPNListNetworkEntry::VPNListNetworkEntry(VPNListView* parent,
|
| const chromeos::NetworkState* network)
|
| @@ -224,12 +200,11 @@ void VPNListNetworkEntry::UpdateFromNetworkState(
|
| gfx::ImageSkia image =
|
| network_icon::GetImageForNetwork(network, network_icon::ICON_TYPE_LIST);
|
| base::string16 label = network_icon::GetLabelForNetwork(
|
| - network, UseMd() ? network_icon::ICON_TYPE_MENU_LIST
|
| - : network_icon::ICON_TYPE_LIST);
|
| + network, network_icon::ICON_TYPE_MENU_LIST);
|
| if (network->IsConnectedState())
|
| - SetupConnectedItemMd(label, image);
|
| + SetupConnectedItem(label, image);
|
| else if (network->IsConnectingState())
|
| - SetupConnectingItemMd(label, image);
|
| + SetupConnectingItem(label, image);
|
| else
|
| AddIconAndLabel(image, label, false);
|
|
|
| @@ -246,8 +221,8 @@ void VPNListNetworkEntry::UpdateFromNetworkState(
|
| }
|
|
|
| // TODO(varkha): Consolidate with a similar method in tray_bluetooth.cc.
|
| -void VPNListNetworkEntry::SetupConnectedItemMd(const base::string16& text,
|
| - const gfx::ImageSkia& image) {
|
| +void VPNListNetworkEntry::SetupConnectedItem(const base::string16& text,
|
| + const gfx::ImageSkia& image) {
|
| AddIconAndLabels(
|
| image, text,
|
| l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_NETWORK_STATUS_CONNECTED));
|
| @@ -257,8 +232,8 @@ void VPNListNetworkEntry::SetupConnectedItemMd(const base::string16& text,
|
| }
|
|
|
| // TODO(varkha): Consolidate with a similar method in tray_bluetooth.cc.
|
| -void VPNListNetworkEntry::SetupConnectingItemMd(const base::string16& text,
|
| - const gfx::ImageSkia& image) {
|
| +void VPNListNetworkEntry::SetupConnectingItem(const base::string16& text,
|
| + const gfx::ImageSkia& image) {
|
| AddIconAndLabels(
|
| image, text,
|
| l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_NETWORK_STATUS_CONNECTING));
|
| @@ -304,10 +279,6 @@ void VPNListView::Update() {
|
| provider_view_map_.clear();
|
| network_view_guid_map_.clear();
|
| list_empty_ = true;
|
| - if (!UseMd()) {
|
| - container()->SetLayoutManager(
|
| - new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0));
|
| - }
|
|
|
| // Get the list of available VPN networks, in shill's priority order.
|
| chromeos::NetworkStateHandler::NetworkStateList networks;
|
| @@ -409,12 +380,8 @@ void VPNListView::AddProviderAndNetworks(
|
|
|
| // Add a list entry for the VPN provider.
|
| views::View* provider_view = nullptr;
|
| - if (UseMd()) {
|
| - provider_view = new VPNListProviderEntryMd(
|
| - this, list_empty_, vpn_name, IDS_ASH_STATUS_TRAY_ADD_CONNECTION);
|
| - } else {
|
| - provider_view = new VPNListProviderEntry(this, vpn_name);
|
| - }
|
| + provider_view = new VPNListProviderEntry(this, list_empty_, vpn_name,
|
| + IDS_ASH_STATUS_TRAY_ADD_CONNECTION);
|
| container()->AddChildView(provider_view);
|
| provider_view_map_[provider_view] = vpn_provider;
|
| list_empty_ = false;
|
|
|