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

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

Issue 2949733002: Show Play Store rating and price in app list (Closed)
Patch Set: Apply fix to patch set 5 Created 3 years, 6 months 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
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_tile_item_list_view.h" 5 #include "ui/app_list/views/search_result_tile_item_list_view.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "ui/app_list/app_list_constants.h" 10 #include "ui/app_list/app_list_constants.h"
11 #include "ui/app_list/app_list_features.h"
11 #include "ui/app_list/app_list_view_delegate.h" 12 #include "ui/app_list/app_list_view_delegate.h"
12 #include "ui/app_list/search_result.h" 13 #include "ui/app_list/search_result.h"
13 #include "ui/app_list/views/search_result_tile_item_view.h" 14 #include "ui/app_list/views/search_result_tile_item_view.h"
14 #include "ui/gfx/geometry/insets.h" 15 #include "ui/gfx/geometry/insets.h"
15 #include "ui/views/background.h" 16 #include "ui/views/background.h"
16 #include "ui/views/border.h" 17 #include "ui/views/border.h"
17 #include "ui/views/controls/textfield/textfield.h" 18 #include "ui/views/controls/textfield/textfield.h"
18 #include "ui/views/layout/box_layout.h" 19 #include "ui/views/layout/box_layout.h"
19 20
20 namespace { 21 namespace {
21 22
22 // Layout constants. 23 // Layout constants.
23 const size_t kNumSearchResultTiles = 8; 24 constexpr size_t kNumSearchResultTiles = 8;
24 const int kHorizontalBorderSpacing = 1; 25 constexpr int kHorizontalBorderSpacing = 1;
25 const int kBetweenTileSpacing = 2; 26 constexpr int kBetweenTileSpacing = 2;
26 const int kTopBottomPadding = 8; 27 constexpr int kTopBottomPadding = 8;
28
29 // Layout constants used when fullscreen app list feature is enabled.
30 constexpr int kItemListVerticalSpacing = 16;
31 constexpr int kItemListHorizontalSpacing = 12;
32 constexpr int kBetweenItemSpacing = 8;
27 33
28 } // namespace 34 } // namespace
29 35
30 namespace app_list { 36 namespace app_list {
31 37
32 SearchResultTileItemListView::SearchResultTileItemListView( 38 SearchResultTileItemListView::SearchResultTileItemListView(
33 views::Textfield* search_box, 39 views::Textfield* search_box,
34 AppListViewDelegate* view_delegate) 40 AppListViewDelegate* view_delegate)
35 : search_box_(search_box) { 41 : search_box_(search_box),
36 SetLayoutManager(new views::BoxLayout( 42 is_fullscreen_app_list_enabled_(features::IsFullscreenAppListEnabled()) {
37 views::BoxLayout::kHorizontal, gfx::Insets(0, kHorizontalBorderSpacing), 43 if (is_fullscreen_app_list_enabled_) {
38 kBetweenTileSpacing)); 44 SetLayoutManager(new views::BoxLayout(
45 views::BoxLayout::kHorizontal,
46 gfx::Insets(kItemListVerticalSpacing, kItemListHorizontalSpacing),
47 kBetweenItemSpacing));
48 } else {
49 SetLayoutManager(new views::BoxLayout(
50 views::BoxLayout::kHorizontal, gfx::Insets(0, kHorizontalBorderSpacing),
51 kBetweenTileSpacing));
52 }
39 53
40 for (size_t i = 0; i < kNumSearchResultTiles; ++i) { 54 for (size_t i = 0; i < kNumSearchResultTiles; ++i) {
41 SearchResultTileItemView* tile_item = 55 SearchResultTileItemView* tile_item =
42 new SearchResultTileItemView(this, view_delegate); 56 new SearchResultTileItemView(this, view_delegate);
43 tile_item->SetParentBackgroundColor(kCardBackgroundColor); 57 tile_item->SetParentBackgroundColor(kCardBackgroundColor);
44 tile_item->SetBorder( 58 if (!is_fullscreen_app_list_enabled_) {
45 views::CreateEmptyBorder(kTopBottomPadding, 0, kTopBottomPadding, 0)); 59 tile_item->SetBorder(
60 views::CreateEmptyBorder(kTopBottomPadding, 0, kTopBottomPadding, 0));
61 }
46 tile_views_.push_back(tile_item); 62 tile_views_.push_back(tile_item);
47 AddChildView(tile_item); 63 AddChildView(tile_item);
48 } 64 }
49 } 65 }
50 66
51 SearchResultTileItemListView::~SearchResultTileItemListView() { 67 SearchResultTileItemListView::~SearchResultTileItemListView() {
52 } 68 }
53 69
54 void SearchResultTileItemListView::OnContainerSelected( 70 void SearchResultTileItemListView::OnContainerSelected(
55 bool from_bottom, 71 bool from_bottom,
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 int selection_index = selected_index() + dir; 155 int selection_index = selected_index() + dir;
140 if (IsValidSelectionIndex(selection_index)) { 156 if (IsValidSelectionIndex(selection_index)) {
141 SetSelectedIndex(selection_index); 157 SetSelectedIndex(selection_index);
142 return true; 158 return true;
143 } 159 }
144 160
145 return false; 161 return false;
146 } 162 }
147 163
148 } // namespace app_list 164 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/views/search_result_tile_item_list_view.h ('k') | ui/app_list/views/search_result_tile_item_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698