| 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->SetFocusForPlatform(); | 163 button->SetFocusForPlatform(); |
| 164 const gfx::FontList& font_list = | 164 button->AdjustFontSize(ui::ResourceBundle::kSmallFontDelta); |
| 165 ui::ResourceBundle::GetSharedInstance().GetFontList( | |
| 166 ui::ResourceBundle::SmallFont); | |
| 167 button->SetFontList(font_list); | |
| 168 button->SetHorizontalAlignment(gfx::ALIGN_CENTER); | 165 button->SetHorizontalAlignment(gfx::ALIGN_CENTER); |
| 169 button->set_tag(tag); | 166 button->set_tag(tag); |
| 170 return button; | 167 return button; |
| 171 } | 168 } |
| 172 | 169 |
| 173 void TouchSelectionMenuRunnerViews::Menu::CloseMenu() { | 170 void TouchSelectionMenuRunnerViews::Menu::CloseMenu() { |
| 174 DisconnectOwner(); | 171 DisconnectOwner(); |
| 175 // Closing the widget will self-destroy this object. | 172 // Closing the widget will self-destroy this object. |
| 176 Widget* widget = GetWidget(); | 173 Widget* widget = GetWidget(); |
| 177 if (widget && !widget->IsClosed()) | 174 if (widget && !widget->IsClosed()) |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 // Closing the menu sets |menu_| to nullptr and eventually deletes the object. | 267 // Closing the menu sets |menu_| to nullptr and eventually deletes the object. |
| 271 menu_->CloseMenu(); | 268 menu_->CloseMenu(); |
| 272 DCHECK(!menu_); | 269 DCHECK(!menu_); |
| 273 } | 270 } |
| 274 | 271 |
| 275 bool TouchSelectionMenuRunnerViews::IsRunning() const { | 272 bool TouchSelectionMenuRunnerViews::IsRunning() const { |
| 276 return menu_ != nullptr; | 273 return menu_ != nullptr; |
| 277 } | 274 } |
| 278 | 275 |
| 279 } // namespace views | 276 } // namespace views |
| OLD | NEW |