OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/views/touchui/touch_selection_menu_runner_views.h" | 5 #include "ui/views/touchui/touch_selection_menu_runner_views.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 Layout(); | 152 Layout(); |
153 } | 153 } |
154 | 154 |
155 Button* TouchSelectionMenuRunnerViews::Menu::CreateButton( | 155 Button* TouchSelectionMenuRunnerViews::Menu::CreateButton( |
156 const base::string16& title, | 156 const base::string16& title, |
157 int tag) { | 157 int tag) { |
158 base::string16 label = | 158 base::string16 label = |
159 gfx::RemoveAcceleratorChar(title, '&', nullptr, nullptr); | 159 gfx::RemoveAcceleratorChar(title, '&', nullptr, nullptr); |
160 LabelButton* button = new LabelButton(this, label); | 160 LabelButton* button = new LabelButton(this, label); |
161 button->SetMinSize(gfx::Size(kMenuButtonMinWidth, kMenuButtonMinHeight)); | 161 button->SetMinSize(gfx::Size(kMenuButtonMinWidth, kMenuButtonMinHeight)); |
162 button->SetFocusBehavior(FocusBehavior::ALWAYS); | 162 Button::ConfigureDefaultFocus(button); |
163 button->set_request_focus_on_press(false); | 163 button->set_request_focus_on_press(false); |
164 const gfx::FontList& font_list = | 164 const gfx::FontList& font_list = |
165 ui::ResourceBundle::GetSharedInstance().GetFontList( | 165 ui::ResourceBundle::GetSharedInstance().GetFontList( |
166 ui::ResourceBundle::SmallFont); | 166 ui::ResourceBundle::SmallFont); |
167 button->SetFontList(font_list); | 167 button->SetFontList(font_list); |
168 button->SetHorizontalAlignment(gfx::ALIGN_CENTER); | 168 button->SetHorizontalAlignment(gfx::ALIGN_CENTER); |
169 button->set_tag(tag); | 169 button->set_tag(tag); |
170 return button; | 170 return button; |
171 } | 171 } |
172 | 172 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 // Closing the menu sets |menu_| to nullptr and eventually deletes the object. | 266 // Closing the menu sets |menu_| to nullptr and eventually deletes the object. |
267 menu_->Close(); | 267 menu_->Close(); |
268 DCHECK(!menu_); | 268 DCHECK(!menu_); |
269 } | 269 } |
270 | 270 |
271 bool TouchSelectionMenuRunnerViews::IsRunning() const { | 271 bool TouchSelectionMenuRunnerViews::IsRunning() const { |
272 return menu_ != nullptr; | 272 return menu_ != nullptr; |
273 } | 273 } |
274 | 274 |
275 } // namespace views | 275 } // namespace views |
OLD | NEW |