| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/search_result_actions_view.h" | 5 #include "ui/app_list/views/search_result_actions_view.h" |
| 6 | 6 |
| 7 #include "ui/app_list/views/search_result_actions_view_delegate.h" | 7 #include "ui/app_list/views/search_result_actions_view_delegate.h" |
| 8 #include "ui/base/resource/resource_bundle.h" | 8 #include "ui/base/resource/resource_bundle.h" |
| 9 #include "ui/gfx/canvas.h" | 9 #include "ui/gfx/canvas.h" |
| 10 #include "ui/views/border.h" | 10 #include "ui/views/border.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 button->SetImage(views::CustomButton::STATE_PRESSED, &action.pressed_image); | 71 button->SetImage(views::CustomButton::STATE_PRESSED, &action.pressed_image); |
| 72 button->SetTooltipText(action.tooltip_text); | 72 button->SetTooltipText(action.tooltip_text); |
| 73 AddChildView(button); | 73 AddChildView(button); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void SearchResultActionsView::CreateBlueButton( | 76 void SearchResultActionsView::CreateBlueButton( |
| 77 const SearchResult::Action& action) { | 77 const SearchResult::Action& action) { |
| 78 views::BlueButton* button = new views::BlueButton(this, action.label_text); | 78 views::BlueButton* button = new views::BlueButton(this, action.label_text); |
| 79 button->SetAccessibleName(action.label_text); | 79 button->SetAccessibleName(action.label_text); |
| 80 button->SetTooltipText(action.tooltip_text); | 80 button->SetTooltipText(action.tooltip_text); |
| 81 button->SetFont(ui::ResourceBundle::GetSharedInstance().GetFont( | 81 button->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( |
| 82 ui::ResourceBundle::SmallBoldFont)); | 82 ui::ResourceBundle::SmallBoldFont)); |
| 83 button->SetFocusable(false); | 83 button->SetFocusable(false); |
| 84 AddChildView(button); | 84 AddChildView(button); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void SearchResultActionsView::OnPaint(gfx::Canvas* canvas) { | 87 void SearchResultActionsView::OnPaint(gfx::Canvas* canvas) { |
| 88 if (!IsValidActionIndex(selected_action_)) | 88 if (!IsValidActionIndex(selected_action_)) |
| 89 return; | 89 return; |
| 90 | 90 |
| 91 const gfx::Rect active_action_bounds(child_at(selected_action_)->bounds()); | 91 const gfx::Rect active_action_bounds(child_at(selected_action_)->bounds()); |
| 92 const SkColor kActiveActionBackground = SkColorSetRGB(0xA0, 0xA0, 0xA0); | 92 const SkColor kActiveActionBackground = SkColorSetRGB(0xA0, 0xA0, 0xA0); |
| 93 canvas->FillRect(active_action_bounds, kActiveActionBackground); | 93 canvas->FillRect(active_action_bounds, kActiveActionBackground); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void SearchResultActionsView::ButtonPressed(views::Button* sender, | 96 void SearchResultActionsView::ButtonPressed(views::Button* sender, |
| 97 const ui::Event& event) { | 97 const ui::Event& event) { |
| 98 if (!delegate_) | 98 if (!delegate_) |
| 99 return; | 99 return; |
| 100 | 100 |
| 101 const int index = GetIndexOf(sender); | 101 const int index = GetIndexOf(sender); |
| 102 DCHECK_NE(-1, index); | 102 DCHECK_NE(-1, index); |
| 103 delegate_->OnSearchResultActionActivated(index, event.flags()); | 103 delegate_->OnSearchResultActionActivated(index, event.flags()); |
| 104 } | 104 } |
| 105 | 105 |
| 106 } // namespace app_list | 106 } // namespace app_list |
| OLD | NEW |