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

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

Issue 335343002: Add a DummySearchBoxView to the experimental app list start page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 6 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 | Annotate | Revision Log
« no previous file with comments | « ui/app_list/views/start_page_view.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 "ui/app_list/views/tile_item_view.h" 5 #include "ui/app_list/views/tile_item_view.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.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_item.h" 9 #include "ui/app_list/app_list_item.h"
10 #include "ui/app_list/app_list_model.h" 10 #include "ui/app_list/app_list_model.h"
11 #include "ui/app_list/app_list_view_delegate.h" 11 #include "ui/app_list/app_list_view_delegate.h"
12 #include "ui/app_list/views/app_list_main_view.h" 12 #include "ui/app_list/views/app_list_main_view.h"
13 #include "ui/gfx/canvas.h" 13 #include "ui/gfx/canvas.h"
14 #include "ui/gfx/color_analysis.h" 14 #include "ui/gfx/color_analysis.h"
15 #include "ui/gfx/color_utils.h" 15 #include "ui/gfx/color_utils.h"
16 #include "ui/views/background.h" 16 #include "ui/views/background.h"
17 #include "ui/views/controls/image_view.h" 17 #include "ui/views/controls/image_view.h"
18 #include "ui/views/controls/label.h" 18 #include "ui/views/controls/label.h"
19 #include "ui/views/layout/box_layout.h" 19 #include "ui/views/layout/box_layout.h"
20 20
21 namespace { 21 namespace {
22 22
23 const int kTileSize = 90; 23 const int kTileSize = 90;
24 const int kTileHorizontalPadding = 10; 24 const int kTileHorizontalPadding = 10;
25 const int kTileImageSize = 48; 25 const int kTileImageSize = 48;
26 26
27 const SkColor kTileBackgroundColor = SK_ColorWHITE; 27 const SkColor kTileBackgroundColor = SK_ColorWHITE;
28 const SkColor kTileBorderColor = SkColorSetARGB(0x30, 0xD0, 0xD0, 0xD0);
29 const int kTileColorStripHeight = 2; 28 const int kTileColorStripHeight = 2;
30 const SkAlpha kTileColorStripOpacity = 0X5F; 29 const SkAlpha kTileColorStripOpacity = 0X5F;
31 const int kTileCornerRadius = 2; 30 const int kTileCornerRadius = 2;
32 31
33 } // namespace 32 } // namespace
34 33
35 namespace app_list { 34 namespace app_list {
36 35
37 // A background for the start page item view which consists of a rounded rect 36 // A background for the start page item view which consists of a rounded rect
38 // with a dominant color strip at the bottom. 37 // with a dominant color strip at the bottom.
39 class TileItemView::TileItemBackground : public views::Background { 38 class TileItemView::TileItemBackground : public views::Background {
40 public: 39 public:
41 TileItemBackground() : strip_color_(SK_ColorBLACK) {} 40 TileItemBackground() : strip_color_(SK_ColorBLACK) {}
42 virtual ~TileItemBackground() {} 41 virtual ~TileItemBackground() {}
43 42
44 void set_strip_color(SkColor strip_color) { strip_color_ = strip_color; } 43 void set_strip_color(SkColor strip_color) { strip_color_ = strip_color; }
45 44
46 // Overridden from views::Background: 45 // Overridden from views::Background:
47 virtual void Paint(gfx::Canvas* canvas, views::View* view) const OVERRIDE { 46 virtual void Paint(gfx::Canvas* canvas, views::View* view) const OVERRIDE {
48 SkPaint paint; 47 SkPaint paint;
49 paint.setFlags(SkPaint::kAntiAlias_Flag); 48 paint.setFlags(SkPaint::kAntiAlias_Flag);
50 49
51 // Paint the border. 50 // Paint the border.
52 paint.setColor(kTileBorderColor); 51 paint.setColor(kStartPageBorderColor);
53 canvas->DrawRoundRect(view->GetContentsBounds(), kTileCornerRadius, paint); 52 canvas->DrawRoundRect(view->GetContentsBounds(), kTileCornerRadius, paint);
54 53
55 // Paint a rectangle for the color strip. 54 // Paint a rectangle for the color strip.
56 gfx::Rect color_strip_rect(view->GetContentsBounds()); 55 gfx::Rect color_strip_rect(view->GetContentsBounds());
57 color_strip_rect.Inset(1, 1, 1, 1); 56 color_strip_rect.Inset(1, 1, 1, 1);
58 paint.setColor(SkColorSetA(strip_color_, kTileColorStripOpacity)); 57 paint.setColor(SkColorSetA(strip_color_, kTileColorStripOpacity));
59 canvas->DrawRoundRect(color_strip_rect, kTileCornerRadius, paint); 58 canvas->DrawRoundRect(color_strip_rect, kTileCornerRadius, paint);
60 59
61 // Paint the main background rectangle, leaving part of the color strip 60 // Paint the main background rectangle, leaving part of the color strip
62 // unobscured. 61 // unobscured.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 gfx::Size TileItemView::GetPreferredSize() const { 130 gfx::Size TileItemView::GetPreferredSize() const {
132 return gfx::Size(kTileSize, kTileSize); 131 return gfx::Size(kTileSize, kTileSize);
133 } 132 }
134 133
135 void TileItemView::ButtonPressed(views::Button* sender, 134 void TileItemView::ButtonPressed(views::Button* sender,
136 const ui::Event& event) { 135 const ui::Event& event) {
137 item_->Activate(event.flags()); 136 item_->Activate(event.flags());
138 } 137 }
139 138
140 } // namespace app_list 139 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/views/start_page_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698