OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/network/network_list.h" | 5 #include "ash/system/network/network_list.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/shell_port.h" | 10 #include "ash/shell_port.h" |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 HoverHighlightView* container = new HoverHighlightView(detailed_view()); | 623 HoverHighlightView* container = new HoverHighlightView(detailed_view()); |
624 if (info.connected) | 624 if (info.connected) |
625 SetupConnectedItem(container, info.label, info.image); | 625 SetupConnectedItem(container, info.label, info.image); |
626 else if (info.connecting) | 626 else if (info.connecting) |
627 SetupConnectingItem(container, info.label, info.image); | 627 SetupConnectingItem(container, info.label, info.image); |
628 else | 628 else |
629 container->AddIconAndLabel(info.image, info.label); | 629 container->AddIconAndLabel(info.image, info.label); |
630 container->SetTooltipText(info.tooltip); | 630 container->SetTooltipText(info.tooltip); |
631 views::View* controlled_icon = CreateControlledByExtensionView(info); | 631 views::View* controlled_icon = CreateControlledByExtensionView(info); |
632 if (controlled_icon) | 632 if (controlled_icon) |
633 container->AddChildView(controlled_icon); | 633 container->AddRightView(controlled_icon); |
634 return container; | 634 return container; |
635 } | 635 } |
636 | 636 |
637 void NetworkListView::UpdateViewForNetwork(HoverHighlightView* view, | 637 void NetworkListView::UpdateViewForNetwork(HoverHighlightView* view, |
638 const NetworkInfo& info) { | 638 const NetworkInfo& info) { |
639 DCHECK(!view->has_children()); | 639 DCHECK(!view->has_children()); |
640 if (info.connected) | 640 if (info.connected) |
641 SetupConnectedItem(view, info.label, info.image); | 641 SetupConnectedItem(view, info.label, info.image); |
642 else if (info.connecting) | 642 else if (info.connecting) |
643 SetupConnectingItem(view, info.label, info.image); | 643 SetupConnectingItem(view, info.label, info.image); |
(...skipping 10 matching lines...) Expand all Loading... |
654 NetworkingConfigDelegate* networking_config_delegate = | 654 NetworkingConfigDelegate* networking_config_delegate = |
655 Shell::Get()->system_tray_delegate()->GetNetworkingConfigDelegate(); | 655 Shell::Get()->system_tray_delegate()->GetNetworkingConfigDelegate(); |
656 if (!networking_config_delegate) | 656 if (!networking_config_delegate) |
657 return nullptr; | 657 return nullptr; |
658 std::unique_ptr<const NetworkingConfigDelegate::ExtensionInfo> | 658 std::unique_ptr<const NetworkingConfigDelegate::ExtensionInfo> |
659 extension_info = | 659 extension_info = |
660 networking_config_delegate->LookUpExtensionForNetwork(info.guid); | 660 networking_config_delegate->LookUpExtensionForNetwork(info.guid); |
661 if (!extension_info) | 661 if (!extension_info) |
662 return nullptr; | 662 return nullptr; |
663 | 663 |
664 // Get the tooltip text. | 664 views::ImageView* controlled_icon = TrayPopupUtils::CreateMainImageView(); |
665 base::string16 tooltip_text = l10n_util::GetStringFUTF16( | |
666 IDS_ASH_STATUS_TRAY_EXTENSION_CONTROLLED_WIFI, | |
667 base::UTF8ToUTF16(extension_info->extension_name)); | |
668 | |
669 views::ImageView* controlled_icon = | |
670 new FixedSizedImageView(kTrayPopupDetailsIconWidth, 0); | |
671 | |
672 controlled_icon->SetImage( | 665 controlled_icon->SetImage( |
673 gfx::CreateVectorIcon(kCaptivePortalIcon, kMenuIconColor)); | 666 gfx::CreateVectorIcon(kCaptivePortalIcon, kMenuIconColor)); |
674 controlled_icon->SetTooltipText(tooltip_text); | 667 controlled_icon->SetTooltipText(l10n_util::GetStringFUTF16( |
| 668 IDS_ASH_STATUS_TRAY_EXTENSION_CONTROLLED_WIFI, |
| 669 base::UTF8ToUTF16(extension_info->extension_name))); |
675 return controlled_icon; | 670 return controlled_icon; |
676 } | 671 } |
677 | 672 |
678 std::unique_ptr<std::set<std::string>> NetworkListView::UpdateNetworkChildren( | 673 std::unique_ptr<std::set<std::string>> NetworkListView::UpdateNetworkChildren( |
679 NetworkInfo::Type type, | 674 NetworkInfo::Type type, |
680 int index) { | 675 int index) { |
681 std::unique_ptr<std::set<std::string>> new_guids(new std::set<std::string>); | 676 std::unique_ptr<std::set<std::string>> new_guids(new std::set<std::string>); |
682 for (const auto& info : network_list_) { | 677 for (const auto& info : network_list_) { |
683 if (info->type != type) | 678 if (info->type != type) |
684 continue; | 679 continue; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::DETAILED_VIEW_LABEL); | 816 TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::DETAILED_VIEW_LABEL); |
822 style.SetupLabel(label); | 817 style.SetupLabel(label); |
823 connection_warning->AddView(TriView::Container::CENTER, label); | 818 connection_warning->AddView(TriView::Container::CENTER, label); |
824 | 819 |
825 // Nothing to the right of the text. | 820 // Nothing to the right of the text. |
826 connection_warning->SetContainerVisible(TriView::Container::END, false); | 821 connection_warning->SetContainerVisible(TriView::Container::END, false); |
827 return connection_warning; | 822 return connection_warning; |
828 } | 823 } |
829 | 824 |
830 } // namespace ash | 825 } // namespace ash |
OLD | NEW |