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

Side by Side Diff: ash/common/system/chromeos/network/vpn_list_view.cc

Issue 2512883002: [Chrome OS MD] Update Cast and VPN to follow MD layout (Closed)
Patch Set: address comments Created 4 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/common/system/chromeos/network/vpn_list_view.h" 5 #include "ash/common/system/chromeos/network/vpn_list_view.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 190
191 const std::string service_path_; 191 const std::string service_path_;
192 192
193 views::LabelButton* disconnect_button_ = nullptr; 193 views::LabelButton* disconnect_button_ = nullptr;
194 194
195 DISALLOW_COPY_AND_ASSIGN(VPNListNetworkEntry); 195 DISALLOW_COPY_AND_ASSIGN(VPNListNetworkEntry);
196 }; 196 };
197 197
198 VPNListEntryBase::VPNListEntryBase(VPNListView* parent) 198 VPNListEntryBase::VPNListEntryBase(VPNListView* parent)
199 : HoverHighlightView(parent) { 199 : HoverHighlightView(parent) {
200 SetBorder(views::CreateEmptyBorder(0, kTrayPopupPaddingHorizontal, 0, 0)); 200 if (!UseMd())
201 SetBorder(views::CreateEmptyBorder(0, kTrayPopupPaddingHorizontal, 0, 0));
201 } 202 }
202 203
203 VPNListNetworkEntry::VPNListNetworkEntry(VPNListView* parent, 204 VPNListNetworkEntry::VPNListNetworkEntry(VPNListView* parent,
204 const chromeos::NetworkState* network) 205 const chromeos::NetworkState* network)
205 : VPNListEntryBase(parent), service_path_(network->path()) { 206 : VPNListEntryBase(parent), service_path_(network->path()) {
206 UpdateFromNetworkState(network); 207 UpdateFromNetworkState(network);
207 } 208 }
208 209
209 VPNListNetworkEntry::~VPNListNetworkEntry() { 210 VPNListNetworkEntry::~VPNListNetworkEntry() {
210 network_icon::NetworkIconAnimation::GetInstance()->RemoveObserver(this); 211 network_icon::NetworkIconAnimation::GetInstance()->RemoveObserver(this);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 279
279 RemoveAllChildViews(true); 280 RemoveAllChildViews(true);
280 disconnect_button_ = nullptr; 281 disconnect_button_ = nullptr;
281 282
282 AddIconAndLabel( 283 AddIconAndLabel(
283 network_icon::GetImageForNetwork(network, network_icon::ICON_TYPE_LIST), 284 network_icon::GetImageForNetwork(network, network_icon::ICON_TYPE_LIST),
284 network_icon::GetLabelForNetwork(network, network_icon::ICON_TYPE_LIST), 285 network_icon::GetLabelForNetwork(network, network_icon::ICON_TYPE_LIST),
285 IsConnectedOrConnecting(network)); 286 IsConnectedOrConnecting(network));
286 if (IsConnectedOrConnecting(network)) { 287 if (IsConnectedOrConnecting(network)) {
287 if (UseMd()) { 288 if (UseMd()) {
289 DCHECK(tri_view());
bruthig 2016/11/24 22:36:29 nit: I believe the style guide says not to include
288 disconnect_button_ = TrayPopupUtils::CreateTrayPopupButton( 290 disconnect_button_ = TrayPopupUtils::CreateTrayPopupButton(
289 this, l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_VPN_DISCONNECT)); 291 this, l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_VPN_DISCONNECT));
292 tri_view()->AddView(TriView::Container::END, disconnect_button_);
293 tri_view()->SetContainerVisible(TriView::Container::END, true);
294 tri_view()->SetContainerBorder(
295 TriView::Container::END,
296 views::CreateEmptyBorder(0, 0, 0, kTrayPopupButtonEndMargin));
290 } else { 297 } else {
291 disconnect_button_ = new DisconnectButton(this); 298 disconnect_button_ = new DisconnectButton(this);
299 AddChildView(disconnect_button_);
300 SetBorder(views::CreateEmptyBorder(0, kTrayPopupPaddingHorizontal, 0, 3));
292 } 301 }
293 if (UseMd()) {
294 DCHECK(tri_view());
295 tri_view()->AddView(TriView::Container::END, disconnect_button_);
296 tri_view()->SetContainerVisible(TriView::Container::END, true);
297 } else {
298 AddChildView(disconnect_button_);
299 }
300
301 SetBorder(
302 views::CreateEmptyBorder(0, kTrayPopupPaddingHorizontal, 0,
303 UseMd() ? kTrayPopupButtonEndMargin : 3));
304 } else { 302 } else {
305 SetBorder(views::CreateEmptyBorder(0, kTrayPopupPaddingHorizontal, 0, 0)); 303 if (!UseMd())
304 SetBorder(views::CreateEmptyBorder(0, kTrayPopupPaddingHorizontal, 0, 0));
306 } 305 }
307 306
308 if (!UseMd()) { 307 if (!UseMd()) {
309 // The icon and the disconnect button are always set to their preferred 308 // The icon and the disconnect button are always set to their preferred
310 // size. All remaining space is used for the network name. 309 // size. All remaining space is used for the network name.
311 views::BoxLayout* layout = new views::BoxLayout( 310 views::BoxLayout* layout = new views::BoxLayout(
312 views::BoxLayout::kHorizontal, 0, 3, kTrayPopupPaddingBetweenItems); 311 views::BoxLayout::kHorizontal, 0, 3, kTrayPopupPaddingBetweenItems);
313 SetLayoutManager(layout); 312 SetLayoutManager(layout);
314 layout->SetDefaultFlex(0); 313 layout->SetDefaultFlex(0);
315 layout->SetFlexForView(text_label(), 1); 314 layout->SetFlexForView(text_label(), 1);
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 } 506 }
508 } 507 }
509 508
510 // Add providers without any configured networks, in the order that the 509 // Add providers without any configured networks, in the order that the
511 // providers were returned by the extensions system. 510 // providers were returned by the extensions system.
512 for (const VPNProvider& provider : providers) 511 for (const VPNProvider& provider : providers)
513 AddProviderAndNetworks(provider, networks); 512 AddProviderAndNetworks(provider, networks);
514 } 513 }
515 514
516 } // namespace ash 515 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698