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

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

Issue 2530763002: [ash-md] Adjusts layout of lists with sticky header rows to match specs (Closed)
Patch Set: [ash-md] Adjusts layout of lists with sticky header rows to match specs (cleanup of shill) Created 4 years, 1 month 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 | « ash/common/system/chromeos/network/network_list_md.cc ('k') | ash/common/system/tray/tray_details_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d35dda19a5ac9af3af811c49b517b5ca9e26e350..a66d03cac78fead0afe45be525d9334ba1316100 100644
--- a/ash/common/system/chromeos/network/vpn_list_view.cc
+++ b/ash/common/system/chromeos/network/vpn_list_view.cc
@@ -108,14 +108,25 @@ class VPNListProviderEntryMd : public views::ButtonListener,
public views::View {
public:
VPNListProviderEntryMd(ViewClickListener* parent,
+ bool top_item,
const std::string& name,
int button_accessible_name_id)
: parent_(parent) {
+ // TODO(varkha): Make this a sticky section header.
SetLayoutManager(new views::FillLayout);
- TriView* tri_view = TrayPopupUtils::CreateDefaultRowView();
- tri_view->SetContainerVisible(TriView::Container::START, false);
+ TriView* tri_view = TrayPopupUtils::CreateSubHeaderRowView();
AddChildView(tri_view);
+ // Sets up the border. When the provider header is the first item in the
+ // list (i.e. when the list was empty before adding the provider row) there
+ // is already |kMenuSeparatorVerticalPadding| padding at the top of the
+ // scroll contents, so only add that padding when the list was not |empty|.
+ // TODO(varkha): Delete this special handling when we allow the header to be
+ // sticky and just use ConfigureAsStickyHeader() instead.
+ tri_view->SetBorder(
+ views::CreateEmptyBorder(top_item ? 0 : kMenuSeparatorVerticalPadding,
+ 0, kMenuSeparatorVerticalPadding, 0));
+
views::Label* label = TrayPopupUtils::CreateDefaultLabel();
TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::SUB_HEADER);
style.SetupLabel(label);
@@ -449,14 +460,8 @@ void VPNListView::AddProviderAndNetworks(
const VPNProvider& vpn_provider,
const chromeos::NetworkStateHandler::NetworkStateList& networks) {
// Add a visual separator, unless this is the topmost entry in the list.
- if (!list_empty_) {
- views::Separator* const separator =
- new views::Separator(views::Separator::HORIZONTAL);
- separator->SetColor(kBorderLightColor);
- container()->AddChildView(separator);
- } else {
- list_empty_ = false;
- }
+ if (!list_empty_)
+ container()->AddChildView(TrayPopupUtils::CreateListSubHeaderSeparator());
std::string vpn_name =
vpn_provider.third_party
? vpn_provider.third_party_provider_name
@@ -466,12 +471,13 @@ void VPNListView::AddProviderAndNetworks(
views::View* provider_view = nullptr;
if (UseMd()) {
provider_view = new VPNListProviderEntryMd(
- this, vpn_name, IDS_ASH_STATUS_TRAY_ADD_CONNECTION);
+ this, list_empty_, vpn_name, IDS_ASH_STATUS_TRAY_ADD_CONNECTION);
} else {
provider_view = new VPNListProviderEntry(this, vpn_name);
}
container()->AddChildView(provider_view);
provider_view_map_[provider_view] = vpn_provider;
+ list_empty_ = false;
// Add the networks belonging to this provider, in the priority order returned
// by shill.
for (const chromeos::NetworkState* const& network : networks) {
« no previous file with comments | « ash/common/system/chromeos/network/network_list_md.cc ('k') | ash/common/system/tray/tray_details_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698