| 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 "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "ui/events/keycodes/keyboard_codes.h" | 10 #include "ui/events/keycodes/keyboard_codes.h" |
| 11 #include "ui/views/background.h" | 11 #include "ui/views/background.h" |
| 12 #include "ui/views/controls/button/blue_button.h" | 12 #include "ui/views/controls/button/blue_button.h" |
| 13 #include "ui/views/controls/button/label_button.h" | 13 #include "ui/views/controls/button/label_button.h" |
| 14 #include "ui/views/layout/layout_constants.h" | 14 #include "ui/views/layout/layout_constants.h" |
| 15 #include "ui/views/style/platform_style.h" |
| 15 #include "ui/views/widget/widget.h" | 16 #include "ui/views/widget/widget.h" |
| 16 #include "ui/views/window/dialog_delegate.h" | 17 #include "ui/views/window/dialog_delegate.h" |
| 17 | 18 |
| 18 namespace views { | 19 namespace views { |
| 19 | 20 |
| 20 namespace { | 21 namespace { |
| 21 | 22 |
| 22 // The group used by the buttons. This name is chosen voluntarily big not to | 23 // The group used by the buttons. This name is chosen voluntarily big not to |
| 23 // conflict with other groups that could be in the dialog content. | 24 // conflict with other groups that could be in the dialog content. |
| 24 const int kButtonGroup = 6666; | 25 const int kButtonGroup = 6666; |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 const base::string16 title = GetDialogDelegate()->GetDialogButtonLabel(type); | 306 const base::string16 title = GetDialogDelegate()->GetDialogButtonLabel(type); |
| 306 LabelButton* button = NULL; | 307 LabelButton* button = NULL; |
| 307 if (GetDialogDelegate()->UseNewStyleForThisDialog() && | 308 if (GetDialogDelegate()->UseNewStyleForThisDialog() && |
| 308 GetDialogDelegate()->GetDefaultDialogButton() == type && | 309 GetDialogDelegate()->GetDefaultDialogButton() == type && |
| 309 GetDialogDelegate()->ShouldDefaultButtonBeBlue()) { | 310 GetDialogDelegate()->ShouldDefaultButtonBeBlue()) { |
| 310 button = new BlueButton(this, title); | 311 button = new BlueButton(this, title); |
| 311 } else { | 312 } else { |
| 312 button = new LabelButton(this, title); | 313 button = new LabelButton(this, title); |
| 313 button->SetStyle(Button::STYLE_BUTTON); | 314 button->SetStyle(Button::STYLE_BUTTON); |
| 314 } | 315 } |
| 315 button->SetFocusable(true); | 316 PlatformStyle::ConfigureFocus(PlatformStyle::CONTROL::BUTTON, button); |
| 316 | 317 |
| 317 const int kDialogMinButtonWidth = 75; | 318 const int kDialogMinButtonWidth = 75; |
| 318 button->SetMinSize(gfx::Size(kDialogMinButtonWidth, 0)); | 319 button->SetMinSize(gfx::Size(kDialogMinButtonWidth, 0)); |
| 319 button->SetGroup(kButtonGroup); | 320 button->SetGroup(kButtonGroup); |
| 320 return button; | 321 return button; |
| 321 } | 322 } |
| 322 | 323 |
| 323 int DialogClientView::GetButtonsAndExtraViewRowHeight() const { | 324 int DialogClientView::GetButtonsAndExtraViewRowHeight() const { |
| 324 int extra_view_height = ShouldShow(extra_view_) ? | 325 int extra_view_height = ShouldShow(extra_view_) ? |
| 325 extra_view_->GetPreferredSize().height() : 0; | 326 extra_view_->GetPreferredSize().height() : 0; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 353 child_views.end()); | 354 child_views.end()); |
| 354 | 355 |
| 355 // Setup focus. | 356 // Setup focus. |
| 356 for (size_t i = 0; i < child_views.size(); i++) { | 357 for (size_t i = 0; i < child_views.size(); i++) { |
| 357 child_views[i]->SetNextFocusableView( | 358 child_views[i]->SetNextFocusableView( |
| 358 i + 1 != child_views.size() ? child_views[i + 1] : nullptr); | 359 i + 1 != child_views.size() ? child_views[i + 1] : nullptr); |
| 359 } | 360 } |
| 360 } | 361 } |
| 361 | 362 |
| 362 } // namespace views | 363 } // namespace views |
| OLD | NEW |