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

Side by Side Diff: athena/home/athena_start_page_view.cc

Issue 583503003: Simply remove dummy app icons from the home card. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « athena/extensions/extension_app_model_builder.cc ('k') | no next file » | 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 "athena/home/athena_start_page_view.h" 5 #include "athena/home/athena_start_page_view.h"
6 6
7 #include "athena/home/home_card_constants.h" 7 #include "athena/home/home_card_constants.h"
8 #include "athena/system/public/system_ui.h" 8 #include "athena/system/public/system_ui.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 29 matching lines...) Expand all
40 const int kWebViewWidth = 500; 40 const int kWebViewWidth = 500;
41 const int kWebViewHeight = 105; 41 const int kWebViewHeight = 105;
42 const int kSearchBoxBorderWidth = 1; 42 const int kSearchBoxBorderWidth = 1;
43 const int kSearchBoxCornerRadius = 2; 43 const int kSearchBoxCornerRadius = 2;
44 44
45 // Taken from the mock. The width is not specified by pixel but the search box 45 // Taken from the mock. The width is not specified by pixel but the search box
46 // covers 6 icons with margin. 46 // covers 6 icons with margin.
47 const int kSearchBoxWidth = kIconSize * 6 + kIconMargin * 7; 47 const int kSearchBoxWidth = kIconSize * 6 + kIconMargin * 7;
48 const int kSearchBoxHeight = 40; 48 const int kSearchBoxHeight = 40;
49 49
50 gfx::Size GetIconContainerSize() {
51 return gfx::Size(kIconSize * kMaxIconNum + kIconMargin * (kMaxIconNum - 1),
52 kIconSize);
53 }
54
50 class PlaceHolderButton : public views::ImageButton, 55 class PlaceHolderButton : public views::ImageButton,
51 public views::ButtonListener { 56 public views::ButtonListener {
52 public: 57 public:
53 PlaceHolderButton() 58 PlaceHolderButton()
54 : ImageButton(this) { 59 : ImageButton(this) {
55 gfx::Canvas canvas(gfx::Size(kIconSize, kIconSize), 1.0f, true); 60 gfx::Canvas canvas(gfx::Size(kIconSize, kIconSize), 1.0f, true);
56 SkPaint paint; 61 SkPaint paint;
57 paint.setStyle(SkPaint::kFill_Style); 62 paint.setStyle(SkPaint::kFill_Style);
58 paint.setColor(SkColorSetRGB(86, 119, 252)); 63 paint.setColor(SkColorSetRGB(86, 119, 252));
59 paint.setFlags(SkPaint::kAntiAlias_Flag); 64 paint.setFlags(SkPaint::kAntiAlias_Flag);
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 app_icon_container_ = new views::View(); 206 app_icon_container_ = new views::View();
202 AddChildView(app_icon_container_); 207 AddChildView(app_icon_container_);
203 app_icon_container_->SetPaintToLayer(true); 208 app_icon_container_->SetPaintToLayer(true);
204 app_icon_container_->layer()->SetFillsBoundsOpaquely(false); 209 app_icon_container_->layer()->SetFillsBoundsOpaquely(false);
205 app_icon_container_->SetLayoutManager(new views::BoxLayout( 210 app_icon_container_->SetLayoutManager(new views::BoxLayout(
206 views::BoxLayout::kHorizontal, 0, 0, kIconMargin)); 211 views::BoxLayout::kHorizontal, 0, 0, kIconMargin));
207 app_list::AppListItemList* top_level = 212 app_list::AppListItemList* top_level =
208 view_delegate->GetModel()->top_level_item_list(); 213 view_delegate->GetModel()->top_level_item_list();
209 for (size_t i = 0; i < std::min(top_level->item_count(), kMaxIconNum); ++i) 214 for (size_t i = 0; i < std::min(top_level->item_count(), kMaxIconNum); ++i)
210 app_icon_container_->AddChildView(new AppIconButton(top_level->item_at(i))); 215 app_icon_container_->AddChildView(new AppIconButton(top_level->item_at(i)));
211 app_icon_container_->SetSize(app_icon_container_->GetPreferredSize()); 216 app_icon_container_->SetSize(GetIconContainerSize());
212 217
213 control_icon_container_ = new views::View(); 218 control_icon_container_ = new views::View();
214 control_icon_container_->SetPaintToLayer(true); 219 control_icon_container_->SetPaintToLayer(true);
215 control_icon_container_->SetFillsBoundsOpaquely(false); 220 control_icon_container_->SetFillsBoundsOpaquely(false);
216 AddChildView(control_icon_container_); 221 AddChildView(control_icon_container_);
217 control_icon_container_->SetLayoutManager(new views::BoxLayout( 222 control_icon_container_->SetLayoutManager(new views::BoxLayout(
218 views::BoxLayout::kHorizontal, 0, 0, kIconMargin)); 223 views::BoxLayout::kHorizontal, 0, 0, kIconMargin));
219 for (size_t i = 0; i < kMaxIconNum; ++i) 224 for (size_t i = 0; i < kMaxIconNum; ++i)
220 control_icon_container_->AddChildView(new PlaceHolderButton()); 225 control_icon_container_->AddChildView(new PlaceHolderButton());
221 control_icon_container_->SetSize(control_icon_container_->GetPreferredSize()); 226 control_icon_container_->SetSize(GetIconContainerSize());
222 227
223 search_box_view_ = new app_list::SearchBoxView(this, view_delegate); 228 search_box_view_ = new app_list::SearchBoxView(this, view_delegate);
224 search_box_view_->set_contents_view(this); 229 search_box_view_->set_contents_view(this);
225 search_box_view_->search_box()->set_id(kHomeCardSearchBoxId); 230 search_box_view_->search_box()->set_id(kHomeCardSearchBoxId);
226 search_box_container_ = new SearchBoxContainer(search_box_view_); 231 search_box_container_ = new SearchBoxContainer(search_box_view_);
227 search_box_container_->SetPaintToLayer(true); 232 search_box_container_->SetPaintToLayer(true);
228 search_box_container_->SetFillsBoundsOpaquely(false); 233 search_box_container_->SetFillsBoundsOpaquely(false);
229 search_box_container_->SetSize(search_box_container_->GetPreferredSize()); 234 search_box_container_->SetSize(search_box_container_->GetPreferredSize());
230 AddChildView(search_box_container_); 235 AddChildView(search_box_container_);
231 } 236 }
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 base::TrimWhitespace( 430 base::TrimWhitespace(
426 delegate_->GetModel()->search_box()->text(), base::TRIM_ALL, &query); 431 delegate_->GetModel()->search_box()->text(), base::TRIM_ALL, &query);
427 432
428 if (!query.empty()) 433 if (!query.empty())
429 search_results_view_->SetSelectedIndex(0); 434 search_results_view_->SetSelectedIndex(0);
430 435
431 LayoutSearchResults(!query.empty()); 436 LayoutSearchResults(!query.empty());
432 } 437 }
433 438
434 } // namespace athena 439 } // namespace athena
OLDNEW
« no previous file with comments | « athena/extensions/extension_app_model_builder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698