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

Unified Diff: ash/common/system/chromeos/bluetooth/tray_bluetooth.cc

Issue 2429923002: Implement all system menu title row buttons for Ash MD (Closed)
Patch Set: OS_WIN define in tests Created 4 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 side-by-side diff with in-line comments
Download patch
Index: ash/common/system/chromeos/bluetooth/tray_bluetooth.cc
diff --git a/ash/common/system/chromeos/bluetooth/tray_bluetooth.cc b/ash/common/system/chromeos/bluetooth/tray_bluetooth.cc
index e79cf189fd59f9945bf17242d6720e939b1c8a66..95142e322a1a636af92c563d9b44ff19b605097c 100644
--- a/ash/common/system/chromeos/bluetooth/tray_bluetooth.cc
+++ b/ash/common/system/chromeos/bluetooth/tray_bluetooth.cc
@@ -17,6 +17,7 @@
#include "ash/common/system/tray/tray_item_more.h"
#include "ash/common/system/tray/tray_popup_header_button.h"
#include "ash/common/system/tray/tray_popup_item_style.h"
+#include "ash/common/system/tray/tray_utils.h"
#include "ash/common/wm_shell.h"
#include "ash/resources/vector_icons/vector_icons.h"
#include "device/bluetooth/bluetooth_common.h"
@@ -177,7 +178,8 @@ class BluetoothDetailedView : public TrayDetailsView {
throbber_(nullptr),
toggle_bluetooth_(nullptr),
enable_bluetooth_(nullptr),
- toggle_(nullptr) {
+ toggle_(nullptr),
+ settings_(nullptr) {
CreateItems();
}
@@ -368,15 +370,18 @@ class BluetoothDetailedView : public TrayDetailsView {
// Add settings entries.
void AppendSettingsEntries() {
+ // Do not append the bottom button row in material design; this is replaced
+ // by the settings button in the header row.
+ if (MaterialDesignController::IsSystemTrayMenuMaterial())
+ return;
+
if (!WmShell::Get()->system_tray_delegate()->ShouldShowSettings())
return;
// Add bluetooth device requires a browser window, hide it for non logged in
// user.
- if (login_ == LoginStatus::NOT_LOGGED_IN || login_ == LoginStatus::LOCKED ||
- WmShell::Get()->GetSessionStateDelegate()->IsInSecondaryLoginScreen()) {
+ if (!CanOpenWebUISettings(login_))
return;
- }
SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate();
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
@@ -424,13 +429,12 @@ class BluetoothDetailedView : public TrayDetailsView {
// TrayDetailsView:
void HandleViewClicked(views::View* view) override {
- SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate();
if (view == manage_devices_) {
- delegate->ManageBluetoothDevices();
- owner()->system_tray()->CloseSystemBubble();
+ ShowSettings();
return;
}
+ SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate();
if (view == enable_bluetooth_) {
WmShell::Get()->RecordUserMetricsAction(
delegate->GetBluetoothEnabled() ? UMA_STATUS_AREA_BLUETOOTH_DISABLED
@@ -460,6 +464,8 @@ class BluetoothDetailedView : public TrayDetailsView {
if (MaterialDesignController::IsSystemTrayMenuMaterial()) {
if (sender == toggle_)
WmShell::Get()->system_tray_delegate()->ToggleBluetooth();
+ else if (sender == settings_)
+ ShowSettings();
else
NOTREACHED();
return;
@@ -478,6 +484,7 @@ class BluetoothDetailedView : public TrayDetailsView {
if (MaterialDesignController::IsSystemTrayMenuMaterial()) {
toggle_ = title_row()->AddToggleButton(this);
+ settings_ = title_row()->AddSettingsButton(this, login_);
return;
}
@@ -503,9 +510,18 @@ class BluetoothDetailedView : public TrayDetailsView {
title_row()->AddViewToRowNonMd(toggle_bluetooth_, true);
}
+ void ShowSettings() {
+ if (CanOpenWebUISettings(login_)) {
+ WmShell::Get()->system_tray_delegate()->ManageBluetoothDevices();
+ owner()->system_tray()->CloseSystemBubble();
+ }
+ }
+
LoginStatus login_;
std::map<views::View*, std::string> device_map_;
+
+ // Not used in material design.
views::View* manage_devices_;
// Not used in material design.
@@ -523,6 +539,9 @@ class BluetoothDetailedView : public TrayDetailsView {
// The on/off toggle button used in material design.
views::ToggleButton* toggle_;
+ // Only used in material design.
+ views::Button* settings_;
+
DISALLOW_COPY_AND_ASSIGN(BluetoothDetailedView);
};
« no previous file with comments | « ash/common/system/cast/tray_cast.cc ('k') | ash/common/system/chromeos/network/network_state_list_detailed_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698