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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // Clamp |action_index| in [-1, child_count()]. | 47 // Clamp |action_index| in [-1, child_count()]. |
48 action_index = std::min(child_count(), std::max(-1, action_index)); | 48 action_index = std::min(child_count(), std::max(-1, action_index)); |
49 | 49 |
50 if (selected_action_ == action_index) | 50 if (selected_action_ == action_index) |
51 return; | 51 return; |
52 | 52 |
53 selected_action_ = action_index; | 53 selected_action_ = action_index; |
54 SchedulePaint(); | 54 SchedulePaint(); |
55 | 55 |
56 if (IsValidActionIndex(selected_action_)) { | 56 if (IsValidActionIndex(selected_action_)) { |
57 child_at(selected_action_)->NotifyAccessibilityEvent( | 57 child_at(selected_action_) |
58 ui::AX_EVENT_FOCUS, true); | 58 ->NotifyAccessibilityEvent(ui::AX_EVENT_HOVER, true); |
59 } | 59 } |
60 } | 60 } |
61 | 61 |
62 bool SearchResultActionsView::IsValidActionIndex(int action_index) const { | 62 bool SearchResultActionsView::IsValidActionIndex(int action_index) const { |
63 return action_index >= 0 && action_index < child_count(); | 63 return action_index >= 0 && action_index < child_count(); |
64 } | 64 } |
65 | 65 |
66 void SearchResultActionsView::CreateImageButton( | 66 void SearchResultActionsView::CreateImageButton( |
67 const SearchResult::Action& action) { | 67 const SearchResult::Action& action) { |
68 views::ImageButton* button = new views::ImageButton(this); | 68 views::ImageButton* button = new views::ImageButton(this); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |