Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: ui/app_list/views/search_result_page_view.cc

Issue 722563002: Add a card background to the app list search result groups. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tilv
Patch Set: use constants in speech_view.cc Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/app_list/app_list_constants.cc ('k') | ui/app_list/views/search_result_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_view_delegate.h" 8 #include "ui/app_list/app_list_view_delegate.h"
9 #include "ui/app_list/views/app_list_main_view.h" 9 #include "ui/app_list/views/app_list_main_view.h"
10 #include "ui/app_list/views/search_result_list_view.h" 10 #include "ui/app_list/views/search_result_list_view.h"
11 #include "ui/app_list/views/search_result_tile_item_list_view.h" 11 #include "ui/app_list/views/search_result_tile_item_list_view.h"
12 #include "ui/views/background.h"
12 #include "ui/views/layout/box_layout.h" 13 #include "ui/views/layout/box_layout.h"
14 #include "ui/views/layout/fill_layout.h"
15 #include "ui/views/shadow_border.h"
13 16
14 namespace app_list { 17 namespace app_list {
15 18
16 namespace { 19 namespace {
17 20
18 const int kGroupSpacing = 20; 21 const int kGroupSpacing = 20;
22 const int kTopPadding = 5;
23
24 // A container view that ensures the card background and the shadow are painted
25 // in the correct order.
26 class SearchCardView : public views::View {
27 public:
28 SearchCardView(views::View* content_view) {
29 SetBorder(make_scoped_ptr(new views::ShadowBorder(
30 kCardShadowBlur, kCardShadowColor, kCardShadowYOffset, 0)));
31 SetLayoutManager(new views::FillLayout());
32 content_view->set_background(
33 views::Background::CreateSolidBackground(kCardBackgroundColor));
34 AddChildView(content_view);
35 }
36
37 ~SearchCardView() override {}
38
39 void ChildPreferredSizeChanged(views::View* child) override {
40 Layout();
41 PreferredSizeChanged();
42 }
43 };
19 44
20 } // namespace 45 } // namespace
21 46
22 SearchResultPageView::SearchResultPageView(AppListMainView* app_list_main_view, 47 SearchResultPageView::SearchResultPageView(AppListMainView* app_list_main_view,
23 AppListViewDelegate* view_delegate) 48 AppListViewDelegate* view_delegate)
24 : results_view_( 49 : results_view_(
25 new SearchResultListView(app_list_main_view, view_delegate)), 50 new SearchResultListView(app_list_main_view, view_delegate)),
26 tiles_view_(new SearchResultTileItemListView()) { 51 tiles_view_(new SearchResultTileItemListView()) {
27 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 52 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical,
28 kExperimentalWindowPadding, 0, 53 kExperimentalWindowPadding, kTopPadding,
29 kGroupSpacing)); 54 kGroupSpacing));
30 55
31 // The view containing the search results. 56 // The view containing the search results.
32 AddChildView(results_view_); 57 AddChildView(new SearchCardView(results_view_));
33 58
34 // The view containing the start page tiles. 59 // The view containing the start page tiles.
35 AddChildView(tiles_view_); 60 AddChildView(new SearchCardView(tiles_view_));
36 61
37 AppListModel::SearchResults* model = view_delegate->GetModel()->results(); 62 AppListModel::SearchResults* model = view_delegate->GetModel()->results();
38 results_view_->SetResults(model); 63 results_view_->SetResults(model);
39 tiles_view_->SetResults(model); 64 tiles_view_->SetResults(model);
40 } 65 }
41 66
42 SearchResultPageView::~SearchResultPageView() { 67 SearchResultPageView::~SearchResultPageView() {
43 } 68 }
44 69
45 bool SearchResultPageView::OnKeyPressed(const ui::KeyEvent& event) { 70 bool SearchResultPageView::OnKeyPressed(const ui::KeyEvent& event) {
46 return results_view_->OnKeyPressed(event); 71 return results_view_->OnKeyPressed(event);
47 } 72 }
48 73
49 void SearchResultPageView::ChildPreferredSizeChanged(views::View* child) { 74 void SearchResultPageView::ChildPreferredSizeChanged(views::View* child) {
50 Layout(); 75 Layout();
51 } 76 }
52 77
53 } // namespace app_list 78 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/app_list_constants.cc ('k') | ui/app_list/views/search_result_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698