| OLD | NEW |
| 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/common/system/tray/tray_popup_utils.h" | 5 #include "ash/common/system/tray/tray_popup_utils.h" |
| 6 | 6 |
| 7 #include "ash/common/ash_constants.h" | 7 #include "ash/common/ash_constants.h" |
| 8 #include "ash/common/ash_view_ids.h" | 8 #include "ash/common/ash_view_ids.h" |
| 9 #include "ash/common/material_design/material_design_controller.h" | 9 #include "ash/common/material_design/material_design_controller.h" |
| 10 #include "ash/common/session/session_state_delegate.h" | 10 #include "ash/common/session/session_state_delegate.h" |
| 11 #include "ash/common/system/tray/fixed_sized_image_view.h" | 11 #include "ash/common/system/tray/fixed_sized_image_view.h" |
| 12 #include "ash/common/system/tray/size_range_layout.h" | 12 #include "ash/common/system/tray/size_range_layout.h" |
| 13 #include "ash/common/system/tray/tray_constants.h" | 13 #include "ash/common/system/tray/tray_constants.h" |
| 14 #include "ash/common/system/tray/tray_popup_item_style.h" |
| 14 #include "ash/common/system/tray/tray_popup_label_button.h" | 15 #include "ash/common/system/tray/tray_popup_label_button.h" |
| 15 #include "ash/common/system/tray/tray_popup_label_button_border.h" | 16 #include "ash/common/system/tray/tray_popup_label_button_border.h" |
| 16 #include "ash/common/wm_shell.h" | 17 #include "ash/common/wm_shell.h" |
| 17 #include "ui/views/animation/ink_drop_impl.h" | 18 #include "ui/views/animation/ink_drop_impl.h" |
| 18 #include "ui/views/background.h" | 19 #include "ui/views/background.h" |
| 19 #include "ui/views/border.h" | 20 #include "ui/views/border.h" |
| 20 #include "ui/views/controls/button/button.h" | 21 #include "ui/views/controls/button/button.h" |
| 21 #include "ui/views/controls/button/label_button.h" | 22 #include "ui/views/controls/button/label_button.h" |
| 22 #include "ui/views/controls/button/md_text_button.h" | 23 #include "ui/views/controls/button/md_text_button.h" |
| 23 #include "ui/views/controls/image_view.h" | 24 #include "ui/views/controls/image_view.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 class BorderlessLabelButton : public views::LabelButton { | 99 class BorderlessLabelButton : public views::LabelButton { |
| 99 public: | 100 public: |
| 100 BorderlessLabelButton(views::ButtonListener* listener, | 101 BorderlessLabelButton(views::ButtonListener* listener, |
| 101 const base::string16& text) | 102 const base::string16& text) |
| 102 : LabelButton(listener, text) { | 103 : LabelButton(listener, text) { |
| 103 if (MaterialDesignController::IsSystemTrayMenuMaterial()) { | 104 if (MaterialDesignController::IsSystemTrayMenuMaterial()) { |
| 104 SetInkDropMode(views::InkDropHostView::InkDropMode::ON); | 105 SetInkDropMode(views::InkDropHostView::InkDropMode::ON); |
| 105 set_has_ink_drop_action_on_click(true); | 106 set_has_ink_drop_action_on_click(true); |
| 106 set_ink_drop_base_color(kTrayPopupInkDropBaseColor); | 107 set_ink_drop_base_color(kTrayPopupInkDropBaseColor); |
| 107 set_ink_drop_visible_opacity(kTrayPopupInkDropRippleOpacity); | 108 set_ink_drop_visible_opacity(kTrayPopupInkDropRippleOpacity); |
| 108 const int kHorizontalPadding = 20; | 109 const int kHorizontalPadding = 8; |
| 109 SetBorder(views::CreateEmptyBorder(gfx::Insets(0, kHorizontalPadding))); | 110 SetBorder(views::CreateEmptyBorder(gfx::Insets(0, kHorizontalPadding))); |
| 111 TrayPopupItemStyle style(nullptr, TrayPopupItemStyle::FontStyle::BUTTON); |
| 112 style.SetupLabel(label()); |
| 110 // TODO(tdanderson): Update focus rect for material design. See | 113 // TODO(tdanderson): Update focus rect for material design. See |
| 111 // crbug.com/615892 | 114 // crbug.com/615892 |
| 112 } else { | 115 } else { |
| 113 SetBorder(std::unique_ptr<views::Border>(new TrayPopupLabelButtonBorder)); | 116 SetBorder(std::unique_ptr<views::Border>(new TrayPopupLabelButtonBorder)); |
| 114 SetFocusPainter(views::Painter::CreateSolidFocusPainter( | 117 SetFocusPainter(views::Painter::CreateSolidFocusPainter( |
| 115 kFocusBorderColor, gfx::Insets(1, 1, 2, 2))); | 118 kFocusBorderColor, gfx::Insets(1, 1, 2, 2))); |
| 116 set_animate_on_state_change(false); | 119 set_animate_on_state_change(false); |
| 117 } | 120 } |
| 118 SetHorizontalAlignment(gfx::ALIGN_CENTER); | 121 SetHorizontalAlignment(gfx::ALIGN_CENTER); |
| 119 SetFocusForPlatform(); | 122 SetFocusForPlatform(); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 bool TrayPopupUtils::CanOpenWebUISettings(LoginStatus status) { | 267 bool TrayPopupUtils::CanOpenWebUISettings(LoginStatus status) { |
| 265 // TODO(tdanderson): Consider moving this into WmShell, or introduce a | 268 // TODO(tdanderson): Consider moving this into WmShell, or introduce a |
| 266 // CanShowSettings() method in each delegate type that has a | 269 // CanShowSettings() method in each delegate type that has a |
| 267 // ShowSettings() method. | 270 // ShowSettings() method. |
| 268 return status != LoginStatus::NOT_LOGGED_IN && | 271 return status != LoginStatus::NOT_LOGGED_IN && |
| 269 status != LoginStatus::LOCKED && | 272 status != LoginStatus::LOCKED && |
| 270 !WmShell::Get()->GetSessionStateDelegate()->IsInSecondaryLoginScreen(); | 273 !WmShell::Get()->GetSessionStateDelegate()->IsInSecondaryLoginScreen(); |
| 271 } | 274 } |
| 272 | 275 |
| 273 } // namespace ash | 276 } // namespace ash |
| OLD | NEW |