Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/app_list_bubble_border.h" | 5 #include "ui/app_list/app_list_bubble_border.h" |
| 6 | 6 |
| 7 #include "third_party/skia/include/core/SkPath.h" | 7 #include "third_party/skia/include/core/SkPath.h" |
| 8 #include "third_party/skia/include/core/SkPaint.h" | 8 #include "third_party/skia/include/core/SkPaint.h" |
| 9 #include "third_party/skia/include/effects/SkGradientShader.h" | 9 #include "third_party/skia/include/effects/SkGradientShader.h" |
| 10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 AppListBubbleBorder::AppListBubbleBorder(views::View* app_list_view, | 27 AppListBubbleBorder::AppListBubbleBorder(views::View* app_list_view, |
| 28 views::View* search_box_view) | 28 views::View* search_box_view) |
| 29 : views::BubbleBorder2(views::BubbleBorder::BOTTOM_RIGHT), | 29 : views::BubbleBorder2(views::BubbleBorder::BOTTOM_RIGHT), |
| 30 app_list_view_(app_list_view), | 30 app_list_view_(app_list_view), |
| 31 search_box_view_(search_box_view) { | 31 search_box_view_(search_box_view) { |
| 32 } | 32 } |
| 33 | 33 |
| 34 AppListBubbleBorder::~AppListBubbleBorder() { | 34 AppListBubbleBorder::~AppListBubbleBorder() { |
| 35 } | 35 } |
| 36 | 36 |
| 37 // static | |
| 38 SkColor AppListBubbleBorder::ContentsBackgroundColor() { | |
| 39 return kContentsBackground; | |
| 40 } | |
| 41 | |
| 37 void AppListBubbleBorder::PaintBackground(gfx::Canvas* canvas, | 42 void AppListBubbleBorder::PaintBackground(gfx::Canvas* canvas, |
| 38 const gfx::Rect& bounds) const { | 43 const gfx::Rect& bounds) const { |
| 44 SkPaint paint; | |
| 45 paint.setStyle(SkPaint::kFill_Style); | |
| 46 | |
| 47 #if !defined(OS_WIN) | |
|
xiyuan
2012/08/29 17:39:15
Could you confirm that app list looks different on
benwells
2012/08/30 06:51:30
Nothing drawn here is shown on Windows, except for
xiyuan
2012/08/30 16:50:51
There are padding pixels (controlled by BubbleDele
| |
| 39 const gfx::Rect search_box_view_bounds = | 48 const gfx::Rect search_box_view_bounds = |
| 40 app_list_view_->ConvertRectToWidget(search_box_view_->bounds()); | 49 app_list_view_->ConvertRectToWidget(search_box_view_->bounds()); |
| 41 gfx::Rect search_box_rect(bounds.x(), | 50 gfx::Rect search_box_rect(bounds.x(), |
| 42 bounds.y(), | 51 bounds.y(), |
| 43 bounds.width(), | 52 bounds.width(), |
| 44 search_box_view_bounds.bottom() - bounds.y()); | 53 search_box_view_bounds.bottom() - bounds.y()); |
| 45 | 54 |
| 46 SkPaint paint; | |
| 47 paint.setStyle(SkPaint::kFill_Style); | |
| 48 paint.setColor(kSearchBoxBackground); | 55 paint.setColor(kSearchBoxBackground); |
| 49 canvas->DrawRect(search_box_rect, paint); | 56 canvas->DrawRect(search_box_rect, paint); |
| 50 | 57 |
| 51 gfx::Rect seperator_rect(search_box_rect); | 58 gfx::Rect seperator_rect(search_box_rect); |
| 52 seperator_rect.set_y(seperator_rect.bottom()); | 59 seperator_rect.set_y(seperator_rect.bottom()); |
| 53 seperator_rect.set_height(kTopSeparatorSize); | 60 seperator_rect.set_height(kTopSeparatorSize); |
| 54 canvas->FillRect(seperator_rect, kTopSeparatorColor); | 61 canvas->FillRect(seperator_rect, kTopSeparatorColor); |
| 55 | 62 |
| 56 gfx::Rect contents_rect(bounds.x(), | 63 gfx::Rect contents_rect(bounds.x(), |
| 57 seperator_rect.bottom(), | 64 seperator_rect.bottom(), |
| 58 bounds.width(), | 65 bounds.width(), |
| 59 bounds.bottom() - seperator_rect.bottom()); | 66 bounds.bottom() - seperator_rect.bottom()); |
| 67 #else | |
| 68 gfx::Rect contents_rect(bounds.x(), | |
|
msw
2012/08/29 08:02:35
nit: use copy ctor.
benwells
2012/08/30 06:51:30
Done.
| |
| 69 bounds.y(), | |
| 70 bounds.width(), | |
| 71 bounds.height()); | |
| 72 #endif | |
| 60 | 73 |
| 61 paint.setColor(kContentsBackground); | 74 paint.setColor(kContentsBackground); |
| 62 canvas->DrawRect(contents_rect, paint); | 75 canvas->DrawRect(contents_rect, paint); |
| 63 } | 76 } |
| 64 | 77 |
| 65 } // namespace app_list | 78 } // namespace app_list |
| OLD | NEW |