| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 | 57 |
| 58 bool SearchResultActionsView::IsValidActionIndex(int action_index) const { | 58 bool SearchResultActionsView::IsValidActionIndex(int action_index) const { |
| 59 return action_index >= 0 && action_index < child_count(); | 59 return action_index >= 0 && action_index < child_count(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 void SearchResultActionsView::CreateImageButton( | 62 void SearchResultActionsView::CreateImageButton( |
| 63 const SearchResult::Action& action) { | 63 const SearchResult::Action& action) { |
| 64 views::ImageButton* button = new views::ImageButton(this); | 64 views::ImageButton* button = new views::ImageButton(this); |
| 65 button->set_border(views::Border::CreateEmptyBorder(0, 9, 0, 9)); | 65 button->SetBorder(views::Border::CreateEmptyBorder(0, 9, 0, 9)); |
| 66 button->SetAccessibleName(action.tooltip_text); | 66 button->SetAccessibleName(action.tooltip_text); |
| 67 button->SetImageAlignment(views::ImageButton::ALIGN_CENTER, | 67 button->SetImageAlignment(views::ImageButton::ALIGN_CENTER, |
| 68 views::ImageButton::ALIGN_MIDDLE); | 68 views::ImageButton::ALIGN_MIDDLE); |
| 69 button->SetImage(views::CustomButton::STATE_NORMAL, &action.base_image); | 69 button->SetImage(views::CustomButton::STATE_NORMAL, &action.base_image); |
| 70 button->SetImage(views::CustomButton::STATE_HOVERED, &action.hover_image); | 70 button->SetImage(views::CustomButton::STATE_HOVERED, &action.hover_image); |
| 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 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 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 |