Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(488)

Side by Side Diff: ui/app_list/views/search_result_actions_view.cc

Issue 2480813003: Reduce views::Border creation verbosity by promoting factory functions (Closed)
Patch Set: fix bad merge Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
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);
69 button->SetBorder(views::Border::CreateEmptyBorder(0, 9, 0, 9)); 69 button->SetBorder(views::CreateEmptyBorder(0, 9, 0, 9));
70 button->SetAccessibleName(action.tooltip_text); 70 button->SetAccessibleName(action.tooltip_text);
71 button->SetImageAlignment(views::ImageButton::ALIGN_CENTER, 71 button->SetImageAlignment(views::ImageButton::ALIGN_CENTER,
72 views::ImageButton::ALIGN_MIDDLE); 72 views::ImageButton::ALIGN_MIDDLE);
73 button->SetImage(views::CustomButton::STATE_NORMAL, &action.base_image); 73 button->SetImage(views::CustomButton::STATE_NORMAL, &action.base_image);
74 button->SetImage(views::CustomButton::STATE_HOVERED, &action.hover_image); 74 button->SetImage(views::CustomButton::STATE_HOVERED, &action.hover_image);
75 button->SetImage(views::CustomButton::STATE_PRESSED, &action.pressed_image); 75 button->SetImage(views::CustomButton::STATE_PRESSED, &action.pressed_image);
76 button->SetTooltipText(action.tooltip_text); 76 button->SetTooltipText(action.tooltip_text);
77 AddChildView(button); 77 AddChildView(button);
78 } 78 }
79 79
(...skipping 20 matching lines...) Expand all
100 const ui::Event& event) { 100 const ui::Event& event) {
101 if (!delegate_) 101 if (!delegate_)
102 return; 102 return;
103 103
104 const int index = GetIndexOf(sender); 104 const int index = GetIndexOf(sender);
105 DCHECK_NE(-1, index); 105 DCHECK_NE(-1, index);
106 delegate_->OnSearchResultActionActivated(index, event.flags()); 106 delegate_->OnSearchResultActionActivated(index, event.flags());
107 } 107 }
108 108
109 } // namespace app_list 109 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/views/search_box_view.cc ('k') | ui/app_list/views/search_result_tile_item_list_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698