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 "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
9 #include "ui/base/l10n/l10n_util.h" | 9 #include "ui/base/l10n/l10n_util.h" |
10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 AddChildView( | 154 AddChildView( |
155 CreateButton(base::UTF8ToUTF16(kEllipsesButtonText), kEllipsesButtonTag)); | 155 CreateButton(base::UTF8ToUTF16(kEllipsesButtonText), kEllipsesButtonTag)); |
156 Layout(); | 156 Layout(); |
157 } | 157 } |
158 | 158 |
159 Button* TouchSelectionMenuRunnerViews::Menu::CreateButton( | 159 Button* TouchSelectionMenuRunnerViews::Menu::CreateButton( |
160 const base::string16& title, | 160 const base::string16& title, |
161 int tag) { | 161 int tag) { |
162 base::string16 label = | 162 base::string16 label = |
163 gfx::RemoveAcceleratorChar(title, '&', nullptr, nullptr); | 163 gfx::RemoveAcceleratorChar(title, '&', nullptr, nullptr); |
164 LabelButton* button = new LabelButton(this, label); | 164 LabelButton* button = new LabelButton(this); |
| 165 button->InitAsTextbutton(label); |
165 button->SetMinSize(gfx::Size(kMenuButtonMinWidth, kMenuButtonMinHeight)); | 166 button->SetMinSize(gfx::Size(kMenuButtonMinWidth, kMenuButtonMinHeight)); |
166 button->SetFocusable(true); | 167 button->SetFocusable(true); |
167 button->set_request_focus_on_press(false); | 168 button->set_request_focus_on_press(false); |
168 const gfx::FontList& font_list = | 169 const gfx::FontList& font_list = |
169 ui::ResourceBundle::GetSharedInstance().GetFontList( | 170 ui::ResourceBundle::GetSharedInstance().GetFontList( |
170 ui::ResourceBundle::SmallFont); | 171 ui::ResourceBundle::SmallFont); |
171 button->SetFontList(font_list); | 172 button->SetFontList(font_list); |
172 button->SetHorizontalAlignment(gfx::ALIGN_CENTER); | 173 button->SetHorizontalAlignment(gfx::ALIGN_CENTER); |
173 button->set_tag(tag); | 174 button->set_tag(tag); |
174 return button; | 175 return button; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 // Closing the menu will eventually delete the object. | 241 // Closing the menu will eventually delete the object. |
241 menu_->Close(); | 242 menu_->Close(); |
242 menu_ = nullptr; | 243 menu_ = nullptr; |
243 } | 244 } |
244 | 245 |
245 bool TouchSelectionMenuRunnerViews::IsRunning() const { | 246 bool TouchSelectionMenuRunnerViews::IsRunning() const { |
246 return menu_ != nullptr; | 247 return menu_ != nullptr; |
247 } | 248 } |
248 | 249 |
249 } // namespace views | 250 } // namespace views |
OLD | NEW |