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

Side by Side Diff: ui/views/window/dialog_client_view.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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/window/dialog_client_view.h" 5 #include "ui/views/window/dialog_client_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ui/events/keycodes/keyboard_codes.h" 9 #include "ui/events/keycodes/keyboard_codes.h"
10 #include "ui/views/background.h" 10 #include "ui/views/background.h"
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 // DialogClientView, private: 385 // DialogClientView, private:
386 386
387 LabelButton* DialogClientView::CreateDialogButton(ui::DialogButton type) { 387 LabelButton* DialogClientView::CreateDialogButton(ui::DialogButton type) {
388 const base::string16 title = GetDialogDelegate()->GetDialogButtonLabel(type); 388 const base::string16 title = GetDialogDelegate()->GetDialogButtonLabel(type);
389 LabelButton* button = NULL; 389 LabelButton* button = NULL;
390 if (GetDialogDelegate()->UseNewStyleForThisDialog() && 390 if (GetDialogDelegate()->UseNewStyleForThisDialog() &&
391 GetDialogDelegate()->GetDefaultDialogButton() == type && 391 GetDialogDelegate()->GetDefaultDialogButton() == type &&
392 GetDialogDelegate()->ShouldDefaultButtonBeBlue()) { 392 GetDialogDelegate()->ShouldDefaultButtonBeBlue()) {
393 button = new BlueButton(this, title); 393 button = new BlueButton(this, title);
394 } else { 394 } else {
395 button = new LabelButton(this, title); 395 button = new LabelButton(this);
396 button->SetStyle(Button::STYLE_BUTTON); 396 button->InitAsButton(title);
397 } 397 }
398 button->SetFocusable(true); 398 button->SetFocusable(true);
399 399
400 const int kDialogMinButtonWidth = 75; 400 const int kDialogMinButtonWidth = 75;
401 button->SetMinSize(gfx::Size(kDialogMinButtonWidth, 0)); 401 button->SetMinSize(gfx::Size(kDialogMinButtonWidth, 0));
402 button->SetGroup(kButtonGroup); 402 button->SetGroup(kButtonGroup);
403 return button; 403 return button;
404 } 404 }
405 405
406 void DialogClientView::UpdateButton(LabelButton* button, 406 void DialogClientView::UpdateButton(LabelButton* button,
(...skipping 23 matching lines...) Expand all
430 gfx::Insets(0, kButtonHEdgeMarginNew, 430 gfx::Insets(0, kButtonHEdgeMarginNew,
431 kButtonVEdgeMarginNew, kButtonHEdgeMarginNew); 431 kButtonVEdgeMarginNew, kButtonHEdgeMarginNew);
432 } 432 }
433 433
434 void DialogClientView::Close() { 434 void DialogClientView::Close() {
435 GetWidget()->Close(); 435 GetWidget()->Close();
436 GetDialogDelegate()->OnClosed(); 436 GetDialogDelegate()->OnClosed();
437 } 437 }
438 438
439 } // namespace views 439 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/touchui/touch_selection_menu_runner_views.cc ('k') | ui/views/window/dialog_delegate_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698