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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 AddChildView(button); | 77 AddChildView(button); |
78 } | 78 } |
79 | 79 |
80 void SearchResultActionsView::CreateBlueButton( | 80 void SearchResultActionsView::CreateBlueButton( |
81 const SearchResult::Action& action) { | 81 const SearchResult::Action& action) { |
82 views::BlueButton* button = new views::BlueButton(this, action.label_text); | 82 views::BlueButton* button = new views::BlueButton(this, action.label_text); |
83 button->SetAccessibleName(action.label_text); | 83 button->SetAccessibleName(action.label_text); |
84 button->SetTooltipText(action.tooltip_text); | 84 button->SetTooltipText(action.tooltip_text); |
85 button->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( | 85 button->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( |
86 ui::ResourceBundle::SmallBoldFont)); | 86 ui::ResourceBundle::SmallBoldFont)); |
87 button->SetFocusable(false); | 87 button->SetFocusBehavior(FocusBehavior::NEVER); |
88 AddChildView(button); | 88 AddChildView(button); |
89 } | 89 } |
90 | 90 |
91 void SearchResultActionsView::OnPaint(gfx::Canvas* canvas) { | 91 void SearchResultActionsView::OnPaint(gfx::Canvas* canvas) { |
92 if (!IsValidActionIndex(selected_action_)) | 92 if (!IsValidActionIndex(selected_action_)) |
93 return; | 93 return; |
94 | 94 |
95 const gfx::Rect active_action_bounds(child_at(selected_action_)->bounds()); | 95 const gfx::Rect active_action_bounds(child_at(selected_action_)->bounds()); |
96 const SkColor kActiveActionBackground = SkColorSetRGB(0xA0, 0xA0, 0xA0); | 96 const SkColor kActiveActionBackground = SkColorSetRGB(0xA0, 0xA0, 0xA0); |
97 canvas->FillRect(active_action_bounds, kActiveActionBackground); | 97 canvas->FillRect(active_action_bounds, kActiveActionBackground); |
98 } | 98 } |
99 | 99 |
100 void SearchResultActionsView::ButtonPressed(views::Button* sender, | 100 void SearchResultActionsView::ButtonPressed(views::Button* sender, |
101 const ui::Event& event) { | 101 const ui::Event& event) { |
102 if (!delegate_) | 102 if (!delegate_) |
103 return; | 103 return; |
104 | 104 |
105 const int index = GetIndexOf(sender); | 105 const int index = GetIndexOf(sender); |
106 DCHECK_NE(-1, index); | 106 DCHECK_NE(-1, index); |
107 delegate_->OnSearchResultActionActivated(index, event.flags()); | 107 delegate_->OnSearchResultActionActivated(index, event.flags()); |
108 } | 108 } |
109 | 109 |
110 } // namespace app_list | 110 } // namespace app_list |
OLD | NEW |