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

Side by Side Diff: ui/views/touchui/touch_selection_menu_runner_views.cc

Issue 1216673005: views::LabelButton should not call virtual methods from its constructor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20150703-Views-ButtonBorderRefactor
Patch Set: self review Created 5 years, 5 months 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
« no previous file with comments | « ui/views/focus/focus_traversal_unittest.cc ('k') | ui/views/window/dialog_client_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ui/views/focus/focus_traversal_unittest.cc ('k') | ui/views/window/dialog_client_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698