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

Side by Side Diff: ash/system/network/network_list.cc

Issue 2978363002: Revert of Add a row in the network tray to inform users to turn Bluetooth on to enable Tether. (Closed)
Patch Set: Created 3 years, 5 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/system/network/network_list.h ('k') | ash/system/tray/tray_details_view.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 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 #include <utility> 8 #include <utility>
9 9
10 #include "ash/metrics/user_metrics_recorder.h" 10 #include "ash/metrics/user_metrics_recorder.h"
11 #include "ash/public/cpp/config.h" 11 #include "ash/public/cpp/config.h"
12 #include "ash/resources/vector_icons/vector_icons.h" 12 #include "ash/resources/vector_icons/vector_icons.h"
13 #include "ash/shell.h" 13 #include "ash/shell.h"
14 #include "ash/strings/grit/ash_strings.h" 14 #include "ash/strings/grit/ash_strings.h"
15 #include "ash/system/network/network_icon.h" 15 #include "ash/system/network/network_icon.h"
16 #include "ash/system/network/network_icon_animation.h" 16 #include "ash/system/network/network_icon_animation.h"
17 #include "ash/system/network/network_info.h" 17 #include "ash/system/network/network_info.h"
18 #include "ash/system/network/network_state_list_detailed_view.h" 18 #include "ash/system/network/network_state_list_detailed_view.h"
19 #include "ash/system/networking_config_delegate.h" 19 #include "ash/system/networking_config_delegate.h"
20 #include "ash/system/power/power_status.h" 20 #include "ash/system/power/power_status.h"
21 #include "ash/system/tray/hover_highlight_view.h" 21 #include "ash/system/tray/hover_highlight_view.h"
22 #include "ash/system/tray/system_menu_button.h" 22 #include "ash/system/tray/system_menu_button.h"
23 #include "ash/system/tray/system_tray_controller.h" 23 #include "ash/system/tray/system_tray_controller.h"
24 #include "ash/system/tray/system_tray_delegate.h" 24 #include "ash/system/tray/system_tray_delegate.h"
25 #include "ash/system/tray/tray_constants.h" 25 #include "ash/system/tray/tray_constants.h"
26 #include "ash/system/tray/tray_info_label.h"
27 #include "ash/system/tray/tray_popup_item_style.h" 26 #include "ash/system/tray/tray_popup_item_style.h"
28 #include "ash/system/tray/tray_popup_utils.h" 27 #include "ash/system/tray/tray_popup_utils.h"
29 #include "ash/system/tray/tri_view.h" 28 #include "ash/system/tray/tri_view.h"
30 #include "base/i18n/number_formatting.h" 29 #include "base/i18n/number_formatting.h"
31 #include "base/memory/ptr_util.h" 30 #include "base/memory/ptr_util.h"
32 #include "base/strings/string16.h" 31 #include "base/strings/string16.h"
33 #include "base/strings/utf_string_conversions.h" 32 #include "base/strings/utf_string_conversions.h"
34 #include "chromeos/dbus/dbus_thread_manager.h" 33 #include "chromeos/dbus/dbus_thread_manager.h"
35 #include "chromeos/login/login_state.h" 34 #include "chromeos/login/login_state.h"
36 #include "chromeos/network/managed_network_configuration_handler.h" 35 #include "chromeos/network/managed_network_configuration_handler.h"
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 // No re-order and re-layout is necessary if |view| is already at |index|. 623 // No re-order and re-layout is necessary if |view| is already at |index|.
625 if (scroll_content()->child_at(index) == view) 624 if (scroll_content()->child_at(index) == view)
626 return; 625 return;
627 scroll_content()->ReorderChildView(view, index); 626 scroll_content()->ReorderChildView(view, index);
628 } 627 }
629 needs_relayout_ = true; 628 needs_relayout_ = true;
630 } 629 }
631 630
632 void NetworkListView::UpdateInfoLabel(int message_id, 631 void NetworkListView::UpdateInfoLabel(int message_id,
633 int insertion_index, 632 int insertion_index,
634 TrayInfoLabel** info_label_ptr) { 633 InfoLabel** info_label_ptr) {
635 TrayInfoLabel* info_label = *info_label_ptr; 634 InfoLabel* info_label = *info_label_ptr;
636 if (!message_id) { 635 if (!message_id) {
637 if (info_label) { 636 if (info_label) {
638 needs_relayout_ = true; 637 needs_relayout_ = true;
639 delete info_label; 638 delete info_label;
640 *info_label_ptr = nullptr; 639 *info_label_ptr = nullptr;
641 } 640 }
642 return; 641 return;
643 } 642 }
644 if (!info_label) 643 if (!info_label)
645 info_label = new TrayInfoLabel(this /* delegate */, message_id); 644 info_label = new InfoLabel(message_id);
646 else 645 else
647 info_label->Update(message_id); 646 info_label->SetMessage(message_id);
648
649 PlaceViewAtIndex(info_label, insertion_index); 647 PlaceViewAtIndex(info_label, insertion_index);
650 *info_label_ptr = info_label; 648 *info_label_ptr = info_label;
651 } 649 }
652 650
653 void NetworkListView::OnLabelClicked(int message_id) {
654 if (message_id == IDS_ASH_STATUS_TRAY_ENABLE_BLUETOOTH)
655 Shell::Get()->system_tray_controller()->ShowBluetoothSettings();
656 }
657
658 bool NetworkListView::IsLabelClickable(int message_id) const {
659 return message_id == IDS_ASH_STATUS_TRAY_ENABLE_BLUETOOTH;
660 }
661
662 int NetworkListView::UpdateSectionHeaderRow(NetworkTypePattern pattern, 651 int NetworkListView::UpdateSectionHeaderRow(NetworkTypePattern pattern,
663 bool enabled, 652 bool enabled,
664 int child_index, 653 int child_index,
665 SectionHeaderRowView** view, 654 SectionHeaderRowView** view,
666 views::Separator** separator_view) { 655 views::Separator** separator_view) {
667 if (!*view) { 656 if (!*view) {
668 if (pattern.MatchesPattern(NetworkTypePattern::Mobile())) 657 if (pattern.MatchesPattern(NetworkTypePattern::Mobile()))
669 *view = new MobileHeaderRowView(); 658 *view = new MobileHeaderRowView();
670 else if (pattern.Equals(NetworkTypePattern::WiFi())) 659 else if (pattern.Equals(NetworkTypePattern::WiFi()))
671 *view = new WifiHeaderRowView(); 660 *view = new WifiHeaderRowView();
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 TriView::Container::CENTER, views::CreateEmptyBorder(gfx::Insets( 720 TriView::Container::CENTER, views::CreateEmptyBorder(gfx::Insets(
732 0, 0, 0, kTrayPopupLabelRightPadding))); 721 0, 0, 0, kTrayPopupLabelRightPadding)));
733 722
734 // Nothing to the right of the text. 723 // Nothing to the right of the text.
735 connection_warning->SetContainerVisible(TriView::Container::END, false); 724 connection_warning->SetContainerVisible(TriView::Container::END, false);
736 return connection_warning; 725 return connection_warning;
737 } 726 }
738 727
739 } // namespace tray 728 } // namespace tray
740 } // namespace ash 729 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/network/network_list.h ('k') | ash/system/tray/tray_details_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698