Index: ash/system/tray/tray_details_view.cc |
diff --git a/ash/system/tray/tray_details_view.cc b/ash/system/tray/tray_details_view.cc |
index f4507f0779185c5f8924c021d5a87d7975fa7729..116658ca7f05176f018bbd3c6cabb9a89a0c93c1 100644 |
--- a/ash/system/tray/tray_details_view.cc |
+++ b/ash/system/tray/tray_details_view.cc |
@@ -5,10 +5,12 @@ |
#include "ash/system/tray/tray_details_view.h" |
#include "ash/ash_view_ids.h" |
+#include "ash/shell.h" |
#include "ash/strings/grit/ash_strings.h" |
#include "ash/system/tray/hover_highlight_view.h" |
#include "ash/system/tray/system_menu_button.h" |
#include "ash/system/tray/system_tray.h" |
+#include "ash/system/tray/system_tray_controller.h" |
#include "ash/system/tray/system_tray_item.h" |
#include "ash/system/tray/tray_constants.h" |
#include "ash/system/tray/tray_popup_item_style.h" |
@@ -240,13 +242,16 @@ const int kTitleRowPaddingBottom = |
//////////////////////////////////////////////////////////////////////////////// |
// TrayDetailsView::InfoLabel: |
-TrayDetailsView::InfoLabel::InfoLabel(int message_id) |
- : label_(TrayPopupUtils::CreateDefaultLabel()) { |
+TrayDetailsView::InfoLabel::InfoLabel(int message_id) { |
Kyle Horimoto
2017/07/07 17:33:59
Nothing is actually done with |message_id|.
lesliewatkins
2017/07/09 00:57:47
Acknowledged.
|
SetLayoutManager(new views::FillLayout); |
+} |
- TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::SYSTEM_INFO); |
- style.SetupLabel(label_); |
+//////////////////////////////////////////////////////////////////////////////// |
+// TrayDetailsView::InfoLabelNoAction: |
+TrayDetailsView::InfoLabelNoAction::InfoLabelNoAction(int message_id) |
+ : TrayDetailsView::InfoLabel(message_id), |
+ label_(TrayPopupUtils::CreateDefaultLabel()) { |
TriView* tri_view = TrayPopupUtils::CreateMultiTargetRowView(); |
tri_view->SetInsets(gfx::Insets(0, |
kMenuExtraMarginFromLeftEdge + |
@@ -256,20 +261,71 @@ TrayDetailsView::InfoLabel::InfoLabel(int message_id) |
tri_view->SetContainerVisible(TriView::Container::START, false); |
tri_view->SetContainerVisible(TriView::Container::END, false); |
tri_view->AddView(TriView::Container::CENTER, label_); |
+ |
AddChildView(tri_view); |
+ TrayPopupItemStyle::FontStyle font_style = |
+ TrayPopupItemStyle::FontStyle::SYSTEM_INFO; |
+ |
+ TrayPopupItemStyle style(font_style); |
+ style.SetupLabel(label_); |
+ |
SetMessage(message_id); |
} |
-TrayDetailsView::InfoLabel::~InfoLabel() {} |
- |
-void TrayDetailsView::InfoLabel::SetMessage(int message_id) { |
+void TrayDetailsView::InfoLabelNoAction::SetMessage(int message_id) { |
label_->SetText(l10n_util::GetStringUTF16(message_id)); |
} |
+//////////////////////////////////////////////////////////////////////////////// |
+// TrayDetailsView::BluetoothInfoLabel: |
+ |
+TrayDetailsView::InfoLabelEnableBluetooth::InfoLabelEnableBluetooth( |
+ int message_id) |
+ : TrayDetailsView::InfoLabel(message_id), |
+ label_button_( |
+ new views::LabelButton(this, l10n_util::GetStringUTF16(message_id))) { |
+ TriView* tri_view = TrayPopupUtils::CreateMultiTargetRowView(); |
Kyle Horimoto
2017/07/07 17:33:59
AFAICT, this is the same code as in the label clas
|
+ tri_view->SetInsets(gfx::Insets(0, |
+ kMenuExtraMarginFromLeftEdge + |
+ kTrayPopupPaddingHorizontal - |
+ kTrayPopupLabelHorizontalPadding, |
+ 0, kTrayPopupPaddingHorizontal)); |
+ tri_view->SetContainerVisible(TriView::Container::START, false); |
+ tri_view->SetContainerVisible(TriView::Container::END, false); |
+ tri_view->AddView(TriView::Container::CENTER, label_button_); |
+ |
+ AddChildView(tri_view); |
+ |
+ label_button_->SetEnabledTextColors( |
+ label_button_->GetNativeTheme()->GetSystemColor( |
+ ui::NativeTheme::kColorId_ProminentButtonColor)); |
+ label_button_->SetInkDropMode(views::InkDropHostView::InkDropMode::ON); |
+ label_button_->set_ink_drop_base_color(kTrayPopupInkDropBaseColor); |
+ |
+ SetMessage(message_id); |
+} |
+ |
+void TrayDetailsView::InfoLabelEnableBluetooth::SetMessage(int message_id) { |
+ label_button_->SetText(l10n_util::GetStringUTF16(message_id)); |
+} |
+ |
+void TrayDetailsView::InfoLabelEnableBluetooth::ButtonPressed( |
+ views::Button* button, |
+ const ui::Event& event) { |
+ Shell::Get()->system_tray_controller()->ShowBluetoothSettings(); |
+} |
+ |
//////////////////////////////////////////////////////////////////////////////// |
// TrayDetailsView: |
+TrayDetailsView::InfoLabel* TrayDetailsView::CreateInfoLabel(int message_id) { |
+ if (message_id == IDS_ASH_STATUS_TRAY_ENABLE_BLUETOOTH) |
+ return new InfoLabelEnableBluetooth(message_id); |
+ |
+ return new InfoLabelNoAction(message_id); |
+} |
+ |
TrayDetailsView::TrayDetailsView(SystemTrayItem* owner) |
: owner_(owner), |
box_layout_(new views::BoxLayout(views::BoxLayout::kVertical)), |