OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |