| Index: ash/common/system/chromeos/network/network_state_list_detailed_view.cc
|
| diff --git a/ash/common/system/chromeos/network/network_state_list_detailed_view.cc b/ash/common/system/chromeos/network/network_state_list_detailed_view.cc
|
| index aaf2c07d1103bb3a2b576e201aba38002dbf929f..287d1ba422dbbf128695993c628d0a581ed6a262 100644
|
| --- a/ash/common/system/chromeos/network/network_state_list_detailed_view.cc
|
| +++ b/ash/common/system/chromeos/network/network_state_list_detailed_view.cc
|
| @@ -15,6 +15,7 @@
|
| #include "ash/common/system/tray/fixed_sized_image_view.h"
|
| #include "ash/common/system/tray/fixed_sized_scroll_view.h"
|
| #include "ash/common/system/tray/hover_highlight_view.h"
|
| +#include "ash/common/system/tray/system_menu_button.h"
|
| #include "ash/common/system/tray/system_tray.h"
|
| #include "ash/common/system/tray/system_tray_controller.h"
|
| #include "ash/common/system/tray/system_tray_delegate.h"
|
| @@ -319,6 +320,9 @@ NetworkStateListDetailedView::NetworkStateListDetailedView(
|
| other_mobile_(nullptr),
|
| settings_(nullptr),
|
| proxy_settings_(nullptr),
|
| + info_button_md_(nullptr),
|
| + settings_button_md_(nullptr),
|
| + proxy_settings_button_md_(nullptr),
|
| info_bubble_(nullptr),
|
| scanning_throbber_(nullptr) {
|
| if (list_type == LIST_TYPE_VPN) {
|
| @@ -360,6 +364,9 @@ void NetworkStateListDetailedView::Init() {
|
| other_mobile_ = nullptr;
|
| settings_ = nullptr;
|
| proxy_settings_ = nullptr;
|
| + info_button_md_ = nullptr;
|
| + settings_button_md_ = nullptr;
|
| + proxy_settings_button_md_ = nullptr;
|
| scanning_throbber_ = nullptr;
|
|
|
| CreateScrollableList();
|
| @@ -381,8 +388,20 @@ NetworkStateListDetailedView::GetViewType() const {
|
|
|
| void NetworkStateListDetailedView::HandleButtonPressed(views::Button* sender,
|
| const ui::Event& event) {
|
| - if (MaterialDesignController::IsSystemTrayMenuMaterial())
|
| + if (MaterialDesignController::IsSystemTrayMenuMaterial()) {
|
| + if (sender == info_button_md_) {
|
| + ToggleInfoBubble();
|
| + return;
|
| + } else if (sender == settings_button_md_) {
|
| + ShowSettings();
|
| + } else if (sender == proxy_settings_button_md_) {
|
| + WmShell::Get()->system_tray_controller()->ShowProxySettings();
|
| + }
|
| +
|
| + if (owner()->system_tray())
|
| + owner()->system_tray()->CloseSystemBubble();
|
| return;
|
| + }
|
|
|
| if (sender == info_icon_) {
|
| ToggleInfoBubble();
|
| @@ -454,8 +473,35 @@ void NetworkStateListDetailedView::HandleViewClicked(views::View* view) {
|
| }
|
|
|
| void NetworkStateListDetailedView::CreateExtraTitleRowButtons() {
|
| - if (MaterialDesignController::IsSystemTrayMenuMaterial())
|
| + if (MaterialDesignController::IsSystemTrayMenuMaterial()) {
|
| + if (login_ == LoginStatus::LOCKED)
|
| + return;
|
| +
|
| + info_button_md_ = new SystemMenuButton(this, kSystemMenuInfoIcon,
|
| + IDS_ASH_STATUS_TRAY_NETWORK_INFO);
|
| + title_row()->AddViewToTitleRow(info_button_md_);
|
| +
|
| + if (login_ != LoginStatus::NOT_LOGGED_IN) {
|
| + settings_button_md_ = new SystemMenuButton(
|
| + this, kSystemMenuSettingsIcon, IDS_ASH_STATUS_TRAY_NETWORK_SETTINGS);
|
| +
|
| + // Allow the user to access settings only if user is logged in
|
| + // and showing settings is allowed. There are situations (supervised user
|
| + // creation flow) when session is started but UI flow continues within
|
| + // login UI, i.e., no browser window is yet avaialable.
|
| + if (!WmShell::Get()->system_tray_delegate()->ShouldShowSettings())
|
| + settings_button_md_->SetState(views::Button::STATE_DISABLED);
|
| +
|
| + title_row()->AddViewToTitleRow(settings_button_md_);
|
| + } else {
|
| + proxy_settings_button_md_ =
|
| + new SystemMenuButton(this, kSystemMenuSettingsIcon,
|
| + IDS_ASH_STATUS_TRAY_NETWORK_PROXY_SETTINGS);
|
| + title_row()->AddViewToTitleRow(proxy_settings_button_md_);
|
| + }
|
| +
|
| return;
|
| + }
|
|
|
| if (list_type_ != LIST_TYPE_VPN) {
|
| NetworkStateHandler* network_state_handler =
|
| @@ -763,7 +809,10 @@ void NetworkStateListDetailedView::ToggleInfoBubble() {
|
| if (ResetInfoBubble())
|
| return;
|
|
|
| - info_bubble_ = new InfoBubble(info_icon_, CreateNetworkInfoView(), this);
|
| + info_bubble_ = new InfoBubble(
|
| + MaterialDesignController::IsSystemTrayMenuMaterial() ? info_button_md_
|
| + : info_icon_,
|
| + CreateNetworkInfoView(), this);
|
| views::BubbleDialogDelegateView::CreateBubble(info_bubble_)->Show();
|
| info_bubble_->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, false);
|
| }
|
|
|