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/base/material_design/material_design_controller.h" | 10 #include "ui/base/material_design/material_design_controller.h" |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 | 299 |
300 //////////////////////////////////////////////////////////////////////////////// | 300 //////////////////////////////////////////////////////////////////////////////// |
301 // DialogClientView, private: | 301 // DialogClientView, private: |
302 | 302 |
303 LabelButton* DialogClientView::CreateDialogButton(ui::DialogButton type) { | 303 LabelButton* DialogClientView::CreateDialogButton(ui::DialogButton type) { |
304 const base::string16 title = GetDialogDelegate()->GetDialogButtonLabel(type); | 304 const base::string16 title = GetDialogDelegate()->GetDialogButtonLabel(type); |
305 LabelButton* button = NULL; | 305 LabelButton* button = NULL; |
306 if (GetDialogDelegate()->UseNewStyleForThisDialog() && | 306 if (GetDialogDelegate()->UseNewStyleForThisDialog() && |
307 GetDialogDelegate()->GetDefaultDialogButton() == type && | 307 GetDialogDelegate()->GetDefaultDialogButton() == type && |
308 GetDialogDelegate()->ShouldDefaultButtonBeBlue()) { | 308 GetDialogDelegate()->ShouldDefaultButtonBeBlue()) { |
309 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { | 309 return MdTextButton::CreateSecondaryUiBlueButton(this, title); |
310 MdTextButton* md_button = MdTextButton::CreateMdButton(this, title); | |
311 md_button->SetCallToAction(MdTextButton::STRONG_CALL_TO_ACTION); | |
312 button = md_button; | |
313 } else { | |
314 button = new BlueButton(this, title); | |
315 } | |
316 } else { | 310 } else { |
317 button = MdTextButton::CreateSecondaryUiButton(this, title); | 311 button = MdTextButton::CreateSecondaryUiButton(this, title); |
318 } | 312 } |
319 Button::ConfigureDefaultFocus(button); | |
320 | 313 |
321 const int kDialogMinButtonWidth = 75; | 314 const int kDialogMinButtonWidth = 75; |
322 button->SetMinSize(gfx::Size(kDialogMinButtonWidth, 0)); | 315 button->SetMinSize(gfx::Size(kDialogMinButtonWidth, 0)); |
323 button->SetGroup(kButtonGroup); | 316 button->SetGroup(kButtonGroup); |
324 return button; | 317 return button; |
325 } | 318 } |
326 | 319 |
327 int DialogClientView::GetButtonsAndExtraViewRowHeight() const { | 320 int DialogClientView::GetButtonsAndExtraViewRowHeight() const { |
328 int extra_view_height = ShouldShow(extra_view_) ? | 321 int extra_view_height = ShouldShow(extra_view_) ? |
329 extra_view_->GetPreferredSize().height() : 0; | 322 extra_view_->GetPreferredSize().height() : 0; |
(...skipping 26 matching lines...) Expand all Loading... |
356 std::remove(child_views.begin(), child_views.end(), nullptr), | 349 std::remove(child_views.begin(), child_views.end(), nullptr), |
357 child_views.end()); | 350 child_views.end()); |
358 | 351 |
359 // Setup focus by reordering views. It is not safe to use SetNextFocusableView | 352 // Setup focus by reordering views. It is not safe to use SetNextFocusableView |
360 // since child views may be added externally to this view. | 353 // since child views may be added externally to this view. |
361 for (size_t i = 0; i < child_views.size(); i++) | 354 for (size_t i = 0; i < child_views.size(); i++) |
362 ReorderChildView(child_views[i], i); | 355 ReorderChildView(child_views[i], i); |
363 } | 356 } |
364 | 357 |
365 } // namespace views | 358 } // namespace views |
OLD | NEW |