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

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

Issue 2957043002: Add a row in the network tray to inform users to turn Bluetooth on to enable Tether. (Closed)
Patch Set: khorimoto@ comments 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
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"
26 #include "ash/system/tray/tray_popup_item_style.h" 27 #include "ash/system/tray/tray_popup_item_style.h"
27 #include "ash/system/tray/tray_popup_utils.h" 28 #include "ash/system/tray/tray_popup_utils.h"
28 #include "ash/system/tray/tri_view.h" 29 #include "ash/system/tray/tri_view.h"
29 #include "base/i18n/number_formatting.h" 30 #include "base/i18n/number_formatting.h"
30 #include "base/memory/ptr_util.h" 31 #include "base/memory/ptr_util.h"
31 #include "base/strings/string16.h" 32 #include "base/strings/string16.h"
32 #include "base/strings/utf_string_conversions.h" 33 #include "base/strings/utf_string_conversions.h"
33 #include "chromeos/dbus/dbus_thread_manager.h" 34 #include "chromeos/dbus/dbus_thread_manager.h"
34 #include "chromeos/login/login_state.h" 35 #include "chromeos/login/login_state.h"
35 #include "chromeos/network/managed_network_configuration_handler.h" 36 #include "chromeos/network/managed_network_configuration_handler.h"
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 // No re-order and re-layout is necessary if |view| is already at |index|. 624 // No re-order and re-layout is necessary if |view| is already at |index|.
624 if (scroll_content()->child_at(index) == view) 625 if (scroll_content()->child_at(index) == view)
625 return; 626 return;
626 scroll_content()->ReorderChildView(view, index); 627 scroll_content()->ReorderChildView(view, index);
627 } 628 }
628 needs_relayout_ = true; 629 needs_relayout_ = true;
629 } 630 }
630 631
631 void NetworkListView::UpdateInfoLabel(int message_id, 632 void NetworkListView::UpdateInfoLabel(int message_id,
632 int insertion_index, 633 int insertion_index,
633 InfoLabel** info_label_ptr) { 634 TrayInfoLabel** info_label_ptr) {
634 InfoLabel* info_label = *info_label_ptr; 635 TrayInfoLabel* info_label = *info_label_ptr;
635 if (!message_id) { 636 if (!message_id) {
636 if (info_label) { 637 if (info_label) {
637 needs_relayout_ = true; 638 needs_relayout_ = true;
638 delete info_label; 639 delete info_label;
639 *info_label_ptr = nullptr; 640 *info_label_ptr = nullptr;
640 } 641 }
641 return; 642 return;
642 } 643 }
643 if (!info_label) 644 if (!info_label)
644 info_label = new InfoLabel(message_id); 645 info_label = new TrayInfoLabel(this /* delegate */, message_id);
645 else 646 else
646 info_label->SetMessage(message_id); 647 info_label->Update(message_id);
648
647 PlaceViewAtIndex(info_label, insertion_index); 649 PlaceViewAtIndex(info_label, insertion_index);
648 *info_label_ptr = info_label; 650 *info_label_ptr = info_label;
649 } 651 }
650 652
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) {
659 return message_id == IDS_ASH_STATUS_TRAY_ENABLE_BLUETOOTH;
660 }
661
651 int NetworkListView::UpdateSectionHeaderRow(NetworkTypePattern pattern, 662 int NetworkListView::UpdateSectionHeaderRow(NetworkTypePattern pattern,
652 bool enabled, 663 bool enabled,
653 int child_index, 664 int child_index,
654 SectionHeaderRowView** view, 665 SectionHeaderRowView** view,
655 views::Separator** separator_view) { 666 views::Separator** separator_view) {
656 if (!*view) { 667 if (!*view) {
657 if (pattern.MatchesPattern(NetworkTypePattern::Mobile())) 668 if (pattern.MatchesPattern(NetworkTypePattern::Mobile()))
658 *view = new MobileHeaderRowView(); 669 *view = new MobileHeaderRowView();
659 else if (pattern.Equals(NetworkTypePattern::WiFi())) 670 else if (pattern.Equals(NetworkTypePattern::WiFi()))
660 *view = new WifiHeaderRowView(); 671 *view = new WifiHeaderRowView();
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 TriView::Container::CENTER, views::CreateEmptyBorder(gfx::Insets( 731 TriView::Container::CENTER, views::CreateEmptyBorder(gfx::Insets(
721 0, 0, 0, kTrayPopupLabelRightPadding))); 732 0, 0, 0, kTrayPopupLabelRightPadding)));
722 733
723 // Nothing to the right of the text. 734 // Nothing to the right of the text.
724 connection_warning->SetContainerVisible(TriView::Container::END, false); 735 connection_warning->SetContainerVisible(TriView::Container::END, false);
725 return connection_warning; 736 return connection_warning;
726 } 737 }
727 738
728 } // namespace tray 739 } // namespace tray
729 } // namespace ash 740 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698