| 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/material_design/material_design_controller.h" | 9 #include "ash/common/material_design/material_design_controller.h" |
| 9 #include "ash/common/session/session_state_delegate.h" | 10 #include "ash/common/session/session_state_delegate.h" |
| 10 #include "ash/common/system/tray/fixed_sized_image_view.h" | 11 #include "ash/common/system/tray/fixed_sized_image_view.h" |
| 11 #include "ash/common/system/tray/size_range_layout.h" | 12 #include "ash/common/system/tray/size_range_layout.h" |
| 12 #include "ash/common/system/tray/tray_constants.h" | 13 #include "ash/common/system/tray/tray_constants.h" |
| 13 #include "ash/common/system/tray/tray_popup_label_button.h" | 14 #include "ash/common/system/tray/tray_popup_label_button.h" |
| 14 #include "ash/common/system/tray/tray_popup_label_button_border.h" | 15 #include "ash/common/system/tray/tray_popup_label_button_border.h" |
| 15 #include "ash/common/wm_shell.h" | 16 #include "ash/common/wm_shell.h" |
| 16 #include "ui/views/animation/ink_drop_impl.h" | 17 #include "ui/views/animation/ink_drop_impl.h" |
| 18 #include "ui/views/background.h" |
| 17 #include "ui/views/border.h" | 19 #include "ui/views/border.h" |
| 18 #include "ui/views/controls/button/button.h" | 20 #include "ui/views/controls/button/button.h" |
| 19 #include "ui/views/controls/button/label_button.h" | 21 #include "ui/views/controls/button/label_button.h" |
| 20 #include "ui/views/controls/button/md_text_button.h" | 22 #include "ui/views/controls/button/md_text_button.h" |
| 21 #include "ui/views/controls/image_view.h" | 23 #include "ui/views/controls/image_view.h" |
| 22 #include "ui/views/controls/label.h" | 24 #include "ui/views/controls/label.h" |
| 23 #include "ui/views/controls/separator.h" | 25 #include "ui/views/controls/separator.h" |
| 24 #include "ui/views/controls/slider.h" | 26 #include "ui/views/controls/slider.h" |
| 25 #include "ui/views/layout/box_layout.h" | 27 #include "ui/views/layout/box_layout.h" |
| 26 #include "ui/views/layout/fill_layout.h" | 28 #include "ui/views/layout/fill_layout.h" |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 if (is_material) { | 215 if (is_material) { |
| 214 slider->SetBorder( | 216 slider->SetBorder( |
| 215 views::CreateEmptyBorder(gfx::Insets(0, kTrayPopupSliderPaddingMD))); | 217 views::CreateEmptyBorder(gfx::Insets(0, kTrayPopupSliderPaddingMD))); |
| 216 } else { | 218 } else { |
| 217 slider->SetBorder( | 219 slider->SetBorder( |
| 218 views::CreateEmptyBorder(0, 0, 0, kTrayPopupPaddingBetweenItems)); | 220 views::CreateEmptyBorder(0, 0, 0, kTrayPopupPaddingBetweenItems)); |
| 219 } | 221 } |
| 220 return slider; | 222 return slider; |
| 221 } | 223 } |
| 222 | 224 |
| 225 void TrayPopupUtils::ConfigureAsStickyHeader(views::View* view) { |
| 226 view->set_id(VIEW_ID_STICKY_HEADER); |
| 227 view->set_background( |
| 228 views::Background::CreateSolidBackground(kBackgroundColor)); |
| 229 view->SetBorder( |
| 230 views::CreateEmptyBorder(gfx::Insets(kMenuSeparatorVerticalPadding, 0))); |
| 231 } |
| 232 |
| 223 void TrayPopupUtils::ConfigureContainer(TriView::Container container, | 233 void TrayPopupUtils::ConfigureContainer(TriView::Container container, |
| 224 views::View* container_view) { | 234 views::View* container_view) { |
| 225 container_view->SetLayoutManager( | 235 container_view->SetLayoutManager( |
| 226 CreateDefaultLayoutManager(container).release()); | 236 CreateDefaultLayoutManager(container).release()); |
| 227 } | 237 } |
| 228 | 238 |
| 229 views::LabelButton* TrayPopupUtils::CreateTrayPopupBorderlessButton( | 239 views::LabelButton* TrayPopupUtils::CreateTrayPopupBorderlessButton( |
| 230 views::ButtonListener* listener, | 240 views::ButtonListener* listener, |
| 231 const base::string16& text) { | 241 const base::string16& text) { |
| 232 return new BorderlessLabelButton(listener, text); | 242 return new BorderlessLabelButton(listener, text); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 254 bool TrayPopupUtils::CanOpenWebUISettings(LoginStatus status) { | 264 bool TrayPopupUtils::CanOpenWebUISettings(LoginStatus status) { |
| 255 // TODO(tdanderson): Consider moving this into WmShell, or introduce a | 265 // TODO(tdanderson): Consider moving this into WmShell, or introduce a |
| 256 // CanShowSettings() method in each delegate type that has a | 266 // CanShowSettings() method in each delegate type that has a |
| 257 // ShowSettings() method. | 267 // ShowSettings() method. |
| 258 return status != LoginStatus::NOT_LOGGED_IN && | 268 return status != LoginStatus::NOT_LOGGED_IN && |
| 259 status != LoginStatus::LOCKED && | 269 status != LoginStatus::LOCKED && |
| 260 !WmShell::Get()->GetSessionStateDelegate()->IsInSecondaryLoginScreen(); | 270 !WmShell::Get()->GetSessionStateDelegate()->IsInSecondaryLoginScreen(); |
| 261 } | 271 } |
| 262 | 272 |
| 263 } // namespace ash | 273 } // namespace ash |
| OLD | NEW |