app_list_page.cc 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. // Copyright 2015 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "ash/app_list/views/app_list_page.h"
  5. #include "ash/app_list/views/contents_view.h"
  6. #include "ui/compositor/scoped_layer_animation_settings.h"
  7. #include "ui/views/focus/focus_manager.h"
  8. namespace ash {
  9. AppListPage::AppListPage() : contents_view_(nullptr) {}
  10. AppListPage::~AppListPage() {}
  11. void AppListPage::OnShown() {}
  12. void AppListPage::OnWillBeShown() {}
  13. void AppListPage::OnHidden() {}
  14. void AppListPage::OnWillBeHidden() {}
  15. void AppListPage::OnAnimationUpdated(double progress,
  16. AppListState from_state,
  17. AppListState to_state) {}
  18. gfx::Size AppListPage::GetPreferredSearchBoxSize() const {
  19. return gfx::Size();
  20. }
  21. void AppListPage::UpdatePageBoundsForState(AppListState state,
  22. const gfx::Rect& contents_bounds,
  23. const gfx::Rect& search_box_bounds) {
  24. SetBoundsRect(
  25. GetPageBoundsForState(state, contents_bounds, search_box_bounds));
  26. }
  27. views::View* AppListPage::GetFirstFocusableView() {
  28. return GetFocusManager()->GetNextFocusableView(
  29. this, GetWidget(), false /* reverse */, false /* dont_loop */);
  30. }
  31. views::View* AppListPage::GetLastFocusableView() {
  32. return GetFocusManager()->GetNextFocusableView(
  33. this, GetWidget(), true /* reverse */, false /* dont_loop */);
  34. }
  35. void AppListPage::AnimateOpacity(float current_progress,
  36. AppListViewState target_view_state,
  37. const OpacityAnimator& animator) {
  38. animator.Run(this, target_view_state != AppListViewState::kClosed);
  39. }
  40. void AppListPage::AnimateYPosition(AppListViewState target_view_state,
  41. const TransformAnimator& animator,
  42. float default_offset) {
  43. animator.Run(default_offset, layer());
  44. }
  45. gfx::Rect AppListPage::GetAboveContentsOffscreenBounds(
  46. const gfx::Size& size) const {
  47. gfx::Rect rect(size);
  48. rect.set_y(-rect.height());
  49. return rect;
  50. }
  51. gfx::Rect AppListPage::GetBelowContentsOffscreenBounds(
  52. const gfx::Size& size) const {
  53. DCHECK(contents_view_);
  54. gfx::Rect rect(size);
  55. rect.set_y(contents_view_->GetContentsBounds().height());
  56. return rect;
  57. }
  58. gfx::Rect AppListPage::GetFullContentsBounds() const {
  59. DCHECK(contents_view_);
  60. return contents_view_->GetContentsBounds();
  61. }
  62. gfx::Rect AppListPage::GetDefaultContentsBounds() const {
  63. DCHECK(contents_view_);
  64. return contents_view_->GetContentsBounds();
  65. }
  66. const char* AppListPage::GetClassName() const {
  67. return "AppListPage";
  68. }
  69. } // namespace ash