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

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

Issue 2961923002: Use EnablePlayStoreAppSearch feature flag. (Closed)
Patch Set: Oshima's comment. Created 3 years, 5 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
« no previous file with comments | « ui/app_list/views/search_result_tile_item_view.h ('k') | ui/app_list/views/tile_item_view.h » ('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_tile_item_view.h" 5 #include "ui/app_list/views/search_result_tile_item_view.h"
6 6
7 #include "base/i18n/number_formatting.h" 7 #include "base/i18n/number_formatting.h"
8 #include "ui/app_list/app_list_constants.h" 8 #include "ui/app_list/app_list_constants.h"
9 #include "ui/app_list/app_list_features.h" 9 #include "ui/app_list/app_list_features.h"
10 #include "ui/app_list/app_list_view_delegate.h" 10 #include "ui/app_list/app_list_view_delegate.h"
(...skipping 25 matching lines...) Expand all
36 constexpr SkColor kSearchRatingStarColor = 36 constexpr SkColor kSearchRatingStarColor =
37 SkColorSetARGBMacro(0x8F, 0x00, 0x00, 0x00); 37 SkColorSetARGBMacro(0x8F, 0x00, 0x00, 0x00);
38 38
39 } // namespace 39 } // namespace
40 40
41 SearchResultTileItemView::SearchResultTileItemView( 41 SearchResultTileItemView::SearchResultTileItemView(
42 SearchResultContainerView* result_container, 42 SearchResultContainerView* result_container,
43 AppListViewDelegate* view_delegate) 43 AppListViewDelegate* view_delegate)
44 : result_container_(result_container), 44 : result_container_(result_container),
45 view_delegate_(view_delegate), 45 view_delegate_(view_delegate),
46 is_fullscreen_app_list_enabled_(features::IsFullscreenAppListEnabled()) { 46 is_play_store_app_search_enabled_(
47 features::IsPlayStoreAppSearchEnabled()) {
47 // When |item_| is null, the tile is invisible. Calling SetSearchResult with a 48 // When |item_| is null, the tile is invisible. Calling SetSearchResult with a
48 // non-null item makes the tile visible. 49 // non-null item makes the tile visible.
49 SetVisible(false); 50 SetVisible(false);
50 51
51 if (is_fullscreen_app_list_enabled_) { 52 if (is_play_store_app_search_enabled_) {
52 const gfx::FontList& base_font = 53 const gfx::FontList& base_font =
53 ui::ResourceBundle::GetSharedInstance().GetFontList( 54 ui::ResourceBundle::GetSharedInstance().GetFontList(
54 ui::ResourceBundle::BaseFont); 55 ui::ResourceBundle::BaseFont);
55 56
56 rating_ = new views::Label; 57 rating_ = new views::Label;
57 rating_->SetEnabledColor(kSearchAppRatingColor); 58 rating_->SetEnabledColor(kSearchAppRatingColor);
58 rating_->SetFontList(base_font); 59 rating_->SetFontList(base_font);
59 rating_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 60 rating_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
60 rating_->SetVisible(false); 61 rating_->SetVisible(false);
61 AddChildView(rating_); 62 AddChildView(rating_);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 100
100 if (!item) 101 if (!item)
101 return; 102 return;
102 103
103 item_->AddObserver(this); 104 item_->AddObserver(this);
104 105
105 SetTitle(item_->title()); 106 SetTitle(item_->title());
106 SetRating(item_->rating()); 107 SetRating(item_->rating());
107 SetPrice(item_->formatted_price()); 108 SetPrice(item_->formatted_price());
108 109
109 if (is_fullscreen_app_list_enabled_) { 110 if (is_play_store_app_search_enabled_) {
110 const gfx::FontList& base_font = 111 const gfx::FontList& base_font =
111 ui::ResourceBundle::GetSharedInstance().GetFontList( 112 ui::ResourceBundle::GetSharedInstance().GetFontList(
112 ui::ResourceBundle::BaseFont); 113 ui::ResourceBundle::BaseFont);
113 114
114 if (item_->display_type() == SearchResult::DISPLAY_RECOMMENDATION) { 115 if (item_->display_type() == SearchResult::DISPLAY_RECOMMENDATION) {
115 EnableWhiteSelectedColor(true); 116 EnableWhiteSelectedColor(true);
116 117
117 title()->SetFontList(base_font.DeriveWithSizeDelta(1)); 118 title()->SetFontList(base_font.DeriveWithSizeDelta(1));
118 title()->SetEnabledColor(kGridTitleColorFullscreen); 119 title()->SetEnabledColor(kGridTitleColorFullscreen);
119 } else if (item_->display_type() == SearchResult::DISPLAY_TILE) { 120 } else if (item_->display_type() == SearchResult::DISPLAY_TILE) {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 context_menu_runner_->RunMenuAt(GetWidget(), nullptr, 224 context_menu_runner_->RunMenuAt(GetWidget(), nullptr,
224 gfx::Rect(point, gfx::Size()), 225 gfx::Rect(point, gfx::Size()),
225 views::MENU_ANCHOR_TOPLEFT, source_type); 226 views::MENU_ANCHOR_TOPLEFT, source_type);
226 } 227 }
227 228
228 void SearchResultTileItemView::Layout() { 229 void SearchResultTileItemView::Layout() {
229 gfx::Rect rect(GetContentsBounds()); 230 gfx::Rect rect(GetContentsBounds());
230 if (rect.IsEmpty()) 231 if (rect.IsEmpty())
231 return; 232 return;
232 233
233 if (!is_fullscreen_app_list_enabled_ || !item_) { 234 if (!is_play_store_app_search_enabled_ || !item_) {
234 TileItemView::Layout(); 235 TileItemView::Layout();
235 return; 236 return;
236 } 237 }
237 238
238 if (item_->display_type() == SearchResult::DISPLAY_RECOMMENDATION) { 239 if (item_->display_type() == SearchResult::DISPLAY_RECOMMENDATION) {
239 rect.Inset(0, kGridIconTopPadding, 0, 0); 240 rect.Inset(0, kGridIconTopPadding, 0, 0);
240 icon()->SetBoundsRect(rect); 241 icon()->SetBoundsRect(rect);
241 242
242 rect.Inset(kGridTitleHorizontalPadding, 243 rect.Inset(kGridTitleHorizontalPadding,
243 kGridIconDimension + kGridTitleSpacing, 244 kGridIconDimension + kGridTitleSpacing,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 price_rect.Inset(0, title()->GetPreferredSize().height(), 0, 0); 286 price_rect.Inset(0, title()->GetPreferredSize().height(), 0, 0);
286 price_rect.set_height(price_->GetPreferredSize().height()); 287 price_rect.set_height(price_->GetPreferredSize().height());
287 price_->SetBoundsRect(price_rect); 288 price_->SetBoundsRect(price_rect);
288 } 289 }
289 } else { 290 } else {
290 TileItemView::Layout(); 291 TileItemView::Layout();
291 } 292 }
292 } 293 }
293 294
294 gfx::Size SearchResultTileItemView::CalculatePreferredSize() const { 295 gfx::Size SearchResultTileItemView::CalculatePreferredSize() const {
295 if (is_fullscreen_app_list_enabled_ && item_) { 296 if (is_play_store_app_search_enabled_ && item_) {
296 if (item_->display_type() == SearchResult::DISPLAY_RECOMMENDATION) 297 if (item_->display_type() == SearchResult::DISPLAY_RECOMMENDATION)
297 return gfx::Size(kGridTileWidth, kGridTileHeight); 298 return gfx::Size(kGridTileWidth, kGridTileHeight);
298 if (item_->display_type() == SearchResult::DISPLAY_TILE) 299 if (item_->display_type() == SearchResult::DISPLAY_TILE)
299 return gfx::Size(kSearchTileWidth, kSearchTileHeight); 300 return gfx::Size(kSearchTileWidth, kSearchTileHeight);
300 } 301 }
301 302
302 return TileItemView::CalculatePreferredSize(); 303 return TileItemView::CalculatePreferredSize();
303 } 304 }
304 305
305 } // namespace app_list 306 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/views/search_result_tile_item_view.h ('k') | ui/app_list/views/tile_item_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698