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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 return views::Painter::CreateSolidFocusPainter( | 280 return views::Painter::CreateSolidFocusPainter( |
281 kFocusBorderColor, kFocusBorderThickness, gfx::InsetsF()); | 281 kFocusBorderColor, kFocusBorderThickness, gfx::InsetsF()); |
282 } | 282 } |
283 | 283 |
284 void TrayPopupUtils::ConfigureAsStickyHeader(views::View* view) { | 284 void TrayPopupUtils::ConfigureAsStickyHeader(views::View* view) { |
285 view->set_id(VIEW_ID_STICKY_HEADER); | 285 view->set_id(VIEW_ID_STICKY_HEADER); |
286 view->set_background( | 286 view->set_background( |
287 views::Background::CreateSolidBackground(kBackgroundColor)); | 287 views::Background::CreateSolidBackground(kBackgroundColor)); |
288 view->SetBorder( | 288 view->SetBorder( |
289 views::CreateEmptyBorder(gfx::Insets(kMenuSeparatorVerticalPadding, 0))); | 289 views::CreateEmptyBorder(gfx::Insets(kMenuSeparatorVerticalPadding, 0))); |
| 290 view->SetPaintToLayer(true); |
| 291 view->layer()->SetFillsBoundsOpaquely(false); |
| 292 } |
| 293 |
| 294 void TrayPopupUtils::ShowStickyHeaderSeparator(views::View* view, |
| 295 bool show_separator) { |
| 296 if (show_separator) { |
| 297 view->SetBorder(views::CreatePaddedBorder( |
| 298 views::CreateSolidSidedBorder(0, 0, kSeparatorWidth, 0, |
| 299 kHorizontalSeparatorColor), |
| 300 gfx::Insets(kMenuSeparatorVerticalPadding, 0, |
| 301 kMenuSeparatorVerticalPadding - kSeparatorWidth, 0))); |
| 302 } else { |
| 303 view->SetBorder(views::CreateEmptyBorder( |
| 304 gfx::Insets(kMenuSeparatorVerticalPadding, 0))); |
| 305 } |
| 306 view->SchedulePaint(); |
290 } | 307 } |
291 | 308 |
292 void TrayPopupUtils::ConfigureContainer(TriView::Container container, | 309 void TrayPopupUtils::ConfigureContainer(TriView::Container container, |
293 views::View* container_view) { | 310 views::View* container_view) { |
294 container_view->SetLayoutManager( | 311 container_view->SetLayoutManager( |
295 CreateDefaultLayoutManager(container).release()); | 312 CreateDefaultLayoutManager(container).release()); |
296 } | 313 } |
297 | 314 |
298 views::LabelButton* TrayPopupUtils::CreateTrayPopupBorderlessButton( | 315 views::LabelButton* TrayPopupUtils::CreateTrayPopupBorderlessButton( |
299 views::ButtonListener* listener, | 316 views::ButtonListener* listener, |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 bool TrayPopupUtils::CanOpenWebUISettings(LoginStatus status) { | 470 bool TrayPopupUtils::CanOpenWebUISettings(LoginStatus status) { |
454 // TODO(tdanderson): Consider moving this into WmShell, or introduce a | 471 // TODO(tdanderson): Consider moving this into WmShell, or introduce a |
455 // CanShowSettings() method in each delegate type that has a | 472 // CanShowSettings() method in each delegate type that has a |
456 // ShowSettings() method. | 473 // ShowSettings() method. |
457 return status != LoginStatus::NOT_LOGGED_IN && | 474 return status != LoginStatus::NOT_LOGGED_IN && |
458 status != LoginStatus::LOCKED && | 475 status != LoginStatus::LOCKED && |
459 !WmShell::Get()->GetSessionStateDelegate()->IsInSecondaryLoginScreen(); | 476 !WmShell::Get()->GetSessionStateDelegate()->IsInSecondaryLoginScreen(); |
460 } | 477 } |
461 | 478 |
462 } // namespace ash | 479 } // namespace ash |
OLD | NEW |