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" |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 const base::string16 title = GetDialogDelegate()->GetDialogButtonLabel(type); | 306 const base::string16 title = GetDialogDelegate()->GetDialogButtonLabel(type); |
307 LabelButton* button = NULL; | 307 LabelButton* button = NULL; |
308 if (GetDialogDelegate()->UseNewStyleForThisDialog() && | 308 if (GetDialogDelegate()->UseNewStyleForThisDialog() && |
309 GetDialogDelegate()->GetDefaultDialogButton() == type && | 309 GetDialogDelegate()->GetDefaultDialogButton() == type && |
310 GetDialogDelegate()->ShouldDefaultButtonBeBlue()) { | 310 GetDialogDelegate()->ShouldDefaultButtonBeBlue()) { |
311 button = new BlueButton(this, title); | 311 button = new BlueButton(this, title); |
312 } else { | 312 } else { |
313 button = new LabelButton(this, title); | 313 button = new LabelButton(this, title); |
314 button->SetStyle(Button::STYLE_BUTTON); | 314 button->SetStyle(Button::STYLE_BUTTON); |
315 } | 315 } |
316 button->SetFocusBehavior(FocusBehavior::ALWAYS); | 316 Button::ConfigureDefaultFocus(button); |
317 | 317 |
318 const int kDialogMinButtonWidth = 75; | 318 const int kDialogMinButtonWidth = 75; |
319 button->SetMinSize(gfx::Size(kDialogMinButtonWidth, 0)); | 319 button->SetMinSize(gfx::Size(kDialogMinButtonWidth, 0)); |
320 button->SetGroup(kButtonGroup); | 320 button->SetGroup(kButtonGroup); |
321 return button; | 321 return button; |
322 } | 322 } |
323 | 323 |
324 int DialogClientView::GetButtonsAndExtraViewRowHeight() const { | 324 int DialogClientView::GetButtonsAndExtraViewRowHeight() const { |
325 int extra_view_height = ShouldShow(extra_view_) ? | 325 int extra_view_height = ShouldShow(extra_view_) ? |
326 extra_view_->GetPreferredSize().height() : 0; | 326 extra_view_->GetPreferredSize().height() : 0; |
(...skipping 26 matching lines...) Expand all Loading... |
353 std::remove(child_views.begin(), child_views.end(), nullptr), | 353 std::remove(child_views.begin(), child_views.end(), nullptr), |
354 child_views.end()); | 354 child_views.end()); |
355 | 355 |
356 // Setup focus by reordering views. It is not safe to use SetNextFocusableView | 356 // Setup focus by reordering views. It is not safe to use SetNextFocusableView |
357 // since child views may be added externally to this view. | 357 // since child views may be added externally to this view. |
358 for (size_t i = 0; i < child_views.size(); i++) | 358 for (size_t i = 0; i < child_views.size(); i++) |
359 ReorderChildView(child_views[i], i); | 359 ReorderChildView(child_views[i], i); |
360 } | 360 } |
361 | 361 |
362 } // namespace views | 362 } // namespace views |
OLD | NEW |