| 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/search_result_view.h" | 5 #include "ui/app_list/search_result_view.h" |
| 6 | 6 |
| 7 #include "ui/app_list/search_result.h" | 7 #include "ui/app_list/search_result.h" |
| 8 #include "ui/app_list/search_result_list_view.h" | 8 #include "ui/app_list/search_result_list_view.h" |
| 9 #include "ui/gfx/canvas.h" | 9 #include "ui/gfx/canvas.h" |
| 10 #include "ui/gfx/font.h" | 10 #include "ui/gfx/font.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 // Extra margin at the right of the rightmost action icon. | 32 // Extra margin at the right of the rightmost action icon. |
| 33 const int kActionButtonRightMargin = 8; | 33 const int kActionButtonRightMargin = 8; |
| 34 | 34 |
| 35 const SkColor kBorderColor = SkColorSetARGB(0x0F, 0, 0, 0); | 35 const SkColor kBorderColor = SkColorSetARGB(0x0F, 0, 0, 0); |
| 36 | 36 |
| 37 const SkColor kDefaultTextColor = SkColorSetRGB(0x33, 0x33, 0x33); | 37 const SkColor kDefaultTextColor = SkColorSetRGB(0x33, 0x33, 0x33); |
| 38 const SkColor kDimmedTextColor = SkColorSetRGB(0x96, 0x96, 0x96); | 38 const SkColor kDimmedTextColor = SkColorSetRGB(0x96, 0x96, 0x96); |
| 39 const SkColor kURLTextColor = SkColorSetRGB(0x00, 0x99, 0x33); | 39 const SkColor kURLTextColor = SkColorSetRGB(0x00, 0x99, 0x33); |
| 40 | 40 |
| 41 const SkColor kBackgroundColor = SkColorSetRGB(0xF5, 0xF5, 0xF5); |
| 41 const SkColor kSelectedBorderColor = kBorderColor; | 42 const SkColor kSelectedBorderColor = kBorderColor; |
| 42 const SkColor kSelectedBackgroundColor = SkColorSetARGB(0x0F, 0x4D, 0x90, 0xFE); | 43 const SkColor kSelectedBackgroundColor = SkColorSetARGB(0x0F, 0x4D, 0x90, 0xFE); |
| 43 const SkColor kHoverAndPushedColor = SkColorSetARGB(0x05, 0, 0, 0); | 44 const SkColor kHoverAndPushedColor = SkColorSetARGB(0x05, 0, 0, 0); |
| 44 | 45 |
| 45 // A non-interactive image view to display result icon. | 46 // A non-interactive image view to display result icon. |
| 46 class IconView : public views::ImageView { | 47 class IconView : public views::ImageView { |
| 47 public: | 48 public: |
| 48 IconView() : ImageView() {} | 49 IconView() : ImageView() {} |
| 49 virtual ~IconView() {} | 50 virtual ~IconView() {} |
| 50 | 51 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 } | 183 } |
| 183 | 184 |
| 184 void SearchResultView::OnPaint(gfx::Canvas* canvas) { | 185 void SearchResultView::OnPaint(gfx::Canvas* canvas) { |
| 185 gfx::Rect rect(GetContentsBounds()); | 186 gfx::Rect rect(GetContentsBounds()); |
| 186 if (rect.IsEmpty()) | 187 if (rect.IsEmpty()) |
| 187 return; | 188 return; |
| 188 | 189 |
| 189 gfx::Rect content_rect(rect); | 190 gfx::Rect content_rect(rect); |
| 190 content_rect.set_height(rect.height() - kBorderSize); | 191 content_rect.set_height(rect.height() - kBorderSize); |
| 191 | 192 |
| 193 canvas->FillRect(content_rect, kBackgroundColor); |
| 194 |
| 192 bool selected = list_view_->IsResultViewSelected(this); | 195 bool selected = list_view_->IsResultViewSelected(this); |
| 193 if (selected) { | 196 if (selected) { |
| 194 canvas->FillRect(content_rect, kSelectedBackgroundColor); | 197 canvas->FillRect(content_rect, kSelectedBackgroundColor); |
| 195 } else if (state() == BS_HOT || state() == BS_PUSHED) { | 198 } else if (state() == BS_HOT || state() == BS_PUSHED) { |
| 196 canvas->FillRect(content_rect, kHoverAndPushedColor); | 199 canvas->FillRect(content_rect, kHoverAndPushedColor); |
| 197 } | 200 } |
| 198 | 201 |
| 199 gfx::Rect border_bottom = rect.Subtract(content_rect); | 202 gfx::Rect border_bottom = rect.Subtract(content_rect); |
| 200 canvas->FillRect(border_bottom, | 203 canvas->FillRect(border_bottom, |
| 201 selected ? kSelectedBorderColor : kBorderColor); | 204 selected ? kSelectedBorderColor : kBorderColor); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 views::ImageButton* button = action_buttons_[i]; | 295 views::ImageButton* button = action_buttons_[i]; |
| 293 button->SetImage(views::CustomButton::BS_NORMAL, &icon.base_image); | 296 button->SetImage(views::CustomButton::BS_NORMAL, &icon.base_image); |
| 294 button->SetImage(views::CustomButton::BS_HOT, &icon.hover_image); | 297 button->SetImage(views::CustomButton::BS_HOT, &icon.hover_image); |
| 295 button->SetImage(views::CustomButton::BS_PUSHED, &icon.pressed_image); | 298 button->SetImage(views::CustomButton::BS_PUSHED, &icon.pressed_image); |
| 296 button->SetTooltipText(icon.tooltip_text); | 299 button->SetTooltipText(icon.tooltip_text); |
| 297 } | 300 } |
| 298 } | 301 } |
| 299 } | 302 } |
| 300 | 303 |
| 301 } // namespace app_list | 304 } // namespace app_list |
| OLD | NEW |