| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/app_list/views/search_result_page_view.h" | 5 #include "ui/app_list/views/search_result_page_view.h" |
| 6 | 6 |
| 7 #include "ui/app_list/app_list_constants.h" | 7 #include "ui/app_list/app_list_constants.h" |
| 8 #include "ui/app_list/app_list_switches.h" | 8 #include "ui/app_list/app_list_switches.h" |
| 9 #include "ui/app_list/app_list_view_delegate.h" | 9 #include "ui/app_list/app_list_view_delegate.h" |
| 10 #include "ui/app_list/views/app_list_main_view.h" | 10 #include "ui/app_list/views/app_list_main_view.h" |
| 11 #include "ui/app_list/views/search_result_list_view.h" | 11 #include "ui/app_list/views/search_result_list_view.h" |
| 12 #include "ui/app_list/views/search_result_tile_item_list_view.h" | 12 #include "ui/app_list/views/search_result_tile_item_list_view.h" |
| 13 #include "ui/gfx/shadow_value.h" |
| 13 #include "ui/views/background.h" | 14 #include "ui/views/background.h" |
| 14 #include "ui/views/layout/box_layout.h" | 15 #include "ui/views/layout/box_layout.h" |
| 15 #include "ui/views/layout/fill_layout.h" | 16 #include "ui/views/layout/fill_layout.h" |
| 16 #include "ui/views/shadow_border.h" | 17 #include "ui/views/shadow_border.h" |
| 17 | 18 |
| 18 namespace app_list { | 19 namespace app_list { |
| 19 | 20 |
| 20 namespace { | 21 namespace { |
| 21 | 22 |
| 22 const int kGroupSpacing = 20; | 23 const int kGroupSpacing = 20; |
| 23 const int kTopPadding = 5; | 24 const int kTopPadding = 5; |
| 24 | 25 |
| 25 // A container view that ensures the card background and the shadow are painted | 26 // A container view that ensures the card background and the shadow are painted |
| 26 // in the correct order. | 27 // in the correct order. |
| 27 class SearchCardView : public views::View { | 28 class SearchCardView : public views::View { |
| 28 public: | 29 public: |
| 29 explicit SearchCardView(views::View* content_view) { | 30 explicit SearchCardView(views::View* content_view) { |
| 30 SetBorder(make_scoped_ptr(new views::ShadowBorder( | 31 SetBorder(make_scoped_ptr(new views::ShadowBorder( |
| 31 kCardShadowBlur, kCardShadowColor, kCardShadowYOffset, 0))); | 32 gfx::ShadowValue(gfx::Point(0, kCardShadowYOffset), kCardShadowBlur, |
| 33 kCardShadowColor)))); |
| 32 SetLayoutManager(new views::FillLayout()); | 34 SetLayoutManager(new views::FillLayout()); |
| 33 content_view->set_background( | 35 content_view->set_background( |
| 34 views::Background::CreateSolidBackground(kCardBackgroundColor)); | 36 views::Background::CreateSolidBackground(kCardBackgroundColor)); |
| 35 AddChildView(content_view); | 37 AddChildView(content_view); |
| 36 } | 38 } |
| 37 | 39 |
| 38 ~SearchCardView() override {} | 40 ~SearchCardView() override {} |
| 39 | 41 |
| 40 void ChildPreferredSizeChanged(views::View* child) override { | 42 void ChildPreferredSizeChanged(views::View* child) override { |
| 41 Layout(); | 43 Layout(); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 return index >= 0 && index < static_cast<int>(result_container_views_.size()); | 121 return index >= 0 && index < static_cast<int>(result_container_views_.size()); |
| 120 } | 122 } |
| 121 | 123 |
| 122 void SearchResultPageView::ChildPreferredSizeChanged(views::View* child) { | 124 void SearchResultPageView::ChildPreferredSizeChanged(views::View* child) { |
| 123 DCHECK(!result_container_views_.empty()); | 125 DCHECK(!result_container_views_.empty()); |
| 124 Layout(); | 126 Layout(); |
| 125 SetSelectedIndex(0); | 127 SetSelectedIndex(0); |
| 126 } | 128 } |
| 127 | 129 |
| 128 } // namespace app_list | 130 } // namespace app_list |
| OLD | NEW |