| 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" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 tri_view->SetContainerLayout( | 181 tri_view->SetContainerLayout( |
| 182 TriView::Container::CENTER, | 182 TriView::Container::CENTER, |
| 183 CreateDefaultLayoutManager(TriView::Container::CENTER)); | 183 CreateDefaultLayoutManager(TriView::Container::CENTER)); |
| 184 tri_view->SetContainerLayout( | 184 tri_view->SetContainerLayout( |
| 185 TriView::Container::END, | 185 TriView::Container::END, |
| 186 CreateDefaultLayoutManager(TriView::Container::END)); | 186 CreateDefaultLayoutManager(TriView::Container::END)); |
| 187 | 187 |
| 188 return tri_view; | 188 return tri_view; |
| 189 } | 189 } |
| 190 | 190 |
| 191 TriView* TrayPopupUtils::CreateSubHeaderRowView() { |
| 192 TriView* tri_view = CreateMultiTargetRowView(); |
| 193 tri_view->SetInsets( |
| 194 gfx::Insets(0, kTrayPopupPaddingHorizontal, 0, |
| 195 GetTrayConstant(TRAY_POPUP_ITEM_RIGHT_INSET))); |
| 196 tri_view->SetContainerVisible(TriView::Container::START, false); |
| 197 tri_view->SetContainerLayout( |
| 198 TriView::Container::END, |
| 199 CreateDefaultLayoutManager(TriView::Container::END)); |
| 200 return tri_view; |
| 201 } |
| 202 |
| 191 TriView* TrayPopupUtils::CreateMultiTargetRowView() { | 203 TriView* TrayPopupUtils::CreateMultiTargetRowView() { |
| 192 TriView* tri_view = new TriView(0 /* padding_between_items */); | 204 TriView* tri_view = new TriView(0 /* padding_between_items */); |
| 193 | 205 |
| 194 tri_view->SetInsets( | 206 tri_view->SetInsets( |
| 195 gfx::Insets(0, GetTrayConstant(TRAY_POPUP_ITEM_LEFT_INSET), 0, | 207 gfx::Insets(0, GetTrayConstant(TRAY_POPUP_ITEM_LEFT_INSET), 0, |
| 196 GetTrayConstant(TRAY_POPUP_ITEM_RIGHT_INSET))); | 208 GetTrayConstant(TRAY_POPUP_ITEM_RIGHT_INSET))); |
| 197 | 209 |
| 198 ConfigureDefaultSizeAndFlex(tri_view, TriView::Container::START); | 210 ConfigureDefaultSizeAndFlex(tri_view, TriView::Container::START); |
| 199 ConfigureDefaultSizeAndFlex(tri_view, TriView::Container::CENTER); | 211 ConfigureDefaultSizeAndFlex(tri_view, TriView::Container::CENTER); |
| 200 ConfigureDefaultSizeAndFlex(tri_view, TriView::Container::END); | 212 ConfigureDefaultSizeAndFlex(tri_view, TriView::Container::END); |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 separator->SetBorder(views::CreateEmptyBorder( | 432 separator->SetBorder(views::CreateEmptyBorder( |
| 421 kMenuSeparatorVerticalPadding - kSeparatorWidth, | 433 kMenuSeparatorVerticalPadding - kSeparatorWidth, |
| 422 left_inset | 434 left_inset |
| 423 ? kMenuExtraMarginFromLeftEdge + kMenuButtonSize + | 435 ? kMenuExtraMarginFromLeftEdge + kMenuButtonSize + |
| 424 kTrayPopupLabelHorizontalPadding | 436 kTrayPopupLabelHorizontalPadding |
| 425 : 0, | 437 : 0, |
| 426 kMenuSeparatorVerticalPadding, 0)); | 438 kMenuSeparatorVerticalPadding, 0)); |
| 427 return separator; | 439 return separator; |
| 428 } | 440 } |
| 429 | 441 |
| 442 views::Separator* TrayPopupUtils::CreateListSubHeaderSeparator() { |
| 443 views::Separator* separator = |
| 444 new views::Separator(views::Separator::HORIZONTAL); |
| 445 separator->SetColor(kHorizontalSeparatorColor); |
| 446 separator->SetPreferredSize(kSeparatorWidth); |
| 447 separator->SetBorder(views::CreateEmptyBorder( |
| 448 kMenuSeparatorVerticalPadding - kSeparatorWidth, 0, 0, 0)); |
| 449 return separator; |
| 450 } |
| 451 |
| 430 bool TrayPopupUtils::CanOpenWebUISettings(LoginStatus status) { | 452 bool TrayPopupUtils::CanOpenWebUISettings(LoginStatus status) { |
| 431 // TODO(tdanderson): Consider moving this into WmShell, or introduce a | 453 // TODO(tdanderson): Consider moving this into WmShell, or introduce a |
| 432 // CanShowSettings() method in each delegate type that has a | 454 // CanShowSettings() method in each delegate type that has a |
| 433 // ShowSettings() method. | 455 // ShowSettings() method. |
| 434 return status != LoginStatus::NOT_LOGGED_IN && | 456 return status != LoginStatus::NOT_LOGGED_IN && |
| 435 status != LoginStatus::LOCKED && | 457 status != LoginStatus::LOCKED && |
| 436 !WmShell::Get()->GetSessionStateDelegate()->IsInSecondaryLoginScreen(); | 458 !WmShell::Get()->GetSessionStateDelegate()->IsInSecondaryLoginScreen(); |
| 437 } | 459 } |
| 438 | 460 |
| 439 } // namespace ash | 461 } // namespace ash |
| OLD | NEW |