| 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 // TODO(benwells): Get these details painting on Windows. |
| 48 #if !defined(OS_WIN) |
| 39 const gfx::Rect search_box_view_bounds = | 49 const gfx::Rect search_box_view_bounds = |
| 40 app_list_view_->ConvertRectToWidget(search_box_view_->bounds()); | 50 app_list_view_->ConvertRectToWidget(search_box_view_->bounds()); |
| 41 gfx::Rect search_box_rect(bounds.x(), | 51 gfx::Rect search_box_rect(bounds.x(), |
| 42 bounds.y(), | 52 bounds.y(), |
| 43 bounds.width(), | 53 bounds.width(), |
| 44 search_box_view_bounds.bottom() - bounds.y()); | 54 search_box_view_bounds.bottom() - bounds.y()); |
| 45 | 55 |
| 46 SkPaint paint; | |
| 47 paint.setStyle(SkPaint::kFill_Style); | |
| 48 paint.setColor(kSearchBoxBackground); | 56 paint.setColor(kSearchBoxBackground); |
| 49 canvas->DrawRect(search_box_rect, paint); | 57 canvas->DrawRect(search_box_rect, paint); |
| 50 | 58 |
| 51 gfx::Rect seperator_rect(search_box_rect); | 59 gfx::Rect seperator_rect(search_box_rect); |
| 52 seperator_rect.set_y(seperator_rect.bottom()); | 60 seperator_rect.set_y(seperator_rect.bottom()); |
| 53 seperator_rect.set_height(kTopSeparatorSize); | 61 seperator_rect.set_height(kTopSeparatorSize); |
| 54 canvas->FillRect(seperator_rect, kTopSeparatorColor); | 62 canvas->FillRect(seperator_rect, kTopSeparatorColor); |
| 55 | 63 |
| 56 gfx::Rect contents_rect(bounds.x(), | 64 gfx::Rect contents_rect(bounds.x(), |
| 57 seperator_rect.bottom(), | 65 seperator_rect.bottom(), |
| 58 bounds.width(), | 66 bounds.width(), |
| 59 bounds.bottom() - seperator_rect.bottom()); | 67 bounds.bottom() - seperator_rect.bottom()); |
| 68 #else |
| 69 gfx::Rect contents_rect(bounds); |
| 70 #endif |
| 60 | 71 |
| 61 paint.setColor(kContentsBackground); | 72 paint.setColor(kContentsBackground); |
| 62 canvas->DrawRect(contents_rect, paint); | 73 canvas->DrawRect(contents_rect, paint); |
| 63 } | 74 } |
| 64 | 75 |
| 65 } // namespace app_list | 76 } // namespace app_list |
| OLD | NEW |