| 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 <algorithm> |
| 8 #include <utility> |
| 9 |
| 7 #include "ash/common/ash_constants.h" | 10 #include "ash/common/ash_constants.h" |
| 8 #include "ash/common/ash_view_ids.h" | 11 #include "ash/common/ash_view_ids.h" |
| 9 #include "ash/common/material_design/material_design_controller.h" | 12 #include "ash/common/material_design/material_design_controller.h" |
| 10 #include "ash/common/session/session_state_delegate.h" | 13 #include "ash/common/session/session_state_delegate.h" |
| 11 #include "ash/common/system/tray/fixed_sized_image_view.h" | 14 #include "ash/common/system/tray/fixed_sized_image_view.h" |
| 12 #include "ash/common/system/tray/size_range_layout.h" | 15 #include "ash/common/system/tray/size_range_layout.h" |
| 13 #include "ash/common/system/tray/tray_constants.h" | 16 #include "ash/common/system/tray/tray_constants.h" |
| 14 #include "ash/common/system/tray/tray_popup_item_style.h" | 17 #include "ash/common/system/tray/tray_popup_item_style.h" |
| 15 #include "ash/common/system/tray/tray_popup_label_button.h" | 18 #include "ash/common/system/tray/tray_popup_label_button.h" |
| 16 #include "ash/common/system/tray/tray_popup_label_button_border.h" | 19 #include "ash/common/system/tray/tray_popup_label_button_border.h" |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 ink_drop->SetShowHighlightOnHover(false); | 349 ink_drop->SetShowHighlightOnHover(false); |
| 347 | 350 |
| 348 return std::move(ink_drop); | 351 return std::move(ink_drop); |
| 349 } | 352 } |
| 350 | 353 |
| 351 std::unique_ptr<views::InkDropRipple> TrayPopupUtils::CreateInkDropRipple( | 354 std::unique_ptr<views::InkDropRipple> TrayPopupUtils::CreateInkDropRipple( |
| 352 TrayPopupInkDropStyle ink_drop_style, | 355 TrayPopupInkDropStyle ink_drop_style, |
| 353 const views::View* host, | 356 const views::View* host, |
| 354 const gfx::Point& center_point, | 357 const gfx::Point& center_point, |
| 355 SkColor color) { | 358 SkColor color) { |
| 356 const gfx::Rect bounds = | 359 return base::MakeUnique<views::FloodFillInkDropRipple>( |
| 357 TrayPopupUtils::GetInkDropBounds(ink_drop_style, host); | 360 host->size(), TrayPopupUtils::GetInkDropInsets(ink_drop_style), |
| 358 switch (ink_drop_style) { | 361 center_point, color, kTrayPopupInkDropRippleOpacity); |
| 359 case TrayPopupInkDropStyle::HOST_CENTERED: | |
| 360 if (MaterialDesignController::GetMode() == | |
| 361 MaterialDesignController::MATERIAL_EXPERIMENTAL) { | |
| 362 return base::MakeUnique<views::SquareInkDropRipple>( | |
| 363 bounds.size(), bounds.size().width() / 2, bounds.size(), | |
| 364 bounds.size().width() / 2, center_point, bounds.CenterPoint(), | |
| 365 color, kTrayPopupInkDropRippleOpacity); | |
| 366 } | |
| 367 // Intentional fall through. | |
| 368 case TrayPopupInkDropStyle::INSET_BOUNDS: | |
| 369 case TrayPopupInkDropStyle::FILL_BOUNDS: { | |
| 370 const gfx::Insets insets = | |
| 371 TrayPopupUtils::GetInkDropInsets(ink_drop_style); | |
| 372 return base::MakeUnique<views::FloodFillInkDropRipple>( | |
| 373 host->size(), insets, center_point, color, | |
| 374 kTrayPopupInkDropRippleOpacity); | |
| 375 } | |
| 376 } | |
| 377 // Required for some compilers. | |
| 378 NOTREACHED(); | |
| 379 return nullptr; | |
| 380 } | 362 } |
| 381 | 363 |
| 382 std::unique_ptr<views::InkDropHighlight> TrayPopupUtils::CreateInkDropHighlight( | 364 std::unique_ptr<views::InkDropHighlight> TrayPopupUtils::CreateInkDropHighlight( |
| 383 TrayPopupInkDropStyle ink_drop_style, | 365 TrayPopupInkDropStyle ink_drop_style, |
| 384 const views::View* host, | 366 const views::View* host, |
| 385 SkColor color) { | 367 SkColor color) { |
| 386 const gfx::Rect bounds = | 368 const gfx::Rect bounds = |
| 387 TrayPopupUtils::GetInkDropBounds(ink_drop_style, host); | 369 TrayPopupUtils::GetInkDropBounds(ink_drop_style, host); |
| 388 std::unique_ptr<views::InkDropHighlight> highlight( | 370 std::unique_ptr<views::InkDropHighlight> highlight( |
| 389 new views::InkDropHighlight(bounds.size(), 0, | 371 new views::InkDropHighlight(bounds.size(), 0, |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 bool TrayPopupUtils::CanOpenWebUISettings(LoginStatus status) { | 451 bool TrayPopupUtils::CanOpenWebUISettings(LoginStatus status) { |
| 470 // TODO(tdanderson): Consider moving this into WmShell, or introduce a | 452 // TODO(tdanderson): Consider moving this into WmShell, or introduce a |
| 471 // CanShowSettings() method in each delegate type that has a | 453 // CanShowSettings() method in each delegate type that has a |
| 472 // ShowSettings() method. | 454 // ShowSettings() method. |
| 473 return status != LoginStatus::NOT_LOGGED_IN && | 455 return status != LoginStatus::NOT_LOGGED_IN && |
| 474 status != LoginStatus::LOCKED && | 456 status != LoginStatus::LOCKED && |
| 475 !WmShell::Get()->GetSessionStateDelegate()->IsInSecondaryLoginScreen(); | 457 !WmShell::Get()->GetSessionStateDelegate()->IsInSecondaryLoginScreen(); |
| 476 } | 458 } |
| 477 | 459 |
| 478 } // namespace ash | 460 } // namespace ash |
| OLD | NEW |