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/views/border.h" | 9 #include "ui/views/border.h" |
10 #include "ui/views/controls/button/blue_button.h" | 10 #include "ui/views/controls/button/blue_button.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 else | 32 else |
33 CreateBlueButton(action); | 33 CreateBlueButton(action); |
34 } | 34 } |
35 | 35 |
36 PreferredSizeChanged(); | 36 PreferredSizeChanged(); |
37 } | 37 } |
38 | 38 |
39 void SearchResultActionsView::CreateImageButton( | 39 void SearchResultActionsView::CreateImageButton( |
40 const SearchResult::Action& action) { | 40 const SearchResult::Action& action) { |
41 views::ImageButton* button = new views::ImageButton(this); | 41 views::ImageButton* button = new views::ImageButton(this); |
42 button->set_border(views::Border::CreateEmptyBorder(0, 4, 0, 4)); | 42 button->set_border(views::Border::CreateEmptyBorder(0, 9, 0, 9)); |
43 button->SetImageAlignment(views::ImageButton::ALIGN_CENTER, | 43 button->SetImageAlignment(views::ImageButton::ALIGN_CENTER, |
44 views::ImageButton::ALIGN_MIDDLE); | 44 views::ImageButton::ALIGN_MIDDLE); |
45 button->SetImage(views::CustomButton::STATE_NORMAL, &action.base_image); | 45 button->SetImage(views::CustomButton::STATE_NORMAL, &action.base_image); |
46 button->SetImage(views::CustomButton::STATE_HOVERED, &action.hover_image); | 46 button->SetImage(views::CustomButton::STATE_HOVERED, &action.hover_image); |
47 button->SetImage(views::CustomButton::STATE_PRESSED, &action.pressed_image); | 47 button->SetImage(views::CustomButton::STATE_PRESSED, &action.pressed_image); |
48 button->SetTooltipText(action.tooltip_text); | 48 button->SetTooltipText(action.tooltip_text); |
49 AddChildView(button); | 49 AddChildView(button); |
50 } | 50 } |
51 | 51 |
52 void SearchResultActionsView::CreateBlueButton( | 52 void SearchResultActionsView::CreateBlueButton( |
(...skipping 10 matching lines...) Expand all Loading... |
63 const ui::Event& event) { | 63 const ui::Event& event) { |
64 if (!delegate_) | 64 if (!delegate_) |
65 return; | 65 return; |
66 | 66 |
67 const int index = GetIndexOf(sender); | 67 const int index = GetIndexOf(sender); |
68 DCHECK_NE(-1, index); | 68 DCHECK_NE(-1, index); |
69 delegate_->OnSearchResultActionActivated(index, event.flags()); | 69 delegate_->OnSearchResultActionActivated(index, event.flags()); |
70 } | 70 } |
71 | 71 |
72 } // namespace app_list | 72 } // namespace app_list |
OLD | NEW |