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

Side by Side Diff: ash/system/chromeos/network/network_state_list_detailed_view.cc

Issue 1417853002: Add IPv6 Address to status tray (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months 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 | « ash/ash_chromeos_strings.grdp ('k') | chromeos/network/device_state.h » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/system/chromeos/network/network_state_list_detailed_view.h" 5 #include "ash/system/chromeos/network/network_state_list_detailed_view.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/metrics/user_metrics_recorder.h" 10 #include "ash/metrics/user_metrics_recorder.h"
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 } 637 }
638 638
639 void NetworkStateListDetailedView::OnInfoBubbleDestroyed() { 639 void NetworkStateListDetailedView::OnInfoBubbleDestroyed() {
640 info_bubble_ = nullptr; 640 info_bubble_ = nullptr;
641 } 641 }
642 642
643 views::View* NetworkStateListDetailedView::CreateNetworkInfoView() { 643 views::View* NetworkStateListDetailedView::CreateNetworkInfoView() {
644 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 644 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
645 NetworkStateHandler* handler = NetworkHandler::Get()->network_state_handler(); 645 NetworkStateHandler* handler = NetworkHandler::Get()->network_state_handler();
646 646
647 std::string ip_address("0.0.0.0"); 647 std::string ip_address, ipv6_address;
648 const NetworkState* network = handler->DefaultNetwork(); 648 const NetworkState* network = handler->DefaultNetwork();
649 if (network) 649 if (network) {
650 ip_address = network->ip_address(); 650 const DeviceState* device = handler->GetDeviceState(network->device_path());
651 if (device) {
652 ip_address = device->GetIpAddressByType(shill::kTypeIPv4);
653 ipv6_address = device->GetIpAddressByType(shill::kTypeIPv6);
654 }
655 }
651 656
652 views::View* container = new views::View; 657 views::View* container = new views::View;
653 container->SetLayoutManager( 658 container->SetLayoutManager(
654 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 1)); 659 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 1));
655 container->SetBorder(views::Border::CreateEmptyBorder(0, 5, 0, 5)); 660 container->SetBorder(views::Border::CreateEmptyBorder(0, 5, 0, 5));
656 661
657 std::string ethernet_address, wifi_address, vpn_address; 662 std::string ethernet_address, wifi_address, vpn_address;
658 if (list_type_ != LIST_TYPE_VPN) { 663 if (list_type_ != LIST_TYPE_VPN) {
659 ethernet_address = handler->FormattedHardwareAddressForType( 664 ethernet_address = handler->FormattedHardwareAddressForType(
660 NetworkTypePattern::Ethernet()); 665 NetworkTypePattern::Ethernet());
661 wifi_address = 666 wifi_address =
662 handler->FormattedHardwareAddressForType(NetworkTypePattern::WiFi()); 667 handler->FormattedHardwareAddressForType(NetworkTypePattern::WiFi());
663 } else { 668 } else {
664 vpn_address = 669 vpn_address =
665 handler->FormattedHardwareAddressForType(NetworkTypePattern::VPN()); 670 handler->FormattedHardwareAddressForType(NetworkTypePattern::VPN());
666 } 671 }
667 672
668 if (!ip_address.empty()) { 673 if (!ip_address.empty()) {
669 container->AddChildView(CreateInfoBubbleLine( 674 container->AddChildView(CreateInfoBubbleLine(
670 bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_IP), ip_address)); 675 bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_IP), ip_address));
671 } 676 }
677 if (!ipv6_address.empty()) {
678 container->AddChildView(CreateInfoBubbleLine(
679 bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_IPV6), ipv6_address));
680 }
672 if (!ethernet_address.empty()) { 681 if (!ethernet_address.empty()) {
673 container->AddChildView(CreateInfoBubbleLine( 682 container->AddChildView(CreateInfoBubbleLine(
674 bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_ETHERNET), 683 bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_ETHERNET),
675 ethernet_address)); 684 ethernet_address));
676 } 685 }
677 if (!wifi_address.empty()) { 686 if (!wifi_address.empty()) {
678 container->AddChildView(CreateInfoBubbleLine( 687 container->AddChildView(CreateInfoBubbleLine(
679 bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_WIFI), wifi_address)); 688 bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_WIFI), wifi_address));
680 } 689 }
681 if (!vpn_address.empty()) { 690 if (!vpn_address.empty()) {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 label->SetEnabledColor(SkColorSetARGB(192, 0, 0, 0)); 798 label->SetEnabledColor(SkColorSetARGB(192, 0, 0, 0));
790 return label; 799 return label;
791 } 800 }
792 801
793 void NetworkStateListDetailedView::RelayoutScrollList() { 802 void NetworkStateListDetailedView::RelayoutScrollList() {
794 scroller()->Layout(); 803 scroller()->Layout();
795 } 804 }
796 805
797 } // namespace tray 806 } // namespace tray
798 } // namespace ash 807 } // namespace ash
OLDNEW
« no previous file with comments | « ash/ash_chromeos_strings.grdp ('k') | chromeos/network/device_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698