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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 } | 154 } |
155 | 155 |
156 Button* TouchSelectionMenuRunnerViews::Menu::CreateButton( | 156 Button* TouchSelectionMenuRunnerViews::Menu::CreateButton( |
157 const base::string16& title, | 157 const base::string16& title, |
158 int tag) { | 158 int tag) { |
159 base::string16 label = | 159 base::string16 label = |
160 gfx::RemoveAcceleratorChar(title, '&', nullptr, nullptr); | 160 gfx::RemoveAcceleratorChar(title, '&', nullptr, nullptr); |
161 LabelButton* button = new LabelButton(this, label); | 161 LabelButton* button = new LabelButton(this, label); |
162 button->SetMinSize(gfx::Size(kMenuButtonMinWidth, kMenuButtonMinHeight)); | 162 button->SetMinSize(gfx::Size(kMenuButtonMinWidth, kMenuButtonMinHeight)); |
163 Button::ConfigureDefaultFocus(button); | 163 Button::ConfigureDefaultFocus(button); |
164 button->set_request_focus_on_press(false); | |
165 const gfx::FontList& font_list = | 164 const gfx::FontList& font_list = |
166 ui::ResourceBundle::GetSharedInstance().GetFontList( | 165 ui::ResourceBundle::GetSharedInstance().GetFontList( |
167 ui::ResourceBundle::SmallFont); | 166 ui::ResourceBundle::SmallFont); |
168 button->SetFontList(font_list); | 167 button->SetFontList(font_list); |
169 button->SetHorizontalAlignment(gfx::ALIGN_CENTER); | 168 button->SetHorizontalAlignment(gfx::ALIGN_CENTER); |
170 button->set_tag(tag); | 169 button->set_tag(tag); |
171 return button; | 170 return button; |
172 } | 171 } |
173 | 172 |
174 void TouchSelectionMenuRunnerViews::Menu::CloseMenu() { | 173 void TouchSelectionMenuRunnerViews::Menu::CloseMenu() { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 // Closing the menu sets |menu_| to nullptr and eventually deletes the object. | 270 // Closing the menu sets |menu_| to nullptr and eventually deletes the object. |
272 menu_->CloseMenu(); | 271 menu_->CloseMenu(); |
273 DCHECK(!menu_); | 272 DCHECK(!menu_); |
274 } | 273 } |
275 | 274 |
276 bool TouchSelectionMenuRunnerViews::IsRunning() const { | 275 bool TouchSelectionMenuRunnerViews::IsRunning() const { |
277 return menu_ != nullptr; | 276 return menu_ != nullptr; |
278 } | 277 } |
279 | 278 |
280 } // namespace views | 279 } // namespace views |
OLD | NEW |