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

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

Issue 493293003: Use a background for the main search box in the experimental app list. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 6 years, 4 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/search_box_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/start_page_view.h" 5 #include "ui/app_list/views/start_page_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"
(...skipping 18 matching lines...) Expand all
29 // Layout constants. 29 // Layout constants.
30 const int kTopMargin = 30; 30 const int kTopMargin = 30;
31 const int kInstantContainerSpacing = 20; 31 const int kInstantContainerSpacing = 20;
32 32
33 // WebView constants. 33 // WebView constants.
34 const int kWebViewWidth = 500; 34 const int kWebViewWidth = 500;
35 const int kWebViewHeight = 105; 35 const int kWebViewHeight = 105;
36 36
37 // DummySearchBoxView constants. 37 // DummySearchBoxView constants.
38 const int kDummySearchBoxWidth = 490; 38 const int kDummySearchBoxWidth = 490;
39 const int kDummySearchBoxHeight = 40;
40 const int kDummySearchBoxBorderWidth = 1;
41 const int kDummySearchBoxBorderBottomWidth = 2;
42 const int kDummySearchBoxBorderCornerRadius = 2;
43 39
44 // Tile container constants. 40 // Tile container constants.
45 const size_t kNumStartPageTiles = 5; 41 const size_t kNumStartPageTiles = 5;
46 const int kTileSpacing = 10; 42 const int kTileSpacing = 10;
47 43
48 // A background that paints a solid white rounded rect with a thin grey border.
49 class DummySearchBoxBackground : public views::Background {
50 public:
51 DummySearchBoxBackground() {}
52 virtual ~DummySearchBoxBackground() {}
53
54 private:
55 // views::Background overrides:
56 virtual void Paint(gfx::Canvas* canvas, views::View* view) const OVERRIDE {
57 gfx::Rect bounds = view->GetContentsBounds();
58
59 SkPaint paint;
60 paint.setFlags(SkPaint::kAntiAlias_Flag);
61 paint.setColor(kStartPageBorderColor);
62 canvas->DrawRoundRect(bounds, kDummySearchBoxBorderCornerRadius, paint);
63 bounds.Inset(kDummySearchBoxBorderWidth,
64 kDummySearchBoxBorderWidth,
65 kDummySearchBoxBorderWidth,
66 kDummySearchBoxBorderBottomWidth);
67 paint.setColor(SK_ColorWHITE);
68 canvas->DrawRoundRect(bounds, kDummySearchBoxBorderCornerRadius, paint);
69 }
70
71 DISALLOW_COPY_AND_ASSIGN(DummySearchBoxBackground);
72 };
73
74 // A placeholder search box which is sized to fit within the start page view. 44 // A placeholder search box which is sized to fit within the start page view.
75 class DummySearchBoxView : public SearchBoxView { 45 class DummySearchBoxView : public SearchBoxView {
76 public: 46 public:
77 DummySearchBoxView(SearchBoxViewDelegate* delegate, 47 DummySearchBoxView(SearchBoxViewDelegate* delegate,
78 AppListViewDelegate* view_delegate) 48 AppListViewDelegate* view_delegate)
79 : SearchBoxView(delegate, view_delegate) { 49 : SearchBoxView(delegate, view_delegate) {
80 set_background(new DummySearchBoxBackground());
81 } 50 }
82 51
83 virtual ~DummySearchBoxView() {} 52 virtual ~DummySearchBoxView() {}
84 53
85 // Overridden from views::View: 54 // Overridden from views::View:
86 virtual gfx::Size GetPreferredSize() const OVERRIDE { 55 virtual gfx::Size GetPreferredSize() const OVERRIDE {
87 return gfx::Size(kDummySearchBoxWidth, kDummySearchBoxHeight); 56 gfx::Size size(SearchBoxView::GetPreferredSize());
57 size.set_width(kDummySearchBoxWidth);
58 return size;
88 } 59 }
89 60
90 private: 61 private:
91 DISALLOW_COPY_AND_ASSIGN(DummySearchBoxView); 62 DISALLOW_COPY_AND_ASSIGN(DummySearchBoxView);
92 }; 63 };
93 64
94 } // namespace 65 } // namespace
95 66
96 StartPageView::StartPageView(AppListMainView* app_list_main_view, 67 StartPageView::StartPageView(AppListMainView* app_list_main_view,
97 AppListViewDelegate* view_delegate) 68 AppListViewDelegate* view_delegate)
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 257
287 void StartPageView::ListItemMoved(size_t index, size_t target_index) { 258 void StartPageView::ListItemMoved(size_t index, size_t target_index) {
288 ScheduleUpdate(); 259 ScheduleUpdate();
289 } 260 }
290 261
291 void StartPageView::ListItemsChanged(size_t start, size_t count) { 262 void StartPageView::ListItemsChanged(size_t start, size_t count) {
292 ScheduleUpdate(); 263 ScheduleUpdate();
293 } 264 }
294 265
295 } // namespace app_list 266 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/views/search_box_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698