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

Side by Side Diff: ui/app_list/app_list_bubble_border.cc

Issue 10905311: Consolidate bubble border code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove USE_AURA ifdef for kBigShadowImages and kSmalleShadowImages Created 8 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 | Annotate | Revision Log
« no previous file with comments | « ui/app_list/app_list_bubble_border.h ('k') | ui/app_list/app_list_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
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/app_list/app_list_bubble_border.h"
6
7 #include "third_party/skia/include/core/SkPath.h"
8 #include "third_party/skia/include/core/SkPaint.h"
9 #include "third_party/skia/include/effects/SkGradientShader.h"
10 #include "ui/app_list/app_list_constants.h"
11 #include "ui/gfx/canvas.h"
12 #include "ui/gfx/path.h"
13 #include "ui/gfx/skia_util.h"
14
15 namespace {
16
17 const SkColor kSearchBoxBackground = SK_ColorWHITE;
18
19 // Colors and sizes of top separator between searchbox and grid view.
20 const SkColor kTopSeparatorColor = SkColorSetRGB(0xE5, 0xE5, 0xE5);
21 const int kTopSeparatorSize = 1;
22
23 } // namespace
24
25 namespace app_list {
26
27 AppListBubbleBorder::AppListBubbleBorder(views::View* app_list_view,
28 views::View* search_box_view)
29 : views::BubbleBorder2(views::BubbleBorder::BOTTOM_RIGHT),
30 app_list_view_(app_list_view),
31 search_box_view_(search_box_view) {
32 }
33
34 AppListBubbleBorder::~AppListBubbleBorder() {
35 }
36
37 void AppListBubbleBorder::PaintBackground(gfx::Canvas* canvas,
38 const gfx::Rect& bounds) const {
39 SkPaint paint;
40 paint.setStyle(SkPaint::kFill_Style);
41
42 // TODO(benwells): Get these details painting on Windows.
43 #if !defined(OS_WIN)
44 const gfx::Rect search_box_view_bounds =
45 app_list_view_->ConvertRectToWidget(search_box_view_->bounds());
46 gfx::Rect search_box_rect(bounds.x(),
47 bounds.y(),
48 bounds.width(),
49 search_box_view_bounds.bottom() - bounds.y());
50
51 paint.setColor(kSearchBoxBackground);
52 canvas->DrawRect(search_box_rect, paint);
53
54 gfx::Rect seperator_rect(search_box_rect);
55 seperator_rect.set_y(seperator_rect.bottom());
56 seperator_rect.set_height(kTopSeparatorSize);
57 canvas->FillRect(seperator_rect, kTopSeparatorColor);
58
59 gfx::Rect contents_rect(bounds.x(),
60 seperator_rect.bottom(),
61 bounds.width(),
62 bounds.bottom() - seperator_rect.bottom());
63 #else
64 gfx::Rect contents_rect(bounds);
65 #endif
66
67 paint.setColor(kContentsBackgroundColor);
68 canvas->DrawRect(contents_rect, paint);
69 }
70
71 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/app_list_bubble_border.h ('k') | ui/app_list/app_list_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698