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

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, thanks @tdanderson 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
« no previous file with comments | « no previous file | ash/common/system/chromeos/screen_security/screen_tray_item.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
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()) {
288 disconnect_button_ = TrayPopupUtils::CreateTrayPopupButton( 289 disconnect_button_ = TrayPopupUtils::CreateTrayPopupButton(
289 this, l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_VPN_DISCONNECT)); 290 this, l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_VPN_DISCONNECT));
291 tri_view()->AddView(TriView::Container::END, disconnect_button_);
292 tri_view()->SetContainerVisible(TriView::Container::END, true);
293 tri_view()->SetContainerBorder(
294 TriView::Container::END,
295 views::CreateEmptyBorder(0, 0, 0, kTrayPopupButtonEndMargin));
290 } else { 296 } else {
291 disconnect_button_ = new DisconnectButton(this); 297 disconnect_button_ = new DisconnectButton(this);
298 AddChildView(disconnect_button_);
299 SetBorder(views::CreateEmptyBorder(0, kTrayPopupPaddingHorizontal, 0, 3));
292 } 300 }
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 { 301 } else {
305 SetBorder(views::CreateEmptyBorder(0, kTrayPopupPaddingHorizontal, 0, 0)); 302 if (!UseMd())
303 SetBorder(views::CreateEmptyBorder(0, kTrayPopupPaddingHorizontal, 0, 0));
306 } 304 }
307 305
308 if (!UseMd()) { 306 if (!UseMd()) {
309 // The icon and the disconnect button are always set to their preferred 307 // The icon and the disconnect button are always set to their preferred
310 // size. All remaining space is used for the network name. 308 // size. All remaining space is used for the network name.
311 views::BoxLayout* layout = new views::BoxLayout( 309 views::BoxLayout* layout = new views::BoxLayout(
312 views::BoxLayout::kHorizontal, 0, 3, kTrayPopupPaddingBetweenItems); 310 views::BoxLayout::kHorizontal, 0, 3, kTrayPopupPaddingBetweenItems);
313 SetLayoutManager(layout); 311 SetLayoutManager(layout);
314 layout->SetDefaultFlex(0); 312 layout->SetDefaultFlex(0);
315 layout->SetFlexForView(text_label(), 1); 313 layout->SetFlexForView(text_label(), 1);
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 } 505 }
508 } 506 }
509 507
510 // Add providers without any configured networks, in the order that the 508 // Add providers without any configured networks, in the order that the
511 // providers were returned by the extensions system. 509 // providers were returned by the extensions system.
512 for (const VPNProvider& provider : providers) 510 for (const VPNProvider& provider : providers)
513 AddProviderAndNetworks(provider, networks); 511 AddProviderAndNetworks(provider, networks);
514 } 512 }
515 513
516 } // namespace ash 514 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/common/system/chromeos/screen_security/screen_tray_item.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698